@popsure/dirty-swan 0.26.10 → 0.26.13
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/dist/index.css +62 -0
- package/dist/index.css.map +1 -1
- package/dist/lib/scss/private/base/_border_radius.scss +15 -0
- package/dist/lib/scss/private/base/_grid.scss +8 -0
- package/dist/lib/scss/private/base/_index.scss +1 -0
- package/dist/lib/scss/private/base/style.module.scss +10 -0
- package/dist/lib/scss/public/colors/default.scss +5 -0
- package/dist/lib/scss/public/demo.tsx +13 -1
- package/package.json +2 -1
- package/src/App.tsx +50 -0
- package/src/bin/index.ts +71 -0
- package/src/bin/tsconfig.json +13 -0
- package/src/bin/util/index.test.ts +85 -0
- package/src/bin/util/index.ts +132 -0
- package/src/bin/util/test/data.json +13 -0
- package/src/colors.scss +1 -0
- package/src/font-weight.scss +1 -0
- package/src/grid.scss +1 -0
- package/src/index.tsx +37 -0
- package/src/intro.stories.mdx +41 -0
- package/src/lib/components/autocompleteAddress/demo.tsx +38 -0
- package/src/lib/components/autocompleteAddress/index.stories.mdx +44 -0
- package/src/lib/components/autocompleteAddress/index.tsx +316 -0
- package/src/lib/components/autocompleteAddress/mapStyle.ts +187 -0
- package/src/lib/components/autocompleteAddress/style.module.scss +82 -0
- package/src/lib/components/autocompleteAddress/util/index.test.ts +51 -0
- package/src/lib/components/autocompleteAddress/util/index.ts +55 -0
- package/src/lib/components/button/icons/index.ts +14 -0
- package/src/lib/components/button/icons/send-purple.svg +4 -0
- package/src/lib/components/button/icons/send-white.svg +4 -0
- package/src/lib/components/button/index.stories.mdx +121 -0
- package/src/lib/components/button/index.tsx +64 -0
- package/src/lib/components/button/styles.module.scss +5 -0
- package/src/lib/components/cards/a.stories.mdx +44 -0
- package/src/lib/components/cards/cardButton/index.stories.mdx +47 -0
- package/src/lib/components/cards/cardButton/index.tsx +61 -0
- package/src/lib/components/cards/cardButton/style.module.scss +33 -0
- package/src/lib/components/cards/cardWithLeftIcon/index.stories.mdx +103 -0
- package/src/lib/components/cards/cardWithLeftIcon/index.tsx +87 -0
- package/src/lib/components/cards/cardWithLeftIcon/style.module.scss +23 -0
- package/src/lib/components/cards/cardWithTopIcon/index.stories.mdx +105 -0
- package/src/lib/components/cards/cardWithTopIcon/index.tsx +60 -0
- package/src/lib/components/cards/cardWithTopIcon/style.module.scss +10 -0
- package/src/lib/components/cards/cardWithTopLeftIcon/index.stories.mdx +101 -0
- package/src/lib/components/cards/cardWithTopLeftIcon/index.tsx +72 -0
- package/src/lib/components/cards/cardWithTopLeftIcon/style.module.scss +21 -0
- package/src/lib/components/cards/icons/arrow-right.svg +4 -0
- package/src/lib/components/cards/icons/chevron-right.svg +3 -0
- package/src/lib/components/cards/icons/feather-logo.svg +10 -0
- package/src/lib/components/cards/icons/index.ts +36 -0
- package/src/lib/components/cards/icons/info.svg +12 -0
- package/src/lib/components/cards/index.test.ts +37 -0
- package/src/lib/components/cards/index.tsx +57 -0
- package/src/lib/components/cards/infoCard/index.stories.mdx +61 -0
- package/src/lib/components/cards/infoCard/index.tsx +47 -0
- package/src/lib/components/cards/infoCard/style.module.scss +53 -0
- package/src/lib/components/chip/icons/remove-button-highlighted.svg +4 -0
- package/src/lib/components/chip/icons/remove-button.svg +4 -0
- package/src/lib/components/chip/index.stories.mdx +101 -0
- package/src/lib/components/chip/index.tsx +38 -0
- package/src/lib/components/chip/style.module.scss +54 -0
- package/src/lib/components/comparisonTable/components/Chevron.tsx +19 -0
- package/src/lib/components/comparisonTable/components/Row/index.tsx +68 -0
- package/src/lib/components/comparisonTable/components/Row/style.module.scss +114 -0
- package/src/lib/components/comparisonTable/components/TableArrows/Arrow.tsx +19 -0
- package/src/lib/components/comparisonTable/components/TableArrows/index.tsx +52 -0
- package/src/lib/components/comparisonTable/components/TableArrows/style.module.scss +53 -0
- package/src/lib/components/comparisonTable/components/TableInfoButton/index.tsx +37 -0
- package/src/lib/components/comparisonTable/components/TableInfoButton/style.module.scss +30 -0
- package/src/lib/components/comparisonTable/components/TableRating/StarIcon.tsx +13 -0
- package/src/lib/components/comparisonTable/components/TableRating/ZapIcon.tsx +17 -0
- package/src/lib/components/comparisonTable/components/TableRating/index.tsx +45 -0
- package/src/lib/components/comparisonTable/components/TableRating/style.module.scss +13 -0
- package/src/lib/components/comparisonTable/components/TableRowHeader/index.tsx +35 -0
- package/src/lib/components/comparisonTable/components/TableRowHeader/style.module.scss +3 -0
- package/src/lib/components/comparisonTable/components/TableTrueFalse.tsx +40 -0
- package/src/lib/components/comparisonTable/hooks/useActiveTableArrows.ts +63 -0
- package/src/lib/components/comparisonTable/index.stories.mdx +254 -0
- package/src/lib/components/comparisonTable/index.tsx +211 -0
- package/src/lib/components/comparisonTable/style.module.scss +104 -0
- package/src/lib/components/dateSelector/datepicker.scss +406 -0
- package/src/lib/components/dateSelector/icons/calendar.svg +6 -0
- package/src/lib/components/dateSelector/icons/chevron-left.svg +3 -0
- package/src/lib/components/dateSelector/icons/chevron-right.svg +3 -0
- package/src/lib/components/dateSelector/index.stories.mdx +62 -0
- package/src/lib/components/dateSelector/index.test.ts +33 -0
- package/src/lib/components/dateSelector/index.tsx +247 -0
- package/src/lib/components/dateSelector/style.module.scss +77 -0
- package/src/lib/components/downloadButton/icons/check.svg +3 -0
- package/src/lib/components/downloadButton/icons/download.svg +5 -0
- package/src/lib/components/downloadButton/index.stories.mdx +59 -0
- package/src/lib/components/downloadButton/index.tsx +67 -0
- package/src/lib/components/downloadButton/style.module.scss +19 -0
- package/src/lib/components/downloadRing/icons/check-outside-circle.tsx +26 -0
- package/src/lib/components/downloadRing/icons/download-cloud.tsx +18 -0
- package/src/lib/components/downloadRing/icons/style.module.scss +7 -0
- package/src/lib/components/downloadRing/index.stories.mdx +35 -0
- package/src/lib/components/downloadRing/index.tsx +79 -0
- package/src/lib/components/downloadRing/style.module.scss +66 -0
- package/src/lib/components/dropzone/images/error.tsx +18 -0
- package/src/lib/components/dropzone/images/file.tsx +26 -0
- package/src/lib/components/dropzone/images/style.module.scss +7 -0
- package/src/lib/components/dropzone/images/upload-complete.tsx +24 -0
- package/src/lib/components/dropzone/images/upload.tsx +18 -0
- package/src/lib/components/dropzone/index.stories.mdx +44 -0
- package/src/lib/components/dropzone/index.tsx +152 -0
- package/src/lib/components/dropzone/style.module.scss +90 -0
- package/src/lib/components/input/a.stories.mdx +28 -0
- package/src/lib/components/input/autoSuggestInput/index.stories.mdx +137 -0
- package/src/lib/components/input/autoSuggestInput/index.tsx +81 -0
- package/src/lib/components/input/autoSuggestInput/style.module.scss +71 -0
- package/src/lib/components/input/autoSuggestMultiSelect/index.stories.mdx +115 -0
- package/src/lib/components/input/autoSuggestMultiSelect/index.tsx +75 -0
- package/src/lib/components/input/autoSuggestMultiSelect/style.module.scss +4 -0
- package/src/lib/components/input/currency/format/index.test.ts +49 -0
- package/src/lib/components/input/currency/format/index.ts +15 -0
- package/src/lib/components/input/currency/index.stories.mdx +25 -0
- package/src/lib/components/input/currency/index.test.tsx +56 -0
- package/src/lib/components/input/currency/index.tsx +53 -0
- package/src/lib/components/input/iban/formatIban/index.test.ts +11 -0
- package/src/lib/components/input/iban/formatIban/index.ts +22 -0
- package/src/lib/components/input/iban/index.stories.mdx +21 -0
- package/src/lib/components/input/iban/index.tsx +20 -0
- package/src/lib/components/input/index.stories.mdx +62 -0
- package/src/lib/components/input/index.tsx +51 -0
- package/src/lib/components/input/style.module.scss +94 -0
- package/src/lib/components/modal/bottomModal/img/close.svg +4 -0
- package/src/lib/components/modal/bottomModal/index.tsx +68 -0
- package/src/lib/components/modal/bottomModal/style.module.scss +104 -0
- package/src/lib/components/modal/bottomOrRegularModal/index.tsx +43 -0
- package/src/lib/components/modal/bottomOrRegularModal/style.module.scss +16 -0
- package/src/lib/components/modal/hooks/useOnClose.ts +51 -0
- package/src/lib/components/modal/index.stories.mdx +316 -0
- package/src/lib/components/modal/index.ts +14 -0
- package/src/lib/components/modal/regularModal/img/close.svg +4 -0
- package/src/lib/components/modal/regularModal/index.tsx +55 -0
- package/src/lib/components/modal/regularModal/style.module.scss +106 -0
- package/src/lib/components/multiDropzone/UploadFileCell/index.tsx +138 -0
- package/src/lib/components/multiDropzone/UploadFileCell/style.module.scss +101 -0
- package/src/lib/components/multiDropzone/icons/bmp-complete.svg +10 -0
- package/src/lib/components/multiDropzone/icons/bmp.svg +10 -0
- package/src/lib/components/multiDropzone/icons/doc-complete.svg +11 -0
- package/src/lib/components/multiDropzone/icons/doc.svg +11 -0
- package/src/lib/components/multiDropzone/icons/docx-complete.svg +12 -0
- package/src/lib/components/multiDropzone/icons/docx.svg +12 -0
- package/src/lib/components/multiDropzone/icons/eye.svg +4 -0
- package/src/lib/components/multiDropzone/icons/generic-complete.svg +4 -0
- package/src/lib/components/multiDropzone/icons/generic-error.svg +7 -0
- package/src/lib/components/multiDropzone/icons/generic.svg +4 -0
- package/src/lib/components/multiDropzone/icons/heic-complete.svg +11 -0
- package/src/lib/components/multiDropzone/icons/heic.svg +11 -0
- package/src/lib/components/multiDropzone/icons/index.ts +51 -0
- package/src/lib/components/multiDropzone/icons/jpeg-complete.svg +11 -0
- package/src/lib/components/multiDropzone/icons/jpeg.svg +11 -0
- package/src/lib/components/multiDropzone/icons/jpg-complete.svg +10 -0
- package/src/lib/components/multiDropzone/icons/jpg.svg +10 -0
- package/src/lib/components/multiDropzone/icons/pdf-complete.svg +8 -0
- package/src/lib/components/multiDropzone/icons/pdf.svg +8 -0
- package/src/lib/components/multiDropzone/icons/png-complete.svg +10 -0
- package/src/lib/components/multiDropzone/icons/png.svg +10 -0
- package/src/lib/components/multiDropzone/icons/trash.svg +6 -0
- package/src/lib/components/multiDropzone/icons/upload.svg +5 -0
- package/src/lib/components/multiDropzone/index.stories.mdx +91 -0
- package/src/lib/components/multiDropzone/index.tsx +99 -0
- package/src/lib/components/multiDropzone/style.module.scss +32 -0
- package/src/lib/components/segmentedControl/index.stories.mdx +47 -0
- package/src/lib/components/segmentedControl/index.tsx +105 -0
- package/src/lib/components/segmentedControl/style.module.scss +36 -0
- package/src/lib/components/signaturePad/img/reset.svg +4 -0
- package/src/lib/components/signaturePad/img/sign.svg +3 -0
- package/src/lib/components/signaturePad/index.stories.mdx +17 -0
- package/src/lib/components/signaturePad/index.tsx +96 -0
- package/src/lib/components/signaturePad/style.module.scss +90 -0
- package/src/lib/index.tsx +71 -0
- package/src/lib/models/autoSuggestInput/index.ts +4 -0
- package/src/lib/models/download.ts +1 -0
- package/src/lib/models/downloadRing/index.ts +6 -0
- package/src/lib/scss/index.scss +22 -0
- package/src/lib/scss/private/_reset.scss +149 -0
- package/src/lib/scss/private/base/_border_radius.scss +15 -0
- package/src/lib/scss/private/base/_colors.scss +19 -0
- package/src/lib/scss/private/base/_cursors.scss +31 -0
- package/src/lib/scss/private/base/_display.scss +35 -0
- package/src/lib/scss/private/base/_grid.scss +60 -0
- package/src/lib/scss/private/base/_index.scss +10 -0
- package/src/lib/scss/private/base/_shadows.scss +2 -0
- package/src/lib/scss/private/base/_spacing.scss +89 -0
- package/src/lib/scss/private/base/_typography.scss +128 -0
- package/src/lib/scss/private/base/_width_and_height.scss +25 -0
- package/src/lib/scss/private/base/border_radius.stories.mdx +43 -0
- package/src/lib/scss/private/base/cursors.stories.mdx +18 -0
- package/src/lib/scss/private/base/demo.tsx +119 -0
- package/src/lib/scss/private/base/display.stories.mdx +19 -0
- package/src/lib/scss/private/base/flex/_flex.scss +63 -0
- package/src/lib/scss/private/base/flex/flex.stories.mdx +139 -0
- package/src/lib/scss/private/base/flex/style.module.scss +24 -0
- package/src/lib/scss/private/base/spacing.stories.mdx +185 -0
- package/src/lib/scss/private/base/style.module.scss +52 -0
- package/src/lib/scss/private/base/typography.stories.mdx +71 -0
- package/src/lib/scss/private/base/width_and_height.stories.mdx +172 -0
- package/src/lib/scss/private/components/_badge.scss +41 -0
- package/src/lib/scss/private/components/_buttons.scss +193 -0
- package/src/lib/scss/private/components/_cards.scss +32 -0
- package/src/lib/scss/private/components/_index.scss +6 -0
- package/src/lib/scss/private/components/_input.scss +241 -0
- package/src/lib/scss/private/components/_notices.scss +39 -0
- package/src/lib/scss/private/components/_spinner.scss +60 -0
- package/src/lib/scss/private/components/assets/checkmark.svg +3 -0
- package/src/lib/scss/private/components/assets/icon-form-dropdown.svg +3 -0
- package/src/lib/scss/private/components/badge.stories.mdx +37 -0
- package/src/lib/scss/private/components/button.stories.mdx +107 -0
- package/src/lib/scss/private/components/cards.stories.mdx +35 -0
- package/src/lib/scss/private/components/checkbox.stories.mdx +47 -0
- package/src/lib/scss/private/components/input.stories.mdx +33 -0
- package/src/lib/scss/private/components/notices.stories.mdx +37 -0
- package/src/lib/scss/private/components/radio.stories.mdx +47 -0
- package/src/lib/scss/private/components/select.stories.mdx +17 -0
- package/src/lib/scss/private/components/spinner.stories.mdx +25 -0
- package/src/lib/scss/public/colors/_index.scss +2 -0
- package/src/lib/scss/public/colors/default.scss +130 -0
- package/src/lib/scss/public/colors/overrides.scss +0 -0
- package/src/lib/scss/public/colors.stories.mdx +27 -0
- package/src/lib/scss/public/demo.tsx +297 -0
- package/src/lib/scss/public/font/_index.scss +2 -0
- package/src/lib/scss/public/font/default.scss +3 -0
- package/src/lib/scss/public/font/overrides.scss +0 -0
- package/src/lib/scss/public/font-weight.scss +9 -0
- package/src/lib/scss/public/font-weight.stories.mdx +32 -0
- package/src/lib/scss/public/grid.scss +21 -0
- package/src/lib/scss/public/grid.stories.mdx +41 -0
- package/src/lib/scss/third-party/_google_places.scss +62 -0
- package/src/lib/scss/third-party/_index.scss +1 -0
- package/src/lib/scss/utils/_index.scss +3 -0
- package/src/lib/util/calendarDate/index.test.ts +32 -0
- package/src/lib/util/calendarDate/index.ts +30 -0
- package/src/lib/util/zeroFill.test.ts +15 -0
- package/src/lib/util/zeroFill.ts +7 -0
- package/src/react-app-env.d.ts +1 -0
- package/src/setupTests.js +8 -0
- package/src/theme.stories.mdx +54 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { associatedClassForCardState, CardProps, headingForCardSize } from '..';
|
|
2
|
+
import { Icon, arrowRight } from '../icons';
|
|
3
|
+
|
|
4
|
+
import styles from './style.module.scss';
|
|
5
|
+
|
|
6
|
+
const containerStyleFromCardSize = (
|
|
7
|
+
cardSize: 'xsmall' | 'small' | 'medium' | 'big'
|
|
8
|
+
): string => {
|
|
9
|
+
switch (cardSize) {
|
|
10
|
+
case 'xsmall':
|
|
11
|
+
return 'container--xsmall';
|
|
12
|
+
case 'small':
|
|
13
|
+
return 'container--small';
|
|
14
|
+
default:
|
|
15
|
+
return 'container';
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const cardTextStyleFromCardSize = (
|
|
20
|
+
cardSize: 'xsmall' | 'small' | 'medium' | 'big'
|
|
21
|
+
): string => {
|
|
22
|
+
switch (cardSize) {
|
|
23
|
+
case 'xsmall':
|
|
24
|
+
case 'small':
|
|
25
|
+
return 'card-text--small';
|
|
26
|
+
case 'medium':
|
|
27
|
+
return 'card-text--medium';
|
|
28
|
+
default:
|
|
29
|
+
return 'card-text--big';
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default ({
|
|
34
|
+
className = '',
|
|
35
|
+
title,
|
|
36
|
+
cardSize = 'medium',
|
|
37
|
+
children,
|
|
38
|
+
leftIcon,
|
|
39
|
+
rightIcon,
|
|
40
|
+
state = 'actionable',
|
|
41
|
+
dropshadow = true,
|
|
42
|
+
...props
|
|
43
|
+
}: CardProps & {
|
|
44
|
+
cardSize?: 'xsmall' | 'small' | 'medium' | 'big';
|
|
45
|
+
leftIcon?: Icon;
|
|
46
|
+
rightIcon?: 'arrow' | Icon;
|
|
47
|
+
}) => {
|
|
48
|
+
const cardStyle = `d-flex ai-center ${className} ${associatedClassForCardState(
|
|
49
|
+
state,
|
|
50
|
+
dropshadow
|
|
51
|
+
)} ${styles[containerStyleFromCardSize(cardSize)]}`;
|
|
52
|
+
|
|
53
|
+
const headingStyle = headingForCardSize(cardSize);
|
|
54
|
+
const iconStyle = cardSize === 'xsmall' ? 'mr16' : 'mr32';
|
|
55
|
+
const cardTextStyle = `tc-grey-600 ${
|
|
56
|
+
cardSize === 'xsmall' ? 'p-p--small' : 'p-p '
|
|
57
|
+
} ${styles[cardTextStyleFromCardSize(cardSize)]}`;
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<div className={cardStyle} {...props}>
|
|
61
|
+
{leftIcon && (
|
|
62
|
+
<img
|
|
63
|
+
width="48px"
|
|
64
|
+
height="48px"
|
|
65
|
+
className={iconStyle}
|
|
66
|
+
src={leftIcon.src}
|
|
67
|
+
alt={leftIcon.alt}
|
|
68
|
+
/>
|
|
69
|
+
)}
|
|
70
|
+
<div>
|
|
71
|
+
<div className="d-flex">
|
|
72
|
+
<div className={headingStyle}>{title}</div>
|
|
73
|
+
{rightIcon && (
|
|
74
|
+
<img
|
|
75
|
+
className="ml-auto"
|
|
76
|
+
width="24px"
|
|
77
|
+
height="24px"
|
|
78
|
+
src={rightIcon === 'arrow' ? arrowRight.src : rightIcon.src}
|
|
79
|
+
alt={rightIcon === 'arrow' ? arrowRight.alt : rightIcon.alt}
|
|
80
|
+
/>
|
|
81
|
+
)}
|
|
82
|
+
</div>
|
|
83
|
+
<p className={cardTextStyle}>{children}</p>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
padding: 24px 24px 24px 32px;
|
|
3
|
+
|
|
4
|
+
&--small {
|
|
5
|
+
padding: 16px 24px 16px 32px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
&--xsmall {
|
|
9
|
+
padding: 16px 16px 16px 24px;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.card-text--small {
|
|
14
|
+
margin-top: 2px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.card-text--medium {
|
|
18
|
+
margin-top: 4px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.card-text--big {
|
|
22
|
+
margin-top: 6px;
|
|
23
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { Meta, Preview } from '@storybook/addon-docs/blocks';
|
|
2
|
+
|
|
3
|
+
import CardWithTopIcon from '.';
|
|
4
|
+
import { featherLogo } from '../icons';
|
|
5
|
+
|
|
6
|
+
<Meta title="JSX/Cards/Card with top icon" />
|
|
7
|
+
|
|
8
|
+
# Card with top icon
|
|
9
|
+
|
|
10
|
+
| attribute | unit | description | default value | required |
|
|
11
|
+
| ---------- | ------------------------------------------------------------------------------------ | ------------------------------------------------ | ------------- | -------- |
|
|
12
|
+
| title | string | The title text that needs to be displayed | n/a | true |
|
|
13
|
+
| cardSize | [Card Size (s,m,b)](?path=/story/jsx-cards-intro--page#card-size-xsmall-small-medium-big) | Size of the card | medium | false |
|
|
14
|
+
| topIcon | [Icon](?path=/story/jsx-cards-intro--page#icon) | Icon displayed on the top of the card | n/a | true |
|
|
15
|
+
| rightIcon | [Icon](?path=/story/jsx-cards-intro--page#icon) | Icon displayed on the right of the title | n/a | false |
|
|
16
|
+
| state | [Card State](?path=/story/jsx-cards-intro--page#card-state) | State that describe the interation with the card | actionable | false |
|
|
17
|
+
| dropshadow | boolean | If the card should have a box-shadow or not | true | false |
|
|
18
|
+
|
|
19
|
+
<Preview>
|
|
20
|
+
<>
|
|
21
|
+
<h4 className="p-h4">Small card</h4>
|
|
22
|
+
<CardWithTopIcon
|
|
23
|
+
title="Lorem ipsum"
|
|
24
|
+
cardSize="small"
|
|
25
|
+
className="wmx6 mt8"
|
|
26
|
+
rightIcon="arrow"
|
|
27
|
+
topIcon={featherLogo}
|
|
28
|
+
>
|
|
29
|
+
<p className="p-p mt16 tc-grey-600">
|
|
30
|
+
Praesent euismod porta odio at tempus.{' '}
|
|
31
|
+
<span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
|
|
32
|
+
eros at, rhoncus imperdiet nunc
|
|
33
|
+
</p>
|
|
34
|
+
</CardWithTopIcon>
|
|
35
|
+
<h4 className="p-h4 mt24">Medium card</h4>
|
|
36
|
+
<CardWithTopIcon
|
|
37
|
+
title="Lorem ipsum"
|
|
38
|
+
cardSize="medium"
|
|
39
|
+
className="wmx6 mt8"
|
|
40
|
+
rightIcon="arrow"
|
|
41
|
+
topIcon={featherLogo}
|
|
42
|
+
>
|
|
43
|
+
<p className="p-p mt16 tc-grey-600">
|
|
44
|
+
Praesent euismod porta odio at tempus.{' '}
|
|
45
|
+
<span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
|
|
46
|
+
eros at, rhoncus imperdiet nunc
|
|
47
|
+
</p>
|
|
48
|
+
</CardWithTopIcon>
|
|
49
|
+
<h4 className="p-h4 mt24">Big card</h4>
|
|
50
|
+
<CardWithTopIcon
|
|
51
|
+
title="Lorem ipsum"
|
|
52
|
+
cardSize="big"
|
|
53
|
+
className="wmx6 mt8"
|
|
54
|
+
rightIcon="arrow"
|
|
55
|
+
topIcon={featherLogo}
|
|
56
|
+
>
|
|
57
|
+
<p className="p-p mt16 tc-grey-600">
|
|
58
|
+
Praesent euismod porta odio at tempus.{' '}
|
|
59
|
+
<span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
|
|
60
|
+
eros at, rhoncus imperdiet nunc
|
|
61
|
+
</p>
|
|
62
|
+
</CardWithTopIcon>
|
|
63
|
+
<h4 className="p-h4 mt24">Muted</h4>
|
|
64
|
+
<CardWithTopIcon
|
|
65
|
+
title="Lorem ipsum"
|
|
66
|
+
className="wmx6 mt8"
|
|
67
|
+
rightIcon="arrow"
|
|
68
|
+
topIcon={featherLogo}
|
|
69
|
+
state="muted"
|
|
70
|
+
>
|
|
71
|
+
<p className="p-p mt16 tc-grey-600">
|
|
72
|
+
Praesent euismod porta odio at tempus.{' '}
|
|
73
|
+
<span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
|
|
74
|
+
eros at, rhoncus imperdiet nunc
|
|
75
|
+
</p>
|
|
76
|
+
</CardWithTopIcon>
|
|
77
|
+
<h4 className="p-h4 mt24">No right icon</h4>
|
|
78
|
+
<CardWithTopIcon
|
|
79
|
+
title="Lorem ipsum"
|
|
80
|
+
topIcon={featherLogo}
|
|
81
|
+
cardSize="small"
|
|
82
|
+
className="wmx6 mt8"
|
|
83
|
+
>
|
|
84
|
+
<p className="p-p mt16 tc-grey-600">
|
|
85
|
+
Praesent euismod porta odio at tempus.{' '}
|
|
86
|
+
<span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
|
|
87
|
+
eros at, rhoncus imperdiet nunc
|
|
88
|
+
</p>
|
|
89
|
+
</CardWithTopIcon>
|
|
90
|
+
<h4 className="p-h4 mt24">No dropshadow</h4>
|
|
91
|
+
<CardWithTopIcon
|
|
92
|
+
title="Lorem ipsum"
|
|
93
|
+
topIcon={featherLogo}
|
|
94
|
+
cardSize="small"
|
|
95
|
+
className="wmx6 mt8"
|
|
96
|
+
dropshadow={false}
|
|
97
|
+
>
|
|
98
|
+
<p className="p-p mt16 tc-grey-600">
|
|
99
|
+
Praesent euismod porta odio at tempus.{' '}
|
|
100
|
+
<span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
|
|
101
|
+
eros at, rhoncus imperdiet nunc
|
|
102
|
+
</p>
|
|
103
|
+
</CardWithTopIcon>
|
|
104
|
+
</>
|
|
105
|
+
</Preview>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import {
|
|
2
|
+
associatedClassForCardState,
|
|
3
|
+
CardProps,
|
|
4
|
+
headingForCardSize,
|
|
5
|
+
} from '..';
|
|
6
|
+
import { Icon, arrowRight, IconSize } from '../icons';
|
|
7
|
+
|
|
8
|
+
import styles from './style.module.scss';
|
|
9
|
+
|
|
10
|
+
export default ({
|
|
11
|
+
className,
|
|
12
|
+
title,
|
|
13
|
+
cardSize = 'medium',
|
|
14
|
+
children,
|
|
15
|
+
topIcon,
|
|
16
|
+
topIconSize = { width: 48, height: 48 },
|
|
17
|
+
rightIcon,
|
|
18
|
+
state = 'actionable',
|
|
19
|
+
dropshadow = true,
|
|
20
|
+
...props
|
|
21
|
+
}: CardProps & {
|
|
22
|
+
topIcon: Icon;
|
|
23
|
+
topIconSize: IconSize;
|
|
24
|
+
cardSize?: 'small' | 'medium' | 'big';
|
|
25
|
+
rightIcon?: 'arrow' | Icon;
|
|
26
|
+
}) => {
|
|
27
|
+
const cardStyle = `d-flex fd-column ai-center ${className} ${associatedClassForCardState(
|
|
28
|
+
state,
|
|
29
|
+
dropshadow
|
|
30
|
+
)} ${styles.container}`;
|
|
31
|
+
|
|
32
|
+
const headingStyle = headingForCardSize(cardSize);
|
|
33
|
+
const iconStyle = styles['right-icon'];
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<>
|
|
37
|
+
<div className={cardStyle} {...props}>
|
|
38
|
+
<img
|
|
39
|
+
width={topIconSize.width}
|
|
40
|
+
height={topIconSize.height}
|
|
41
|
+
alt={topIcon.alt}
|
|
42
|
+
src={topIcon.src}
|
|
43
|
+
/>
|
|
44
|
+
<div className="d-flex mt16">
|
|
45
|
+
<div className={headingStyle}>{title}</div>
|
|
46
|
+
{rightIcon && (
|
|
47
|
+
<img
|
|
48
|
+
className={iconStyle}
|
|
49
|
+
width="24px"
|
|
50
|
+
height="24px"
|
|
51
|
+
src={rightIcon === 'arrow' ? arrowRight.src : rightIcon.src}
|
|
52
|
+
alt={rightIcon === 'arrow' ? arrowRight.alt : rightIcon.alt}
|
|
53
|
+
/>
|
|
54
|
+
)}
|
|
55
|
+
</div>
|
|
56
|
+
{children}
|
|
57
|
+
</div>
|
|
58
|
+
</>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { Meta, Preview } from '@storybook/addon-docs/blocks';
|
|
2
|
+
|
|
3
|
+
import CardWithTopLeftIcon from '.';
|
|
4
|
+
import { featherLogo } from '../icons';
|
|
5
|
+
|
|
6
|
+
<Meta title="JSX/Cards/Card with top left icon" />
|
|
7
|
+
|
|
8
|
+
# Card with top left icon
|
|
9
|
+
|
|
10
|
+
| attribute | unit | description | default value | required |
|
|
11
|
+
| ---------- | --------------------------------------------------------------------------------- | ------------------------------------------------ | ------------- | -------- |
|
|
12
|
+
| title | string | The title text that needs to be displayed | n/a | true |
|
|
13
|
+
| cardSize | [Card Size (xs,s,m,b)](?path=/story/jsx-cards-intro--page#card-size-xsmall-small-medium-big) | Size of the card | medium | false |
|
|
14
|
+
| topIcon | [Icon](?path=/story/jsx-cards-intro--page#icon) | Icon displayed on the left of the title | n/a | false |
|
|
15
|
+
| rightIcon | [Icon](?path=/story/jsx-cards-intro--page#icon) | Icon displayed on the right of the title | n/a | false |
|
|
16
|
+
| state | [Card State](?path=/story/jsx-cards-intro--page#card-state) | State that describe the interation with the card | actionable | false |
|
|
17
|
+
| dropshadow | boolean | If the card should have a box-shadow or not | true | false |
|
|
18
|
+
|
|
19
|
+
<Preview>
|
|
20
|
+
<>
|
|
21
|
+
<h4 className="p-h4">Extra small card</h4>
|
|
22
|
+
<CardWithTopLeftIcon
|
|
23
|
+
title="Lorem ipsum"
|
|
24
|
+
cardSize="xsmall"
|
|
25
|
+
className="wmx6 mt8"
|
|
26
|
+
rightIcon="arrow"
|
|
27
|
+
leftIcon={featherLogo}
|
|
28
|
+
>
|
|
29
|
+
Praesent euismod porta odio at tempus.{' '}
|
|
30
|
+
<span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
|
|
31
|
+
eros at, rhoncus imperdiet nunc
|
|
32
|
+
</CardWithTopLeftIcon>
|
|
33
|
+
<h4 className="p-h4 mt24">Small card</h4>
|
|
34
|
+
<CardWithTopLeftIcon
|
|
35
|
+
title="Lorem ipsum"
|
|
36
|
+
cardSize="small"
|
|
37
|
+
className="wmx6 mt8"
|
|
38
|
+
rightIcon="arrow"
|
|
39
|
+
leftIcon={featherLogo}
|
|
40
|
+
>
|
|
41
|
+
Praesent euismod porta odio at tempus.{' '}
|
|
42
|
+
<span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
|
|
43
|
+
eros at, rhoncus imperdiet nunc
|
|
44
|
+
</CardWithTopLeftIcon>
|
|
45
|
+
<h4 className="p-h4 mt24">Medium card</h4>
|
|
46
|
+
<CardWithTopLeftIcon
|
|
47
|
+
title="Lorem ipsum"
|
|
48
|
+
cardSize="medium"
|
|
49
|
+
className="wmx6 mt8"
|
|
50
|
+
rightIcon="arrow"
|
|
51
|
+
leftIcon={featherLogo}
|
|
52
|
+
>
|
|
53
|
+
Praesent euismod porta odio at tempus.{' '}
|
|
54
|
+
<span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
|
|
55
|
+
eros at, rhoncus imperdiet nunc
|
|
56
|
+
</CardWithTopLeftIcon>
|
|
57
|
+
<h4 className="p-h4 mt24">Big card</h4>
|
|
58
|
+
<CardWithTopLeftIcon
|
|
59
|
+
title="Lorem ipsum"
|
|
60
|
+
cardSize="big"
|
|
61
|
+
className="wmx6 mt8"
|
|
62
|
+
rightIcon="arrow"
|
|
63
|
+
leftIcon={featherLogo}
|
|
64
|
+
>
|
|
65
|
+
Praesent euismod porta odio at tempus.{' '}
|
|
66
|
+
<span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
|
|
67
|
+
eros at, rhoncus imperdiet nunc
|
|
68
|
+
</CardWithTopLeftIcon>
|
|
69
|
+
<h4 className="p-h4 mt24">Muted</h4>
|
|
70
|
+
<CardWithTopLeftIcon
|
|
71
|
+
title="Lorem ipsum"
|
|
72
|
+
state="muted"
|
|
73
|
+
className="wmx6 mt8"
|
|
74
|
+
rightIcon="arrow"
|
|
75
|
+
leftIcon={featherLogo}
|
|
76
|
+
>
|
|
77
|
+
Praesent euismod porta odio at tempus.{' '}
|
|
78
|
+
<span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
|
|
79
|
+
eros at, rhoncus imperdiet nunc
|
|
80
|
+
</CardWithTopLeftIcon>
|
|
81
|
+
<h4 className="p-h4 mt24">No right icon or left icon</h4>
|
|
82
|
+
<CardWithTopLeftIcon title="Lorem ipsum" className="wmx6 mt8">
|
|
83
|
+
Praesent euismod porta odio at tempus.{' '}
|
|
84
|
+
<span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
|
|
85
|
+
eros at, rhoncus imperdiet nunc
|
|
86
|
+
</CardWithTopLeftIcon>
|
|
87
|
+
<h4 className="p-h4">No dropshadow</h4>
|
|
88
|
+
<CardWithTopLeftIcon
|
|
89
|
+
title="Lorem ipsum"
|
|
90
|
+
cardSize="medium"
|
|
91
|
+
className="wmx6 mt8"
|
|
92
|
+
rightIcon="arrow"
|
|
93
|
+
leftIcon={featherLogo}
|
|
94
|
+
dropshadow={false}
|
|
95
|
+
>
|
|
96
|
+
Praesent euismod porta odio at tempus.{' '}
|
|
97
|
+
<span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
|
|
98
|
+
eros at, rhoncus imperdiet nunc
|
|
99
|
+
</CardWithTopLeftIcon>
|
|
100
|
+
</>
|
|
101
|
+
</Preview>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {
|
|
2
|
+
associatedClassForCardState,
|
|
3
|
+
CardProps,
|
|
4
|
+
headingForCardSize,
|
|
5
|
+
} from '..';
|
|
6
|
+
import { Icon, arrowRight, featherLogo } from '../icons';
|
|
7
|
+
|
|
8
|
+
import styles from './style.module.scss';
|
|
9
|
+
|
|
10
|
+
const containerStyleFromTitleSize = (
|
|
11
|
+
titleSize: 'xsmall' | 'small' | 'medium' | 'big'
|
|
12
|
+
): string => {
|
|
13
|
+
switch (titleSize) {
|
|
14
|
+
case 'xsmall':
|
|
15
|
+
return 'container--xsmall';
|
|
16
|
+
default:
|
|
17
|
+
return 'container';
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default ({
|
|
22
|
+
className,
|
|
23
|
+
title,
|
|
24
|
+
cardSize = 'medium',
|
|
25
|
+
children,
|
|
26
|
+
leftIcon,
|
|
27
|
+
rightIcon,
|
|
28
|
+
state = 'actionable',
|
|
29
|
+
dropshadow = true,
|
|
30
|
+
...props
|
|
31
|
+
}: CardProps & {
|
|
32
|
+
cardSize?: 'xsmall' | 'small' | 'medium' | 'big';
|
|
33
|
+
leftIcon?: 'logo' | Icon;
|
|
34
|
+
rightIcon?: 'arrow' | Icon;
|
|
35
|
+
}) => {
|
|
36
|
+
const cardStyle = `${className} ${associatedClassForCardState(
|
|
37
|
+
state,
|
|
38
|
+
dropshadow
|
|
39
|
+
)} ${styles[containerStyleFromTitleSize(cardSize)]}`;
|
|
40
|
+
|
|
41
|
+
const titleContainerStyle = styles['title-container'];
|
|
42
|
+
const headingStyle = headingForCardSize(cardSize);
|
|
43
|
+
const iconStyle = styles['right-icon'];
|
|
44
|
+
const cardTextStyle = `p-p tc-grey-600 ${cardSize === 'xsmall' ? styles.indent : 'mt16'}`;
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<div className={cardStyle} {...props}>
|
|
48
|
+
<div className={titleContainerStyle}>
|
|
49
|
+
{leftIcon && (
|
|
50
|
+
<img
|
|
51
|
+
className="mr8"
|
|
52
|
+
width="28px"
|
|
53
|
+
height="28px"
|
|
54
|
+
src={leftIcon === 'logo' ? featherLogo.src : leftIcon.src}
|
|
55
|
+
alt={leftIcon === 'logo' ? featherLogo.alt : leftIcon.src}
|
|
56
|
+
/>
|
|
57
|
+
)}
|
|
58
|
+
<div className={headingStyle}>{title}</div>
|
|
59
|
+
{rightIcon && (
|
|
60
|
+
<img
|
|
61
|
+
className={iconStyle}
|
|
62
|
+
width="24px"
|
|
63
|
+
height="24px"
|
|
64
|
+
src={rightIcon === 'arrow' ? arrowRight.src : rightIcon.src}
|
|
65
|
+
alt={rightIcon === 'arrow' ? arrowRight.alt : rightIcon.alt}
|
|
66
|
+
/>
|
|
67
|
+
)}
|
|
68
|
+
</div>
|
|
69
|
+
<p className={cardTextStyle}>{children}</p>
|
|
70
|
+
</div>
|
|
71
|
+
);
|
|
72
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M5 12H19" stroke="#8E8CEE" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
|
3
|
+
<path d="M12 5L19 12L12 19" stroke="#8E8CEE" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<mask id="mask0" mask-type="alpha" maskUnits="userSpaceOnUse" x="3" y="0" width="22" height="28">
|
|
3
|
+
<path d="M23.8761 0C14.4485 4.03927 5.77595 19.2529 3.53731 26.0756C3.04003 27.5912 2.60201 29.2504 4.03812 26.6043C4.89889 25.0183 7.02902 22.7858 11.8864 21.9848C15.7724 21.344 17.3995 20.5116 19.8916 17.6795C18.7427 18.0914 17.2587 18.9525 14.0909 17.9656C18.4837 18.3512 21.5108 15.748 22.6934 12.044C19.7931 13.3599 17.3385 12.4392 16.6956 12.1007C20.6519 12.2002 23.9887 9.68393 24.7913 5.49304C25.2591 3.05005 24.5097 0.800979 23.8761 0Z" fill="#6160A2"/>
|
|
4
|
+
</mask>
|
|
5
|
+
<g mask="url(#mask0)">
|
|
6
|
+
<path d="M21.1875 1.45451C12.8431 6.88225 5.56109 19.9077 3.53731 26.0756C3.04003 27.5912 2.60201 29.2504 4.03812 26.6043C4.89889 25.0183 7.02902 22.7858 11.8864 21.9848C15.1146 21.4525 16.784 20.7879 18.6853 18.9545C19.0219 18.63 19.1998 17.9565 18.7553 18.1015C18.24 18.2696 17.709 17.5612 18.205 17.3425C19.7521 16.6603 20.976 15.4887 21.8303 14.0102C22.2446 13.2932 20.7231 12.6796 19.8955 12.7075C18.8859 12.7415 19.6982 11.6399 20.6391 11.2723C21.8973 10.7807 23.0427 10.0842 23.7916 9.26859C24.7617 8.21223 24.48 7.11878 24.7913 5.49304C24.969 4.56516 24.971 3.66526 24.8706 2.86204C24.6464 1.06951 22.7019 0.469502 21.1875 1.45451Z" fill="#6160A2"/>
|
|
7
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M30.4837 5.72996C30.4837 14.8734 23.1695 22.4039 14.0022 22.4039C4.83493 22.4039 -2.47925 14.8734 -2.47925 5.72996C-2.47925 -3.4135 4.83493 -10.944 14.0022 -10.944C23.1695 -10.944 30.4837 -3.4135 30.4837 5.72996ZM14.0022 18.0289C20.6884 18.0289 26.1087 12.5225 26.1087 5.72996C26.1087 -1.06259 20.6884 -6.56903 14.0022 -6.56903C7.316 -6.56903 1.89575 -1.06259 1.89575 5.72996C1.89575 12.5225 7.316 18.0289 14.0022 18.0289Z" fill="#90DF9B"/>
|
|
8
|
+
<path d="M26.1087 5.72995C26.1087 12.5225 20.6884 18.0289 14.0022 18.0289C7.316 18.0289 1.89575 12.5225 1.89575 5.72995C1.89575 -1.06259 7.316 -6.56903 14.0022 -6.56903C20.6884 -6.56903 26.1087 -1.06259 26.1087 5.72995Z" fill="#8E8CEE"/>
|
|
9
|
+
</g>
|
|
10
|
+
</svg>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import arrowRightImage from './arrow-right.svg';
|
|
2
|
+
import featherLogoImage from './feather-logo.svg';
|
|
3
|
+
import infoImage from './info.svg';
|
|
4
|
+
import chevronRightImage from './chevron-right.svg';
|
|
5
|
+
|
|
6
|
+
export interface Icon {
|
|
7
|
+
src: string;
|
|
8
|
+
alt: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface IconSize {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const arrowRight: Icon = {
|
|
17
|
+
src: arrowRightImage,
|
|
18
|
+
alt: 'arrow pointing right',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const featherLogo: Icon = {
|
|
22
|
+
src: featherLogoImage,
|
|
23
|
+
alt: 'feather logo',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const info: Icon = {
|
|
27
|
+
src: infoImage,
|
|
28
|
+
alt: 'circle with the letter i inside for information',
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const chevronRight: Icon = {
|
|
32
|
+
src: chevronRightImage,
|
|
33
|
+
alt: 'chevron facing right',
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export { arrowRight, featherLogo, info, chevronRight };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0)">
|
|
3
|
+
<path d="M10 18.3334C14.6024 18.3334 18.3334 14.6024 18.3334 10C18.3334 5.39765 14.6024 1.66669 10 1.66669C5.39765 1.66669 1.66669 5.39765 1.66669 10C1.66669 14.6024 5.39765 18.3334 10 18.3334Z" stroke="#8E8CEE" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
|
4
|
+
<path d="M10 13.3333V10" stroke="#8E8CEE" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
|
5
|
+
<circle cx="10" cy="6.66665" r="0.833333" fill="#8E8CEE"/>
|
|
6
|
+
</g>
|
|
7
|
+
<defs>
|
|
8
|
+
<clipPath id="clip0">
|
|
9
|
+
<rect width="20" height="20" fill="white"/>
|
|
10
|
+
</clipPath>
|
|
11
|
+
</defs>
|
|
12
|
+
</svg>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { associatedClassForCardState } from '.';
|
|
2
|
+
|
|
3
|
+
describe('Associated class for card state', () => {
|
|
4
|
+
it('Should be an actionable class', () => {
|
|
5
|
+
expect(associatedClassForCardState('actionable', true)).toEqual(
|
|
6
|
+
'ds-card--actionable'
|
|
7
|
+
);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('Should be a muted class', () => {
|
|
11
|
+
expect(associatedClassForCardState('muted', true)).toEqual(
|
|
12
|
+
'ds-card--muted'
|
|
13
|
+
);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('Should be a static class', () => {
|
|
17
|
+
expect(associatedClassForCardState('static', true)).toEqual('ds-card');
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('Should be an actionable class without dropshadow', () => {
|
|
21
|
+
expect(associatedClassForCardState('actionable', false)).toEqual(
|
|
22
|
+
'ds-card--actionable ds-card--no-dropshadow'
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('Should be a muted class without dropshadow', () => {
|
|
27
|
+
expect(associatedClassForCardState('muted', false)).toEqual(
|
|
28
|
+
'ds-card--muted ds-card--no-dropshadow'
|
|
29
|
+
);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('Should be a static class without dropshadow', () => {
|
|
33
|
+
expect(associatedClassForCardState('static', false)).toEqual(
|
|
34
|
+
'ds-card ds-card--no-dropshadow'
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import CardWithTopLeftIcon from './cardWithTopLeftIcon';
|
|
2
|
+
import CardWithLeftIcon from './cardWithLeftIcon';
|
|
3
|
+
import CardWithTopIcon from './cardWithTopIcon';
|
|
4
|
+
import InfoCard from './infoCard';
|
|
5
|
+
import CardButton from './cardButton';
|
|
6
|
+
|
|
7
|
+
type CardState = 'actionable' | 'static' | 'muted';
|
|
8
|
+
|
|
9
|
+
export type CardProps = {
|
|
10
|
+
title: string;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
state?: CardState;
|
|
13
|
+
dropshadow?: boolean;
|
|
14
|
+
} & JSX.IntrinsicElements['div'];
|
|
15
|
+
|
|
16
|
+
export const headingForCardSize = (
|
|
17
|
+
cardSize: 'xsmall' | 'small' | 'medium' | 'big'
|
|
18
|
+
): string => {
|
|
19
|
+
switch (cardSize) {
|
|
20
|
+
case 'xsmall':
|
|
21
|
+
case 'small':
|
|
22
|
+
return 'p-h4';
|
|
23
|
+
case 'medium':
|
|
24
|
+
return 'p-h3';
|
|
25
|
+
case 'big':
|
|
26
|
+
return 'p-h2';
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const associatedClassForCardState = (
|
|
31
|
+
state: CardState,
|
|
32
|
+
dropshadow: boolean
|
|
33
|
+
): string => {
|
|
34
|
+
const baseClass = (() => {
|
|
35
|
+
switch (state) {
|
|
36
|
+
case 'actionable':
|
|
37
|
+
return 'ds-card--actionable';
|
|
38
|
+
case 'muted':
|
|
39
|
+
return 'ds-card--muted';
|
|
40
|
+
case 'static':
|
|
41
|
+
return 'ds-card';
|
|
42
|
+
}
|
|
43
|
+
})();
|
|
44
|
+
|
|
45
|
+
if (dropshadow === false) {
|
|
46
|
+
return `${baseClass} ds-card--no-dropshadow`;
|
|
47
|
+
}
|
|
48
|
+
return baseClass;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export {
|
|
52
|
+
CardWithTopLeftIcon,
|
|
53
|
+
CardWithLeftIcon,
|
|
54
|
+
CardWithTopIcon,
|
|
55
|
+
InfoCard,
|
|
56
|
+
CardButton,
|
|
57
|
+
};
|