@popsure/dirty-swan 0.54.2 → 0.54.3

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.
Files changed (106) hide show
  1. package/dist/cjs/index.js +329 -239
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/lib/components/table/components/TableCell/BaseCell/BaseCell.d.ts +17 -0
  4. package/dist/cjs/lib/components/table/components/TableCell/BaseCell/BaseCell.stories.d.ts +22 -0
  5. package/dist/cjs/lib/components/table/components/TableCell/BaseCell/MiniProgressBar/MiniProgressBar.d.ts +3 -0
  6. package/dist/cjs/lib/components/table/components/TableCell/BaseCell/MiniProgressBar/MiniProgressBar.stories.d.ts +25 -0
  7. package/dist/cjs/lib/components/table/components/TableCell/ButtonCell/ButtonCell.d.ts +9 -0
  8. package/dist/cjs/lib/components/table/components/TableCell/ButtonCell/ButtonCell.stories.d.ts +17 -0
  9. package/dist/cjs/lib/components/table/components/TableCell/CTACell/CTACell.d.ts +9 -0
  10. package/dist/cjs/lib/components/table/components/TableCell/CTACell/CTACell.stories.d.ts +17 -0
  11. package/dist/cjs/lib/components/table/components/TableCell/TableCell.d.ts +5 -17
  12. package/dist/cjs/lib/components/table/types.d.ts +11 -2
  13. package/dist/cjs/lib/components/table/utils/useTableNavigation/useTableNavigation.d.ts +1 -2
  14. package/dist/esm/components/cards/card/index.stories.js +2 -2
  15. package/dist/esm/components/cards/card/index.stories.js.map +1 -1
  16. package/dist/esm/components/comparisonTable/components/TableInfoButton/index.js +2 -2
  17. package/dist/esm/components/comparisonTable/components/TableInfoButton/index.js.map +1 -1
  18. package/dist/esm/components/comparisonTable/index.js +3 -1526
  19. package/dist/esm/components/comparisonTable/index.js.map +1 -1
  20. package/dist/esm/components/comparisonTable/index.stories.js +1 -0
  21. package/dist/esm/components/comparisonTable/index.stories.js.map +1 -1
  22. package/dist/esm/components/icon/icons/Info.js +2 -2
  23. package/dist/esm/components/icon/icons/Info.js.map +1 -1
  24. package/dist/esm/components/icon/icons.stories.js +1 -1
  25. package/dist/esm/components/icon/index.stories.js +1 -1
  26. package/dist/esm/components/table/Table.js +26 -12
  27. package/dist/esm/components/table/Table.js.map +1 -1
  28. package/dist/esm/components/table/Table.stories.js +54 -12
  29. package/dist/esm/components/table/Table.stories.js.map +1 -1
  30. package/dist/esm/components/table/Table.test.js +12 -6
  31. package/dist/esm/components/table/Table.test.js.map +1 -1
  32. package/dist/esm/components/table/components/TableCell/BaseCell/BaseCell.js +50 -0
  33. package/dist/esm/components/table/components/TableCell/BaseCell/BaseCell.js.map +1 -0
  34. package/dist/esm/components/table/components/TableCell/BaseCell/BaseCell.stories.js +43 -0
  35. package/dist/esm/components/table/components/TableCell/BaseCell/BaseCell.stories.js.map +1 -0
  36. package/dist/esm/components/table/components/TableCell/BaseCell/MiniProgressBar/MiniProgressBar.js +15 -0
  37. package/dist/esm/components/table/components/TableCell/BaseCell/MiniProgressBar/MiniProgressBar.js.map +1 -0
  38. package/dist/esm/components/table/components/TableCell/BaseCell/MiniProgressBar/MiniProgressBar.stories.js +31 -0
  39. package/dist/esm/components/table/components/TableCell/BaseCell/MiniProgressBar/MiniProgressBar.stories.js.map +1 -0
  40. package/dist/esm/components/table/components/TableCell/ButtonCell/ButtonCell.js +23 -0
  41. package/dist/esm/components/table/components/TableCell/ButtonCell/ButtonCell.js.map +1 -0
  42. package/dist/esm/components/table/components/TableCell/ButtonCell/ButtonCell.stories.js +28 -0
  43. package/dist/esm/components/table/components/TableCell/ButtonCell/ButtonCell.stories.js.map +1 -0
  44. package/dist/esm/components/table/components/TableCell/CTACell/CTACell.js +21 -0
  45. package/dist/esm/components/table/components/TableCell/CTACell/CTACell.js.map +1 -0
  46. package/dist/esm/components/table/components/TableCell/CTACell/CTACell.stories.js +25 -0
  47. package/dist/esm/components/table/components/TableCell/CTACell/CTACell.stories.js.map +1 -0
  48. package/dist/esm/components/table/components/TableCell/TableCell.js +21 -20
  49. package/dist/esm/components/table/components/TableCell/TableCell.js.map +1 -1
  50. package/dist/esm/components/table/components/TableCell/TableCell.test.js +28 -14
  51. package/dist/esm/components/table/components/TableCell/TableCell.test.js.map +1 -1
  52. package/dist/esm/components/table/components/TableContents/TableContents.js +10 -2
  53. package/dist/esm/components/table/components/TableContents/TableContents.js.map +1 -1
  54. package/dist/esm/components/table/components/TableContents/TableContents.test.js +9 -2
  55. package/dist/esm/components/table/components/TableContents/TableContents.test.js.map +1 -1
  56. package/dist/esm/components/table/components/TableSection/TableSection.js +39 -7
  57. package/dist/esm/components/table/components/TableSection/TableSection.js.map +1 -1
  58. package/dist/esm/components/table/components/TableSection/TableSection.test.js +9 -2
  59. package/dist/esm/components/table/components/TableSection/TableSection.test.js.map +1 -1
  60. package/dist/esm/components/table/utils/useTableNavigation/useTableNavigation.test.js +1 -5
  61. package/dist/esm/components/table/utils/useTableNavigation/useTableNavigation.test.js.map +1 -1
  62. package/dist/esm/index-3d286178.js +1529 -0
  63. package/dist/esm/index-3d286178.js.map +1 -0
  64. package/dist/esm/{index-0bb5a2ee.js → index-7506ae25.js} +3 -3
  65. package/dist/esm/{index-0bb5a2ee.js.map → index-7506ae25.js.map} +1 -1
  66. package/dist/esm/index.js +6 -1
  67. package/dist/esm/index.js.map +1 -1
  68. package/dist/esm/lib/components/table/components/TableCell/BaseCell/BaseCell.d.ts +17 -0
  69. package/dist/esm/lib/components/table/components/TableCell/BaseCell/BaseCell.stories.d.ts +22 -0
  70. package/dist/esm/lib/components/table/components/TableCell/BaseCell/MiniProgressBar/MiniProgressBar.d.ts +3 -0
  71. package/dist/esm/lib/components/table/components/TableCell/BaseCell/MiniProgressBar/MiniProgressBar.stories.d.ts +25 -0
  72. package/dist/esm/lib/components/table/components/TableCell/ButtonCell/ButtonCell.d.ts +9 -0
  73. package/dist/esm/lib/components/table/components/TableCell/ButtonCell/ButtonCell.stories.d.ts +17 -0
  74. package/dist/esm/lib/components/table/components/TableCell/CTACell/CTACell.d.ts +9 -0
  75. package/dist/esm/lib/components/table/components/TableCell/CTACell/CTACell.stories.d.ts +17 -0
  76. package/dist/esm/lib/components/table/components/TableCell/TableCell.d.ts +5 -17
  77. package/dist/esm/lib/components/table/types.d.ts +11 -2
  78. package/dist/esm/lib/components/table/utils/useTableNavigation/useTableNavigation.d.ts +1 -2
  79. package/dist/esm/{useTableNavigation-8e50b121.js → useTableNavigation-2899712c.js} +12 -16
  80. package/dist/esm/useTableNavigation-2899712c.js.map +1 -0
  81. package/package.json +1 -1
  82. package/src/lib/components/table/Table.stories.tsx +41 -5
  83. package/src/lib/components/table/Table.test.tsx +1 -1
  84. package/src/lib/components/table/Table.tsx +17 -8
  85. package/src/lib/components/table/components/TableCell/BaseCell/BaseCell.module.scss +36 -0
  86. package/src/lib/components/table/components/TableCell/BaseCell/BaseCell.stories.tsx +45 -0
  87. package/src/lib/components/table/components/TableCell/BaseCell/BaseCell.tsx +160 -0
  88. package/src/lib/components/table/components/TableCell/BaseCell/MiniProgressBar/MiniProgressBar.module.scss +44 -0
  89. package/src/lib/components/table/components/TableCell/BaseCell/MiniProgressBar/MiniProgressBar.stories.tsx +29 -0
  90. package/src/lib/components/table/components/TableCell/BaseCell/MiniProgressBar/MiniProgressBar.tsx +35 -0
  91. package/src/lib/components/table/components/TableCell/ButtonCell/ButtonCell.module.scss +43 -0
  92. package/src/lib/components/table/components/TableCell/ButtonCell/ButtonCell.stories.tsx +65 -0
  93. package/src/lib/components/table/components/TableCell/ButtonCell/ButtonCell.tsx +40 -0
  94. package/src/lib/components/table/components/TableCell/CTACell/CTACell.module.scss +3 -0
  95. package/src/lib/components/table/components/TableCell/CTACell/CTACell.stories.tsx +34 -0
  96. package/src/lib/components/table/components/TableCell/CTACell/CTACell.tsx +40 -0
  97. package/src/lib/components/table/components/TableCell/TableCell.module.scss +0 -43
  98. package/src/lib/components/table/components/TableCell/TableCell.test.tsx +25 -13
  99. package/src/lib/components/table/components/TableCell/TableCell.tsx +16 -122
  100. package/src/lib/components/table/components/TableContents/TableContents.test.tsx +2 -2
  101. package/src/lib/components/table/components/TableSection/TableSection.test.tsx +3 -3
  102. package/src/lib/components/table/components/TableSection/TableSection.tsx +40 -13
  103. package/src/lib/components/table/types.ts +9 -2
  104. package/src/lib/components/table/utils/useTableNavigation/useTableNavigation.test.tsx +0 -4
  105. package/src/lib/components/table/utils/useTableNavigation/useTableNavigation.ts +13 -20
  106. package/dist/esm/useTableNavigation-8e50b121.js.map +0 -1
@@ -7,9 +7,45 @@ const initialData: TableData = [
7
7
  rows: [
8
8
  [
9
9
  { content: 'Our plans' },
10
- { content: 'Surgery', modalContent: 'More info on surgery' },
11
- { content: 'Standard' },
12
- { content: 'Premium' },
10
+ {
11
+ type: 'CTA',
12
+ content: 'Standard',
13
+ subContent: '€234',
14
+ href: 'http://example.com',
15
+ },
16
+ {
17
+ type: 'CTA',
18
+ content: 'Plus',
19
+ subContent: '€344',
20
+ href: 'http://example.com',
21
+ },
22
+ {
23
+ type: 'CTA',
24
+ content: 'Premium',
25
+ subContent: '€556',
26
+ href: 'http://example.com',
27
+ },
28
+ ],
29
+ [
30
+ { content: 'Select a plan' },
31
+ {
32
+ type: 'BUTTON',
33
+ content: 'Standard',
34
+ subContent: '€234',
35
+ onClick: () => {},
36
+ },
37
+ {
38
+ type: 'BUTTON',
39
+ content: 'Plus',
40
+ subContent: '€344',
41
+ onClick: () => {},
42
+ },
43
+ {
44
+ type: 'BUTTON',
45
+ content: 'Premium',
46
+ subContent: '€556',
47
+ onClick: () => {},
48
+ },
13
49
  ],
14
50
  [
15
51
  {
@@ -17,8 +53,8 @@ const initialData: TableData = [
17
53
  subContent: 'Annual Only',
18
54
  },
19
55
  { content: 'No', subContent: 'Annual Only' },
20
- { content: 'Yes' },
21
- { content: 'Yes' },
56
+ { content: '50%' },
57
+ { content: '80%-100%' },
22
58
  ],
23
59
  [
24
60
  { content: 'Operations', modalContent: 'Operations info' },
@@ -81,7 +81,7 @@ describe('Table', () => {
81
81
  it('shows a modal when clicking on info icon', async () => {
82
82
  const { user } = render(<Table tableData={tableData} title="Test Table" />);
83
83
 
84
- await user.click(screen.getByText('View more info'));
84
+ await user.click(screen.getByTestId('ds-table-info-button'));
85
85
 
86
86
  expect(screen.getByText('Additional item')).toBeVisible();
87
87
  });
@@ -1,6 +1,6 @@
1
1
  import { TableCell, TableCellProps } from './components/TableCell/TableCell';
2
2
  import { BottomOrRegularModal } from '../modal';
3
- import { useRef, useState } from 'react';
3
+ import { ReactNode, useRef, useState } from 'react';
4
4
  import { ChevronDownIcon, ChevronUpIcon } from '../icon';
5
5
  import { Card } from '../cards/card';
6
6
 
@@ -60,7 +60,6 @@ const Table = ({
60
60
  const { activeSection, navigateTable } = useTableNavigation({
61
61
  enabled: isMobile,
62
62
  containerRef,
63
- columnsLength,
64
63
  onSelectionChanged,
65
64
  });
66
65
 
@@ -71,6 +70,17 @@ const Table = ({
71
70
  setInfoModalData({ body, title });
72
71
  };
73
72
 
73
+ const isBaseCell = !currentActiveSection.type;
74
+ let openModal;
75
+
76
+ if (isBaseCell) {
77
+ openModal = (body: ReactNode) =>
78
+ handleOpenModal({
79
+ body,
80
+ title: currentActiveSection?.content,
81
+ });
82
+ }
83
+
74
84
  return (
75
85
  <div className={classNames(styles.wrapper, 'bg-white')}>
76
86
  {isMobile ? (
@@ -82,12 +92,11 @@ const Table = ({
82
92
  >
83
93
  <TableCell
84
94
  {...currentActiveSection}
85
- openModal={(body) =>
86
- handleOpenModal({
87
- body,
88
- title: currentActiveSection?.content,
89
- })
90
- }
95
+ {...(isBaseCell
96
+ ? {
97
+ openModal,
98
+ }
99
+ : {})}
91
100
  isNavigation
92
101
  />
93
102
  </TableControls>
@@ -0,0 +1,36 @@
1
+ @use "../../../../../scss/public/grid" as *;
2
+ @use "../../../../../scss/public/colors" as *;
3
+
4
+ .infoButton {
5
+ min-height: initial;
6
+ height: initial;
7
+ width: initial;
8
+ padding: 0;
9
+ }
10
+
11
+ .icon {
12
+ margin: 2px;
13
+ }
14
+
15
+ .bigWithUnderline {
16
+ position: relative;
17
+ display: none;
18
+
19
+ &:after {
20
+ content: '';
21
+ display: block;
22
+ position: absolute;
23
+ top: calc(
24
+ 50% + 16px
25
+ ); // Display bottom border at the same distance regardless of cell height
26
+
27
+ height: 4px;
28
+ width: 100%;
29
+ max-width: 140px;
30
+ background-color: $ds-primary-500;
31
+ }
32
+
33
+ @include p-size-tablet {
34
+ display: flex;
35
+ }
36
+ }
@@ -0,0 +1,45 @@
1
+ import { BaseCell } from './BaseCell';
2
+
3
+ const story = {
4
+ title: 'JSX/Table/Cells',
5
+ component: BaseCell,
6
+ argTypes: {},
7
+ args: {
8
+ rating: {
9
+ value: 2,
10
+ type: 'zap',
11
+ },
12
+ content: 'For dogs',
13
+ subContent: 'Annual only',
14
+ modalContent: 'More info',
15
+ checkmarkValue: undefined,
16
+ contentFontVariant: 'NORMAL',
17
+ },
18
+ };
19
+
20
+ export const BaseCellStory = ({
21
+ content,
22
+ subContent,
23
+ modalContent,
24
+ checkmarkValue,
25
+ rating,
26
+ contentFontVariant,
27
+ align,
28
+ }: React.ComponentProps<typeof BaseCell>) => (
29
+ <div className="p48 d-flex fd-column gap16 bg-white">
30
+ <BaseCell
31
+ align={align}
32
+ checkmarkValue={checkmarkValue}
33
+ content={content}
34
+ contentFontVariant={contentFontVariant}
35
+ modalContent={modalContent}
36
+ openModal={() => {}}
37
+ rating={rating}
38
+ subContent={subContent}
39
+ />
40
+ </div>
41
+ );
42
+
43
+ BaseCellStory.storyName = 'BaseCell';
44
+
45
+ export default story;
@@ -0,0 +1,160 @@
1
+ import classNames from 'classnames';
2
+ import { Button } from '../../../../button';
3
+ import {
4
+ CheckIcon,
5
+ XIcon,
6
+ InfoIcon,
7
+ StarFilledIcon,
8
+ ZapFilledIcon,
9
+ } from '../../../../icon';
10
+ import { ReactNode } from 'react';
11
+ import styles from './BaseCell.module.scss';
12
+ import { MiniProgressBar } from './MiniProgressBar/MiniProgressBar';
13
+ import { TableInfoButton } from '../../../../comparisonTable';
14
+
15
+ export type ContentFontVariant = 'NORMAL' | 'BIG_WITH_UNDERLINE' | 'PRICE';
16
+
17
+ const progressLookup: Record<string, number> = {
18
+ '30%': 1,
19
+ '50%': 2,
20
+ '70%': 3,
21
+ '75%': 4,
22
+ '80%': 4,
23
+ '90%': 4,
24
+ '75%-90%': 4,
25
+ '75%-100%': 4,
26
+ '80%-100%': 4,
27
+ '100%': 5,
28
+ };
29
+
30
+ export type Alignment = 'center' | 'left' | 'right';
31
+
32
+ export type BaseCellProps = {
33
+ align?: Alignment;
34
+ checkmarkValue?: boolean;
35
+ content?: ReactNode;
36
+ modalContent?: ReactNode;
37
+ openModal?: (modalContent: ReactNode) => void;
38
+ subContent?: ReactNode;
39
+ rating?: {
40
+ value: number;
41
+ type: 'zap' | 'star';
42
+ };
43
+ contentFontVariant?: ContentFontVariant;
44
+ };
45
+
46
+ export const BaseCell = ({
47
+ align = 'center',
48
+ checkmarkValue,
49
+ content = '',
50
+ modalContent = '',
51
+ openModal,
52
+ rating,
53
+ subContent = '',
54
+ contentFontVariant = 'NORMAL',
55
+ }: BaseCellProps) => {
56
+ const alignClassName = {
57
+ center: 'ta-center jc-center ai-center',
58
+ left: 'ta-left jc-start',
59
+ right: 'ta-right jc-end ai-end',
60
+ }[align];
61
+
62
+ const validRatingValues: number[] = [1, 2, 3];
63
+ const SelectedIcon = rating?.type === 'zap' ? ZapFilledIcon : StarFilledIcon;
64
+
65
+ const progressBarValue =
66
+ typeof content === 'string' ? progressLookup[content] : undefined;
67
+
68
+ return (
69
+ <div
70
+ className={classNames('d-flex gap8 ai-center', {
71
+ 'jc-center': align === 'center',
72
+ })}
73
+ >
74
+ <div className={classNames('d-flex fd-column', alignClassName)}>
75
+ {progressBarValue !== undefined && (
76
+ <MiniProgressBar nFilledBars={progressBarValue} />
77
+ )}
78
+
79
+ {rating?.value && (
80
+ <span
81
+ data-testid="table-cell-rating"
82
+ title={`${rating?.value} out of 3`}
83
+ >
84
+ {validRatingValues.map((value) => (
85
+ <SelectedIcon
86
+ aria-hidden="true"
87
+ key={value}
88
+ color={value <= rating?.value ? 'primary-500' : 'grey-400'}
89
+ className={styles.icon}
90
+ />
91
+ ))}
92
+ </span>
93
+ )}
94
+
95
+ <div className="d-flex ai-center">
96
+ {checkmarkValue !== undefined && (
97
+ <span title={checkmarkValue ? 'Yes' : 'No'}>
98
+ {checkmarkValue ? (
99
+ <CheckIcon
100
+ data-testid="table-cell-boolean-yes"
101
+ size={24}
102
+ aria-hidden
103
+ color="primary-500"
104
+ />
105
+ ) : (
106
+ <XIcon
107
+ data-testid="table-cell-boolean-no"
108
+ size={24}
109
+ aria-hidden
110
+ color="grey-400"
111
+ />
112
+ )}
113
+ </span>
114
+ )}
115
+
116
+ {content && contentFontVariant === 'NORMAL' && (
117
+ <div className="p-p" data-testid="table-cell-content">
118
+ {content}
119
+ </div>
120
+ )}
121
+
122
+ {content && contentFontVariant === 'PRICE' && (
123
+ <div
124
+ className="p-h1 p--serif tc-primary-500"
125
+ data-testid="table-cell-content"
126
+ >
127
+ {content}
128
+ </div>
129
+ )}
130
+
131
+ {content && contentFontVariant === 'BIG_WITH_UNDERLINE' && (
132
+ <div
133
+ aria-hidden
134
+ className={classNames(
135
+ 'tc-grey-800 p-h2 p--serif',
136
+ styles.bigWithUnderline
137
+ )}
138
+ >
139
+ {content}
140
+ </div>
141
+ )}
142
+ </div>
143
+
144
+ {subContent && (
145
+ <div
146
+ className={classNames(
147
+ 'd-flex p-p--small tc-grey-500',
148
+ alignClassName
149
+ )}
150
+ >
151
+ {subContent}
152
+ </div>
153
+ )}
154
+ </div>
155
+ {modalContent && openModal && (
156
+ <TableInfoButton onClick={() => openModal(modalContent)} />
157
+ )}
158
+ </div>
159
+ );
160
+ };
@@ -0,0 +1,44 @@
1
+ @use "../../../../../../scss/public/colors" as *;
2
+
3
+ $defaultColor: $ds-purple-100;
4
+ $oneOrTwoColor: $ds-grey-500;
5
+ $threeOrFourColor: $ds-blue-300;
6
+ $allFilledColor: $ds-purple-500;
7
+
8
+ .progressBar {
9
+ margin-bottom: 4px;
10
+
11
+ rect {
12
+ fill: $defaultColor;
13
+ }
14
+ }
15
+
16
+ .filledBars1 {
17
+ rect:first-child {
18
+ fill: $oneOrTwoColor;
19
+ }
20
+ }
21
+
22
+ .filledBars2 {
23
+ rect:nth-child(-n + 2) {
24
+ fill: $oneOrTwoColor;
25
+ }
26
+ }
27
+
28
+ .filledBars3 {
29
+ rect:nth-child(-n + 3) {
30
+ fill: $threeOrFourColor;
31
+ }
32
+ }
33
+
34
+ .filledBars4 {
35
+ rect:nth-child(-n + 4) {
36
+ fill: $threeOrFourColor;
37
+ }
38
+ }
39
+
40
+ .filledBars5 {
41
+ rect {
42
+ fill: $allFilledColor;
43
+ }
44
+ }
@@ -0,0 +1,29 @@
1
+ import { MiniProgressBar } from './MiniProgressBar';
2
+
3
+ const story = {
4
+ title: 'JSX/Table/Misc',
5
+ component: MiniProgressBar,
6
+ argTypes: {
7
+ nFilledBars: {
8
+ description: 'Number of filled bars to show (0-5)',
9
+ control: {
10
+ min: 0,
11
+ max: 5,
12
+ type: 'number',
13
+ },
14
+ },
15
+ },
16
+ args: {
17
+ nFilledBars: 3,
18
+ },
19
+ };
20
+
21
+ export const MiniProgressBarStory = ({
22
+ nFilledBars,
23
+ }: React.ComponentProps<typeof MiniProgressBar>) => (
24
+ <MiniProgressBar nFilledBars={nFilledBars} />
25
+ );
26
+
27
+ MiniProgressBarStory.storyName = 'MiniProgressBar';
28
+
29
+ export default story;
@@ -0,0 +1,35 @@
1
+ import classNames from 'classnames';
2
+
3
+ import styles from './MiniProgressBar.module.scss';
4
+
5
+ export const MiniProgressBar = ({ nFilledBars }: { nFilledBars: number }) => (
6
+ <svg
7
+ className={classNames(
8
+ styles.progressBar,
9
+ styles[`filledBars${nFilledBars}`]
10
+ )}
11
+ width="40"
12
+ height="6"
13
+ viewBox="0 0 40 6"
14
+ fill="none"
15
+ xmlns="http://www.w3.org/2000/svg"
16
+ >
17
+ <g clipPath="url(#clip0_37507_20658)">
18
+ <rect id="r1" x="0.5" y="0.5" width="7" height="5" rx="1" />
19
+ <rect id="r2" x="8.5" y="0.5" width="7" height="5" rx="1" />
20
+ <rect id="r3" x="16.5" y="0.5" width="7" height="5" rx="1" />
21
+ <rect id="r4" x="24.5" y="0.5" width="7" height="5" rx="1" />
22
+ <rect id="r5" x="32.5" y="0.5" width="7" height="5" rx="1" />
23
+ </g>
24
+ <defs>
25
+ <clipPath id="clip0_37507_20658">
26
+ <rect
27
+ width="39"
28
+ height="5"
29
+ fill="white"
30
+ transform="translate(0.5 0.5)"
31
+ />
32
+ </clipPath>
33
+ </defs>
34
+ </svg>
35
+ );
@@ -0,0 +1,43 @@
1
+ @use "../../../../../scss/public/grid" as *;
2
+ @use "../../../../../scss/public/colors" as *;
3
+
4
+ .buttonCell {
5
+ color: $ds-grey-900;
6
+ border: 1px solid $ds-grey-400;
7
+
8
+ transition: all 0.3s ease-in-out;
9
+
10
+ @include p-size-mobile {
11
+ max-width: calc(100% - 96px);
12
+ }
13
+
14
+ &:disabled {
15
+ border: none;
16
+ background-color: $ds-grey-200;
17
+ color: $ds-grey-900;
18
+ opacity: 1;
19
+ cursor: default;
20
+
21
+ &:hover {
22
+ background-color: $ds-grey-200;
23
+ }
24
+ }
25
+
26
+ @include p-size-mobile {
27
+ pointer-events: none;
28
+ }
29
+ }
30
+
31
+ .withoutSubContent {
32
+ height: 64px;
33
+ }
34
+
35
+ .withSubContent {
36
+ height: 75px;
37
+ }
38
+
39
+ .selected {
40
+ transition: all 0.3 ease-in-out;
41
+ border: 2px solid $ds-purple-500;
42
+ background-color: $ds-purple-50;
43
+ }
@@ -0,0 +1,65 @@
1
+ import { ButtonCell } from './ButtonCell';
2
+
3
+ const story = {
4
+ title: 'JSX/Table/Cells',
5
+ component: ButtonCell,
6
+ argTypes: {},
7
+ args: {
8
+ isSelected: false,
9
+ content: 'Premium',
10
+ subContent: '€277/mo',
11
+ disabled: false,
12
+ },
13
+ };
14
+
15
+ export const ButtonCellStory = ({
16
+ isSelected,
17
+ content,
18
+ subContent,
19
+ disabled,
20
+ }: React.ComponentProps<typeof ButtonCell>) => (
21
+ <div className="p48 d-flex fd-column gap16 bg-white">
22
+ <ButtonCell
23
+ content={content}
24
+ subContent={subContent}
25
+ isSelected={isSelected}
26
+ disabled={disabled}
27
+ onClick={() => {}}
28
+ />
29
+
30
+ <ButtonCell
31
+ content={content}
32
+ subContent={subContent}
33
+ isSelected
34
+ disabled={disabled}
35
+ onClick={() => {}}
36
+ />
37
+
38
+ <ButtonCell
39
+ content={content}
40
+ subContent={subContent}
41
+ disabled
42
+ onClick={() => {}}
43
+ />
44
+
45
+ <ButtonCell
46
+ content={content}
47
+ isSelected={isSelected}
48
+ disabled={disabled}
49
+ onClick={() => {}}
50
+ />
51
+
52
+ <ButtonCell
53
+ content={content}
54
+ isSelected
55
+ disabled={disabled}
56
+ onClick={() => {}}
57
+ />
58
+
59
+ <ButtonCell content={content} disabled onClick={() => {}} />
60
+ </div>
61
+ );
62
+
63
+ ButtonCellStory.storyName = 'ButtonCell';
64
+
65
+ export default story;
@@ -0,0 +1,40 @@
1
+ import classNames from 'classnames';
2
+
3
+ import styles from './ButtonCell.module.scss';
4
+ import { Button } from '../../../../button';
5
+ import { ReactNode } from 'react';
6
+
7
+ export type ButtonCellProps = {
8
+ content?: ReactNode;
9
+ disabled?: boolean;
10
+ isSelected?: boolean;
11
+ onClick: () => void;
12
+ subContent?: ReactNode;
13
+ };
14
+
15
+ export const ButtonCell = ({
16
+ isSelected,
17
+ onClick,
18
+ content,
19
+ subContent,
20
+ disabled,
21
+ }: ButtonCellProps) => {
22
+ return (
23
+ <div className="w100 d-flex fd-column ai-center jc-center gap8">
24
+ <Button
25
+ className={classNames('w100 wmx5 d-flex fd-column', styles.buttonCell, {
26
+ [styles.selected]: isSelected,
27
+ [styles.withoutSubContent]: !subContent,
28
+ [styles.withSubContent]: !!subContent,
29
+ })}
30
+ variant="filledWhite"
31
+ type="submit"
32
+ onClick={onClick}
33
+ disabled={disabled}
34
+ >
35
+ {content}
36
+ {subContent && <span className="p-p tc-purple-500">{subContent}</span>}
37
+ </Button>
38
+ </div>
39
+ );
40
+ };
@@ -0,0 +1,3 @@
1
+ .narrow {
2
+ height: 40px;
3
+ }
@@ -0,0 +1,34 @@
1
+ import { CTACell } from './CTACell';
2
+
3
+ const story = {
4
+ title: 'JSX/Table/Cells',
5
+ component: CTACell,
6
+ argTypes: {},
7
+ args: {
8
+ content: 'Premium',
9
+ subContent: '€277',
10
+ grey: false,
11
+ narrow: false,
12
+ },
13
+ };
14
+
15
+ export const CTACellStory = ({
16
+ content,
17
+ subContent,
18
+ grey,
19
+ narrow,
20
+ }: React.ComponentProps<typeof CTACell>) => (
21
+ <div className="p48 d-flex fd-column gap16 bg-white">
22
+ <CTACell
23
+ content={content}
24
+ subContent={subContent}
25
+ href=""
26
+ grey={grey}
27
+ narrow={narrow}
28
+ />
29
+ </div>
30
+ );
31
+
32
+ CTACellStory.storyName = 'CTACell';
33
+
34
+ export default story;