@swr-data-lab/components 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/preview-head.html +13 -0
- package/package.json +1 -1
- package/src/Autocomplete/Autocomplete.svelte +2 -2
- package/src/Button/Button.svelte +1 -1
- package/src/Card/Card.stories.svelte +31 -0
- package/src/Card/Card.svelte +2 -1
- package/src/Container/Container.svelte +1 -1
- package/src/HighlightCard/HighlightCard.stories.svelte +60 -0
- package/src/HighlightCard/HighlightCard.svelte +64 -0
- package/src/HighlightCard/index.js +2 -0
- package/src/styles/_vars.scss +7 -8
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
/* Load SWR.de fonts for preview: */
|
|
3
|
+
@font-face {
|
|
4
|
+
font-family: 'SWR-VAR-Text';
|
|
5
|
+
src: url('https://www.swr.de/assets/fonts/swr_type/SWR_VAR_WEB/SWR-VAR-Text.woff2')
|
|
6
|
+
format('woff2');
|
|
7
|
+
}
|
|
8
|
+
@font-face {
|
|
9
|
+
font-family: 'SWR-VAR-Sans';
|
|
10
|
+
src: url('https://www.swr.de/assets/fonts/swr_type/SWR_VAR_WEB/SWR-VAR-Sans.woff2')
|
|
11
|
+
format('woff2');
|
|
12
|
+
}
|
|
13
|
+
</style>
|
package/package.json
CHANGED
|
@@ -169,7 +169,7 @@ Data should be provided as array of objects. Each object contains the informatio
|
|
|
169
169
|
position: absolute;
|
|
170
170
|
top: 100%;
|
|
171
171
|
border: 1px solid currentColor;
|
|
172
|
-
background: $
|
|
172
|
+
background: $color-violetblue;
|
|
173
173
|
border-bottom-left-radius: $border-radius-input;
|
|
174
174
|
border-bottom-right-radius: $border-radius-input;
|
|
175
175
|
border-top: 0;
|
|
@@ -218,7 +218,7 @@ Data should be provided as array of objects. Each object contains the informatio
|
|
|
218
218
|
}
|
|
219
219
|
&:hover,
|
|
220
220
|
&:focus {
|
|
221
|
-
color: $
|
|
221
|
+
color: $color-activeorange;
|
|
222
222
|
cursor: pointer;
|
|
223
223
|
}
|
|
224
224
|
}
|
package/src/Button/Button.svelte
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script context="module">
|
|
2
|
+
import Card from './Card.svelte';
|
|
3
|
+
|
|
4
|
+
export const meta = {
|
|
5
|
+
title: 'Input Components/Card',
|
|
6
|
+
component: Card
|
|
7
|
+
};
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
import { Story, Template } from '@storybook/addon-svelte-csf';
|
|
12
|
+
import {
|
|
13
|
+
userEvent,
|
|
14
|
+
within,
|
|
15
|
+
expect,
|
|
16
|
+
getByTestId,
|
|
17
|
+
getAllByLabelText,
|
|
18
|
+
getByText
|
|
19
|
+
} from '@storybook/test';
|
|
20
|
+
import { hasContext } from 'svelte';
|
|
21
|
+
import Input from '../Input/Input.svelte';
|
|
22
|
+
|
|
23
|
+
let component;
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<Story name="Basic card">
|
|
27
|
+
<Card>
|
|
28
|
+
<h1>Any content</h1>
|
|
29
|
+
<p>can be added to a basic <code>Card</code> component.</p>
|
|
30
|
+
</Card>
|
|
31
|
+
</Story>
|
package/src/Card/Card.svelte
CHANGED
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
<style lang="scss">
|
|
6
6
|
@import '../styles/base.scss';
|
|
7
7
|
.card {
|
|
8
|
+
@extend %copy;
|
|
8
9
|
width: auto;
|
|
9
10
|
max-width: $app-max-width;
|
|
10
11
|
color: white;
|
|
11
|
-
background: $
|
|
12
|
+
background: $color-violetblue;
|
|
12
13
|
border-radius: $border-radius-container;
|
|
13
14
|
margin: 0 1rem;
|
|
14
15
|
padding: 1.5rem;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script context="module">
|
|
2
|
+
import HighlightCard from './HighlightCard.svelte';
|
|
3
|
+
|
|
4
|
+
export const meta = {
|
|
5
|
+
title: 'Input Components/HighlightCard',
|
|
6
|
+
component: HighlightCard
|
|
7
|
+
};
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
import { Story, Template } from '@storybook/addon-svelte-csf';
|
|
12
|
+
import {
|
|
13
|
+
userEvent,
|
|
14
|
+
within,
|
|
15
|
+
expect,
|
|
16
|
+
getByTestId,
|
|
17
|
+
getAllByLabelText,
|
|
18
|
+
getByText
|
|
19
|
+
} from '@storybook/test';
|
|
20
|
+
import { hasContext } from 'svelte';
|
|
21
|
+
|
|
22
|
+
let component;
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<Story name="Basic HighlightCard">
|
|
26
|
+
<HighlightCard
|
|
27
|
+
topline="Die letzte Großspende liegt bei"
|
|
28
|
+
highlight="375.000"
|
|
29
|
+
highlightSecondary="Euro"
|
|
30
|
+
subline="Der Betrag ging am 7. Januar von Dr. Kim Musterperson ein."
|
|
31
|
+
/>
|
|
32
|
+
</Story>
|
|
33
|
+
|
|
34
|
+
<Story name="Basic HighlightCard">
|
|
35
|
+
<div class="columns">
|
|
36
|
+
<HighlightCard
|
|
37
|
+
topline="Im aktuellen Jahr wurden bisher"
|
|
38
|
+
highlight="375.000"
|
|
39
|
+
highlightSecondary="€"
|
|
40
|
+
subline="an Parteien gespendet."
|
|
41
|
+
/>
|
|
42
|
+
<HighlightCard
|
|
43
|
+
topline="Die letzte Großspende liegt bei"
|
|
44
|
+
highlight="37.500"
|
|
45
|
+
highlightSecondary="€"
|
|
46
|
+
subline="Der Betrag ging am 7. Januar von Dr. Kim Musterperson ein."
|
|
47
|
+
/>
|
|
48
|
+
</div>
|
|
49
|
+
</Story>
|
|
50
|
+
|
|
51
|
+
<style>
|
|
52
|
+
.columns {
|
|
53
|
+
display: flex;
|
|
54
|
+
margin-top: 2rem;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
:global(.columns > *) {
|
|
58
|
+
flex: 1;
|
|
59
|
+
}
|
|
60
|
+
</style>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Card from '../Card/Card.svelte';
|
|
3
|
+
|
|
4
|
+
export let topline = '';
|
|
5
|
+
export let highlight = '';
|
|
6
|
+
export let highlightSecondary = '';
|
|
7
|
+
export let subline = '';
|
|
8
|
+
export let alignCards = true;
|
|
9
|
+
export let maxWidth = '500px';
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<Card>
|
|
13
|
+
<div class="card-wrapper">
|
|
14
|
+
{#if topline}
|
|
15
|
+
<div class="top">
|
|
16
|
+
{@html topline}
|
|
17
|
+
</div>
|
|
18
|
+
{/if}
|
|
19
|
+
<div class="middle">
|
|
20
|
+
<span class="underline">
|
|
21
|
+
{highlight}
|
|
22
|
+
</span>
|
|
23
|
+
{highlightSecondary}
|
|
24
|
+
</div>
|
|
25
|
+
<div class="bottom">
|
|
26
|
+
{@html subline}
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</Card>
|
|
30
|
+
|
|
31
|
+
<style lang="scss">
|
|
32
|
+
@import '../styles/base.scss';
|
|
33
|
+
|
|
34
|
+
.card-wrapper {
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
height: 100%;
|
|
38
|
+
min-height: 200px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.top {
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: flex-end;
|
|
44
|
+
flex: 1;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.middle {
|
|
48
|
+
font-family: $swr-sans;
|
|
49
|
+
font-size: 60px;
|
|
50
|
+
font-weight: 700;
|
|
51
|
+
padding-bottom: 0.2em;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.bottom {
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: flex-start;
|
|
57
|
+
flex: 1;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.underline {
|
|
61
|
+
width: fit-content;
|
|
62
|
+
background: linear-gradient(to bottom, transparent 90%, $color-activeorange 90%);
|
|
63
|
+
}
|
|
64
|
+
</style>
|
package/src/styles/_vars.scss
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
$
|
|
2
|
-
$
|
|
3
|
-
$
|
|
4
|
-
$
|
|
5
|
-
$
|
|
6
|
-
$
|
|
7
|
-
$
|
|
8
|
-
$orange: #ff3300;
|
|
1
|
+
$color-black: #0c0c0c;
|
|
2
|
+
$color-violetblue: #1d0b40;
|
|
3
|
+
$color-violetblue-hover: #2d155d;
|
|
4
|
+
$color-violet: #5920c0;
|
|
5
|
+
$color-blue: #3053d9;
|
|
6
|
+
$color-warmgrey: #dbd5cd;
|
|
7
|
+
$color-activeorange: #ff3300;
|
|
9
8
|
|
|
10
9
|
$border-radius-container: 8px;
|
|
11
10
|
$border-radius-input: 4px;
|