@universal-tennis/ui-shared 0.1.2 → 0.1.4

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 (43) hide show
  1. package/.eslintignore +1 -1
  2. package/.eslintrc.js +10 -3
  3. package/dist/components.d.ts +1 -0
  4. package/dist/components.js +1 -0
  5. package/dist/components.js.map +1 -1
  6. package/dist/stories/atoms/Button/Button.js.map +1 -1
  7. package/dist/stories/atoms/Typography/Typography.d.ts +44 -5
  8. package/dist/stories/atoms/Typography/Typography.js +54 -10
  9. package/dist/stories/atoms/Typography/Typography.js.map +1 -1
  10. package/dist/stories/molecules/Cards/Cards.stories.js +4 -4
  11. package/dist/stories/molecules/Cards/Cards.stories.js.map +1 -1
  12. package/dist/stories/molecules/Cards/ContactCard.js.map +1 -1
  13. package/dist/stories/molecules/Cards/DrawCard.d.ts +1 -1
  14. package/dist/stories/molecules/Cards/DrawCard.js +15 -15
  15. package/dist/stories/molecules/Cards/DrawCard.js.map +1 -1
  16. package/dist/stories/molecules/Cards/TeamCard.js.map +1 -1
  17. package/dist/stories/molecules/Cards/sharedTypes.d.ts +11 -7
  18. package/dist/stories/organisms/DrawCardTable.js +1 -1
  19. package/dist/stories/organisms/DrawCardTable.js.map +1 -1
  20. package/dist/stories/organisms/SortableTable.d.ts +23 -0
  21. package/dist/stories/organisms/SortableTable.js +32 -0
  22. package/dist/stories/organisms/SortableTable.js.map +1 -0
  23. package/dist/stories/organisms/Tables.stories.d.ts +1 -0
  24. package/dist/stories/organisms/Tables.stories.js +58 -4
  25. package/dist/stories/organisms/Tables.stories.js.map +1 -1
  26. package/dist/types/tableDataTypes.d.ts +38 -0
  27. package/dist/types/tableDataTypes.js +2 -0
  28. package/dist/types/tableDataTypes.js.map +1 -0
  29. package/package.json +1 -1
  30. package/src/components.jsx +1 -0
  31. package/src/stories/atoms/Button/Button.tsx +19 -19
  32. package/src/stories/atoms/Typography/Typography.tsx +86 -49
  33. package/src/stories/molecules/Cards/Cards.stories.tsx +8 -8
  34. package/src/stories/molecules/Cards/ContactCard.tsx +23 -25
  35. package/src/stories/molecules/Cards/DrawCard.tsx +50 -51
  36. package/src/stories/molecules/Cards/TeamCard.tsx +4 -6
  37. package/src/stories/molecules/Cards/sharedTypes.ts +12 -7
  38. package/src/stories/organisms/DrawCardTable.tsx +20 -21
  39. package/src/stories/organisms/SortableTable.tsx +110 -0
  40. package/src/stories/organisms/Tables.stories.tsx +91 -10
  41. package/src/types/tableDataTypes.ts +42 -0
  42. package/tsconfig.json +19 -21
  43. package/workflows/package-release-1.yml +3 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@universal-tennis/ui-shared",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "main": "dist/items.js",
5
5
  "license": "MIT",
6
6
  "homepage": "https://universaltennis.com",
@@ -9,3 +9,4 @@ export { default as ContactCard } from './stories/molecules/Cards/ContactCard';
9
9
  export { default as TeamCard } from './stories/molecules/Cards/TeamCard';
10
10
 
11
11
  // ORGANISMS
12
+ export { default as SortableTable } from './stories/organisms/SortableTable';
@@ -1,4 +1,4 @@
1
- import React, {ReactElement} from 'react';
1
+ import React, { ReactElement } from 'react';
2
2
  import MuiButton from '@mui/material/Button';
3
3
  import { styled } from '@mui/material/styles';
4
4
 
@@ -76,44 +76,44 @@ export default function Button({ children, category, ...props }: ButtonProps) {
76
76
  switch (category) {
77
77
  case 'primary':
78
78
  return (
79
- <PrimaryButton
80
- {...props}
81
- >
82
- {children}
83
- </PrimaryButton>
79
+ <PrimaryButton
80
+ {...props}
81
+ >
82
+ {children}
83
+ </PrimaryButton>
84
84
  );
85
85
  case 'primary-expanded':
86
86
  return (
87
87
  <PrimaryButton
88
- isExpanded
89
- {...props}
88
+ isExpanded
89
+ {...props}
90
90
  >
91
- {children}
91
+ {children}
92
92
  </PrimaryButton>
93
93
  );
94
94
  case 'secondary':
95
95
  return (
96
- <SecondaryButton
97
- {...props}
98
- >
99
- {children}
100
- </SecondaryButton>
96
+ <SecondaryButton
97
+ {...props}
98
+ >
99
+ {children}
100
+ </SecondaryButton>
101
101
  );
102
102
  case 'link':
103
103
  return (
104
104
  <LinkButton
105
- disableTouchRipple
106
- {...props}
105
+ disableTouchRipple
106
+ {...props}
107
107
  >
108
- {children}
108
+ {children}
109
109
  </LinkButton>
110
110
  );
111
111
  default:
112
112
  return (
113
113
  <StyledButton
114
- {...props}
114
+ {...props}
115
115
  >
116
- {children}
116
+ {children}
117
117
  </StyledButton>
118
118
  );
119
119
  }
@@ -1,16 +1,10 @@
1
- import React, {ReactElement} from 'react';
2
- import MuiTypography from '@mui/material/Typography';
1
+ import React from 'react';
2
+ import MuiTypography, { TypographyProps as MuiTypographyProps } from '@mui/material/Typography';
3
3
  import { styled } from '@mui/material/styles';
4
4
  import "../../assets/css/typography.css";
5
5
 
6
- type TypographyProps = {
7
- children: string | ReactElement;
6
+ interface TypographyProps extends MuiTypographyProps {
8
7
  category?: string;
9
- size?: string;
10
- style?: React.CSSProperties;
11
- }
12
-
13
- type MuiTypographyProps = {
14
8
  size?: string;
15
9
  isCap?: boolean;
16
10
  weight?: number;
@@ -52,23 +46,29 @@ const SECONDARY_SIZES = {
52
46
  "xx-small-book": '10px',
53
47
  };
54
48
 
55
- const DisplayTypography = styled(MuiTypography)((props: MuiTypographyProps) => ({
49
+ const DisplayTypography: React.FC<TypographyProps> = styled(MuiTypography, {
50
+ shouldForwardProp: (prop: string) => prop !== 'isCap'
51
+ })(({ size, weight }: TypographyProps) => ({
56
52
  fontFamily: 'var(--display-font)',
57
- fontSize: DISPLAY_SIZES[props.size as keyof typeof DISPLAY_SIZES],
58
- fontWeight: props.weight
53
+ fontSize: DISPLAY_SIZES[size as keyof typeof DISPLAY_SIZES],
54
+ fontWeight: weight
59
55
  }));
60
56
 
61
- const PrimaryTypography = styled(MuiTypography)((props: MuiTypographyProps) => ({
57
+ const PrimaryTypography: React.FC<TypographyProps> = styled(MuiTypography, {
58
+ shouldForwardProp: (prop: string) => prop !== 'isCap'
59
+ })(({ size, weight }: TypographyProps) => ({
62
60
  fontFamily: 'var(--primary-font)',
63
- fontSize: PRIMARY_SIZES[props.size as keyof typeof PRIMARY_SIZES],
64
- fontWeight: props.weight
61
+ fontSize: PRIMARY_SIZES[size as keyof typeof PRIMARY_SIZES],
62
+ fontWeight: weight
65
63
  }));
66
64
 
67
- const SecondaryTypography = styled(MuiTypography)((props: MuiTypographyProps) => ({
65
+ const SecondaryTypography: React.FC<TypographyProps> = styled(MuiTypography, {
66
+ shouldForwardProp: (prop: string) => prop !== 'isCap'
67
+ })(({ isCap, weight, size }: TypographyProps) => ({
68
68
  fontFamily: 'var(--secondary-font)',
69
- fontSize: SECONDARY_SIZES[props.size as keyof typeof SECONDARY_SIZES],
70
- textTransform: props.isCap ? 'uppercase' : 'inherit',
71
- fontWeight: props.weight
69
+ fontSize: SECONDARY_SIZES[size as keyof typeof SECONDARY_SIZES],
70
+ textTransform: isCap ? 'uppercase' : 'inherit',
71
+ fontWeight: weight
72
72
  }));
73
73
 
74
74
  export default function Typography({
@@ -84,65 +84,102 @@ export default function Typography({
84
84
  case size?.includes("book"):
85
85
  weight = 400;
86
86
  break;
87
-
88
87
  case size?.includes("medium"):
89
88
  weight = 500;
90
89
  break;
91
-
92
90
  case size?.includes("semibold"):
93
91
  weight = 600;
94
92
  break;
95
-
96
93
  case size?.includes("bold"):
97
94
  weight = 700;
98
-
99
95
  break;
100
96
  default:
101
97
  weight = 500;
102
-
103
98
  break;
104
99
  }
105
100
 
106
101
  switch (category) {
107
102
  case 'primary':
108
103
  return (
109
- <PrimaryTypography
110
- size={size}
111
- {...props}
112
- >
113
- {children}
114
- </PrimaryTypography>
104
+ <PrimaryTypography
105
+ size={size}
106
+ {...props}
107
+ >
108
+ {children}
109
+ </PrimaryTypography>
115
110
  );
116
111
  case 'secondary':
117
112
  return (
118
- <SecondaryTypography
119
- size={size}
120
- isCap={isCap}
121
- weight={weight}
122
- {...props}
123
- >
124
- {children}
125
- </SecondaryTypography>
113
+ <SecondaryTypography
114
+ size={size}
115
+ isCap={isCap}
116
+ weight={weight}
117
+ {...props}
118
+ >
119
+ {children}
120
+ </SecondaryTypography>
126
121
  );
127
122
  case 'display':
128
123
  return (
129
- <DisplayTypography
130
- size={size}
131
- weight={weight}
132
- {...props}
133
- >
134
- {children}
135
- </DisplayTypography>
124
+ <DisplayTypography
125
+ size={size}
126
+ weight={weight}
127
+ {...props}
128
+ >
129
+ {children}
130
+ </DisplayTypography>
136
131
  );
137
132
  default:
138
133
  return (
139
134
  <PrimaryTypography
140
- size={size}
141
- weight={weight}
142
- {...props}
135
+ size={size}
136
+ weight={weight}
137
+ {...props}
143
138
  >
144
- {children}
139
+ {children}
145
140
  </PrimaryTypography>
146
141
  );
147
142
  }
148
143
  }
144
+
145
+ export const DISPLAY_SIZES_ENUM = {
146
+ XXXLarge: "XXX-large",
147
+ XXLarge: "XX-large",
148
+ XLarge: "X-large",
149
+ Large: 'large',
150
+ LargeLight: "large-light",
151
+ MediumBook: "medium-book",
152
+ };
153
+
154
+ export const PRIMARY_SIZES_ENUM = {
155
+ LargeBold: "large-bold",
156
+ LargeBook: "large-book",
157
+ LargeLight: "large-light",
158
+ MediumSemibold: "medium-semibold",
159
+ MediumMedium: "medium-medium",
160
+ MediumBook: "medium-book",
161
+ SmallBook: "small-book",
162
+ XSmallBook: "x-small-book",
163
+ };
164
+
165
+ export const SECONDARY_SIZES_ENUM = {
166
+ LargeMedium: "large-medium",
167
+ LargeBook: "large-book",
168
+ MediumMedium: "medium-medium",
169
+ MediumBook: "medium-book",
170
+ SmallMediumCap: "small-medium-cap",
171
+ SmallMedium: "small-medium",
172
+ SmallBook: "small-book",
173
+ XSmallMediumCap: "x-small-medium-cap",
174
+ XSmallMedium: "x-small-medium",
175
+ XSmallBookCap: "x-small-book-cap",
176
+ XSmallBook: "x-small-book",
177
+ XXSmallMediumCap: "xx-small-medium-cap",
178
+ XXSmallBook: "xx-small-book",
179
+ };
180
+
181
+ export const CATEGORY_ENUM = {
182
+ PRIMARY: 'primary',
183
+ SECONDARY: 'secondary',
184
+ DISPLAY: 'display'
185
+ };
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import ContactCard from './ContactCard';
4
4
  import TeamCard from './TeamCard';
5
5
  import DrawCard from './DrawCard';
6
- import {DrawCardProps, TeamCardProps, ContactCardProps} from "./sharedTypes";
6
+ import { DrawCardProps, TeamCardProps, ContactCardProps } from "./sharedTypes";
7
7
 
8
8
  // Default
9
9
  export default {
@@ -21,9 +21,9 @@ function TeamCardTemplate(args: TeamCardProps) {
21
21
 
22
22
  function DrawCardTemplate(args: DrawCardProps) {
23
23
  return (
24
- <div style={{width: '372px'}}>
25
- <DrawCard {...args} />
26
- </div>
24
+ <div style={{ width: '372px' }}>
25
+ <DrawCard {...args} />
26
+ </div>
27
27
  );
28
28
  }
29
29
 
@@ -43,7 +43,7 @@ Team.args = {
43
43
 
44
44
  export const Draw = DrawCardTemplate.bind({});
45
45
  Draw.args = {
46
- choices: [
46
+ options: [
47
47
  {
48
48
  id: 1,
49
49
  label: 'Team 1',
@@ -53,9 +53,9 @@ Draw.args = {
53
53
  label: 'Team 2',
54
54
  }
55
55
  ],
56
- selectedTeams: {
57
- teamOne: 1,
58
- teamTwo: 2,
56
+ selectedOptions: {
57
+ optionOne: 1,
58
+ optionTwo: 2,
59
59
  },
60
60
  dateLabel: 'Dec 20 at 9:00am',
61
61
  locationLabel: 'Taube Tennis Center',
@@ -8,7 +8,7 @@ import Typography from '../../atoms/Typography/Typography';
8
8
  import ChatIcon from '../../assets/icon-chat-blue.svg';
9
9
 
10
10
  import { StyledCard } from './shared';
11
- import {ContactCardProps} from './sharedTypes';
11
+ import { ContactCardProps } from './sharedTypes';
12
12
 
13
13
  export default function ContactCard({
14
14
  name, phone, email, onMessageClick, ...props
@@ -18,30 +18,28 @@ export default function ContactCard({
18
18
  const phoneNumber = parsedNumber?.formatInternational();
19
19
 
20
20
  return (
21
- <StyledCard
22
- {...props}
23
- >
24
- <Typography style={{marginBottom: '8px'}} category="secondary" size="medium-medium">{name}</Typography>
25
- {phoneNumber && (
26
- <Link sx={{display: 'flex'}} mt={1} fontSize={14} href={`tel:${phone}`}>
27
- <LocalPhoneOutlinedIcon fontSize="small" sx={{ mr: 1 }} />
28
- <Typography category="secondary" size="x-small-book">{phoneNumber}</Typography>
29
- </Link>
30
- )}
31
- {email && (
32
- <Link sx={{display: 'flex'}} mt={1} fontSize={14} href={`mailto:${email}`}>
33
- <EmailOutlinedIcon fontSize="small" sx={{ mr: 1 }} />
34
- <Typography category="secondary" size="x-small-book">{email}</Typography>
35
- </Link>
36
- )}
37
- <Button onClick={onMessageClick} category="link" style={{marginTop: '8px'}}>
38
- <>
39
- <img src={ChatIcon} alt="message" style={{width: '20px'}} />
40
- <Typography style={{paddingLeft: '8px'}} category="secondary" size="x-small-book">
41
- {`Message ${firstName}`}
42
- </Typography>
43
- </>
44
- </Button>
21
+ <StyledCard {...props}>
22
+ <Typography style={{ marginBottom: '8px' }} category="secondary" size="medium-medium">{name}</Typography>
23
+ {phoneNumber && (
24
+ <Link sx={{ display: 'flex' }} mt={1} fontSize={14} href={`tel:${phone}`}>
25
+ <LocalPhoneOutlinedIcon fontSize="small" sx={{ mr: 1 }} />
26
+ <Typography category="secondary" size="x-small-book">{phoneNumber}</Typography>
27
+ </Link>
28
+ )}
29
+ {email && (
30
+ <Link sx={{ display: 'flex' }} mt={1} fontSize={14} href={`mailto:${email}`}>
31
+ <EmailOutlinedIcon fontSize="small" sx={{ mr: 1 }} />
32
+ <Typography category="secondary" size="x-small-book">{email}</Typography>
33
+ </Link>
34
+ )}
35
+ <Button onClick={onMessageClick} category="link" style={{ marginTop: '8px' }}>
36
+ <>
37
+ <img src={ChatIcon} alt="message" style={{ width: '20px' }} />
38
+ <Typography style={{ paddingLeft: '8px' }} category="secondary" size="x-small-book">
39
+ {`Message ${firstName}`}
40
+ </Typography>
41
+ </>
42
+ </Button>
45
43
  </StyledCard>
46
44
  );
47
45
  }
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  import Box from '@mui/material/Box';
3
3
  import { styled } from '@mui/material/styles';
4
- import MuiSelect from '@mui/material/Select';
4
+ import MuiSelect, { SelectChangeEvent } from '@mui/material/Select';
5
5
  import MenuItem from '@mui/material/MenuItem';
6
6
  import Button from '../../atoms/Button/Button';
7
- import Typography from '../../atoms/Typography/Typography';
8
- import {DrawCardProps} from "./sharedTypes";
7
+ import Typography, { SECONDARY_SIZES_ENUM, CATEGORY_ENUM } from '../../atoms/Typography/Typography';
8
+ import { DrawCardProps } from "./sharedTypes";
9
9
 
10
10
  const StyledCard = styled(Box)({
11
11
  display: 'flex',
@@ -29,74 +29,73 @@ const BottomGrid = styled(Box)({
29
29
  alignItems: 'center',
30
30
  justifyContent: 'space-between',
31
31
  paddingTop: '32px',
32
-
33
32
  });
34
33
 
34
+ const Positions = {
35
+ ONE: '1',
36
+ TWO: '2',
37
+ };
38
+
35
39
  export default function DrawCard({
36
- choices, onChange, onEditClick, selectedTeams, dateLabel, locationLabel, ...props
40
+ options, onChange, onEditClick, selectedOptions, dateLabel, locationLabel, ...props
37
41
  }: DrawCardProps) {
38
- const {teamOne, teamTwo} = selectedTeams || null;
42
+ const { optionOne, optionTwo } = selectedOptions || null;
39
43
 
40
- const handleOnTeamOneChange = () => {
44
+ const handleOnSelectionChange = (event: SelectChangeEvent<unknown>, position: string) => {
45
+ const id = event.target.value as string;
46
+
41
47
  if (onChange) {
42
- onChange(0);
43
- }
44
- };
45
-
46
- const handleOnTeamTwoChange = () => {
47
- if (onChange) {
48
- onChange(1);
48
+ onChange({ position, id });
49
49
  }
50
50
  };
51
51
 
52
52
  return (
53
53
  <StyledCard
54
- {...props}
54
+ {...props}
55
55
  >
56
56
  <StyledMuiSelect
57
- labelId="draw-card-select-label-top"
58
- id="draw-card-select-top"
59
- value={teamOne}
60
- label="teamOne"
61
- onChange={handleOnTeamOneChange}
57
+ labelId="draw-card-select-label-top"
58
+ id="draw-card-select-top"
59
+ value={optionOne}
60
+ label="teamOne"
61
+ onChange={(e) => handleOnSelectionChange(e, Positions.ONE)}
62
62
  >
63
- {choices.map((choice) => <MenuItem value={choice.id}>{choice.label}</MenuItem>)}
63
+ {options.map((option) => <MenuItem key={option.id} value={option.id}>{option.label}</MenuItem>)}
64
64
  </StyledMuiSelect>
65
65
 
66
- <Box pt={1} />
67
-
66
+ <Box pt={1} />
68
67
  <StyledMuiSelect
69
- labelId="draw-card-select-label-bot"
70
- id="draw-card-select-bot"
71
- value={teamTwo}
72
- label="teamTwo"
73
- onChange={handleOnTeamTwoChange}
68
+ labelId="draw-card-select-label-bot"
69
+ id="draw-card-select-bot"
70
+ value={optionTwo}
71
+ label="teamTwo"
72
+ onChange={(e) => handleOnSelectionChange(e, Positions.TWO)}
74
73
  >
75
- {choices.map((choice) => <MenuItem value={choice.id}>{choice.label}</MenuItem>)}
74
+ {options.map((option) => <MenuItem key={option.id} value={option.id}>{option.label}</MenuItem>)}
76
75
  </StyledMuiSelect>
77
- <BottomGrid>
76
+ <BottomGrid>
78
77
 
79
- <Box>
80
- <Typography category="secondary" size="small-book">
81
- {dateLabel}
82
- </Typography>
83
- <Typography category="secondary" size="small-book">
84
- {locationLabel}
85
- </Typography>
86
- </Box>
87
- <Button
88
- style={{
89
- display: 'flex',
90
- justifyContent: 'end'
91
- }}
92
- onClick={onEditClick}
93
- category="link"
94
- >
95
- <Typography category="secondary" size="x-small-medium-cap">
96
- Edit
97
- </Typography>
98
- </Button>
99
- </BottomGrid>
78
+ <Box>
79
+ <Typography category={CATEGORY_ENUM.SECONDARY} size={SECONDARY_SIZES_ENUM.SmallBook}>
80
+ {dateLabel}
81
+ </Typography>
82
+ <Typography category={CATEGORY_ENUM.SECONDARY} size={SECONDARY_SIZES_ENUM.SmallBook}>
83
+ {locationLabel}
84
+ </Typography>
85
+ </Box>
86
+ <Button
87
+ style={{
88
+ display: 'flex',
89
+ justifyContent: 'end'
90
+ }}
91
+ onClick={onEditClick}
92
+ category="link"
93
+ >
94
+ <Typography category={CATEGORY_ENUM.SECONDARY} size={SECONDARY_SIZES_ENUM.XSmallMediumCap}>
95
+ Edit
96
+ </Typography>
97
+ </Button>
98
+ </BottomGrid>
100
99
  </StyledCard>
101
100
  );
102
101
  }
@@ -2,15 +2,13 @@ import React from 'react';
2
2
 
3
3
  import Typography from '../../atoms/Typography/Typography';
4
4
  import { StyledCard } from './shared';
5
- import {TeamCardProps} from './sharedTypes';
5
+ import { TeamCardProps } from './sharedTypes';
6
6
 
7
7
  export default function TeamCard({ title, description, ...props }: TeamCardProps) {
8
8
  return (
9
- <StyledCard
10
- {...props}
11
- >
12
- <Typography category="secondary" size="medium-medium">{title}</Typography>
13
- <Typography category="secondary" size="x-small-book">{description}</Typography>
9
+ <StyledCard {...props}>
10
+ <Typography category="secondary" size="medium-medium">{title}</Typography>
11
+ <Typography category="secondary" size="x-small-book">{description}</Typography>
14
12
  </StyledCard>
15
13
  );
16
14
  }
@@ -1,22 +1,27 @@
1
1
  // Card types
2
2
 
3
- type SelectedTeams = {
4
- teamOne: number;
5
- teamTwo: number;
3
+ type SelectedOptions = {
4
+ optionOne: number;
5
+ optionTwo: number;
6
6
  }
7
7
 
8
- type Choices = {
8
+ type Options = {
9
9
  id: number;
10
10
  label: string;
11
11
  }[];
12
12
 
13
+ type OnChangeArgs = {
14
+ position: string;
15
+ id: string;
16
+ }
17
+
13
18
  export type DrawCardProps = {
14
- choices: Choices;
15
- selectedTeams: SelectedTeams;
19
+ options: Options;
20
+ selectedOptions: SelectedOptions;
16
21
  dateLabel: string;
17
22
  locationLabel: string;
18
23
  onEditClick?: VoidFunction;
19
- onChange?: (arg0: number) => null;
24
+ onChange?: ({ position, id }: OnChangeArgs) => null;
20
25
  }
21
26
 
22
27
  export interface TeamCardProps {
@@ -1,10 +1,9 @@
1
1
  import React from 'react';
2
2
  import Box from '@mui/material/Box';
3
3
  import { styled } from '@mui/material/styles';
4
- import Paper from '@mui/material/Paper';
5
4
  import Grid from '@mui/material/Grid';
6
5
  import Typography from '../atoms/Typography/Typography';
7
- import {DrawCardTableProps} from './sharedTypes';
6
+ import { DrawCardTableProps } from './sharedTypes';
8
7
 
9
8
  const StyledHeader = styled(Grid)({
10
9
  alignItems: 'center',
@@ -30,28 +29,28 @@ export default function DrawCardTable({
30
29
  const sectionAmount = tableRows[index].length;
31
30
 
32
31
  return (
33
- <Grid xs={totalColumns}>
34
- {[...Array(sectionAmount)].map((section, idx) => (
35
- <GridSections sx={{height: rowSectionsWidth}}>
36
- {row[idx]}
37
- </GridSections>
38
- ))}
39
- </Grid>
32
+ <Grid key={index} xs={totalColumns}>
33
+ {[...Array(sectionAmount)].map((section, idx) => (
34
+ <GridSections key={idx} sx={{ height: rowSectionsWidth }}>
35
+ {row[idx]}
36
+ </GridSections>
37
+ ))}
38
+ </Grid>
40
39
  );
41
40
  });
42
41
 
43
42
  return (
44
- <Box {...props} sx={{ flexGrow: 1 }} aria-label="draw table">
45
- <Grid container sx={{height: '60px'}}>
46
- {headerRows.map((row) => (
47
- <StyledHeader key={row.name} xs={totalColumns}>
48
- <Typography category="secondary" size="small-medium-cap">{row.name}</Typography>
49
- </StyledHeader>
50
- ))}
51
- </Grid>
52
- <Grid container>
53
- {formatTableRows}
54
- </Grid>
55
- </Box>
43
+ <Box {...props} sx={{ flexGrow: 1 }} aria-label="draw table">
44
+ <Grid container sx={{ height: '60px' }}>
45
+ {headerRows.map((row) => (
46
+ <StyledHeader key={row.name} xs={totalColumns}>
47
+ <Typography category="secondary" size="small-medium-cap">{row.name}</Typography>
48
+ </StyledHeader>
49
+ ))}
50
+ </Grid>
51
+ <Grid container>
52
+ {formatTableRows}
53
+ </Grid>
54
+ </Box>
56
55
  );
57
56
  }