@universal-tennis/ui-shared 0.1.4 → 0.1.6

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 (48) hide show
  1. package/dist/components.d.ts +3 -1
  2. package/dist/components.js +3 -1
  3. package/dist/components.js.map +1 -1
  4. package/dist/stories/atoms/Button/Button.d.ts +1 -0
  5. package/dist/stories/atoms/Button/Button.js.map +1 -1
  6. package/dist/stories/organisms/Modals/FullPageModal.d.ts +4 -0
  7. package/dist/stories/organisms/Modals/FullPageModal.js +37 -0
  8. package/dist/stories/organisms/Modals/FullPageModal.js.map +1 -0
  9. package/dist/stories/organisms/Modals/Modals.stories.d.ts +5 -0
  10. package/dist/stories/organisms/Modals/Modals.stories.js +73 -0
  11. package/dist/stories/organisms/Modals/Modals.stories.js.map +1 -0
  12. package/dist/stories/organisms/Modals/sharedTypes.d.ts +11 -0
  13. package/dist/stories/organisms/Modals/sharedTypes.js.map +1 -0
  14. package/dist/stories/organisms/{DrawCardTable.js → Tables/DrawCardTable.js} +1 -1
  15. package/dist/stories/organisms/Tables/DrawCardTable.js.map +1 -0
  16. package/dist/stories/organisms/{SortableTable.d.ts → Tables/SortableTable.d.ts} +1 -1
  17. package/dist/stories/organisms/{SortableTable.js → Tables/SortableTable.js} +4 -2
  18. package/dist/stories/organisms/Tables/SortableTable.js.map +1 -0
  19. package/dist/stories/organisms/Tables/Tables.stories.js +57 -0
  20. package/dist/stories/organisms/Tables/Tables.stories.js.map +1 -0
  21. package/dist/stories/organisms/Tables/mockData.d.ts +35 -0
  22. package/dist/stories/organisms/Tables/mockData.js +68 -0
  23. package/dist/stories/organisms/Tables/mockData.js.map +1 -0
  24. package/dist/stories/organisms/Tables/sharedTypes.js +2 -0
  25. package/dist/stories/organisms/Tables/sharedTypes.js.map +1 -0
  26. package/dist/types/tableDataTypes.d.ts +9 -9
  27. package/package.json +1 -1
  28. package/src/components.jsx +3 -1
  29. package/src/stories/atoms/Button/Button.tsx +1 -0
  30. package/src/stories/organisms/Modals/FullPageModal.tsx +70 -0
  31. package/src/stories/organisms/Modals/Modals.stories.tsx +137 -0
  32. package/src/stories/organisms/Modals/sharedTypes.ts +12 -0
  33. package/src/stories/organisms/{DrawCardTable.tsx → Tables/DrawCardTable.tsx} +1 -1
  34. package/src/stories/organisms/{SortableTable.tsx → Tables/SortableTable.tsx} +5 -3
  35. package/src/stories/organisms/Tables/Tables.stories.tsx +66 -0
  36. package/src/stories/organisms/Tables/mockData.tsx +93 -0
  37. package/src/types/tableDataTypes.ts +9 -9
  38. package/dist/stories/organisms/DrawCardTable.js.map +0 -1
  39. package/dist/stories/organisms/SortableTable.js.map +0 -1
  40. package/dist/stories/organisms/Tables.stories.js +0 -117
  41. package/dist/stories/organisms/Tables.stories.js.map +0 -1
  42. package/dist/stories/organisms/sharedTypes.js.map +0 -1
  43. package/src/stories/organisms/Tables.stories.tsx +0 -150
  44. /package/dist/stories/organisms/{sharedTypes.js → Modals/sharedTypes.js} +0 -0
  45. /package/dist/stories/organisms/{DrawCardTable.d.ts → Tables/DrawCardTable.d.ts} +0 -0
  46. /package/dist/stories/organisms/{Tables.stories.d.ts → Tables/Tables.stories.d.ts} +0 -0
  47. /package/dist/stories/organisms/{sharedTypes.d.ts → Tables/sharedTypes.d.ts} +0 -0
  48. /package/src/stories/organisms/{sharedTypes.ts → Tables/sharedTypes.ts} +0 -0
@@ -0,0 +1,137 @@
1
+ import React from 'react';
2
+ import InputLabel from '@mui/material/InputLabel';
3
+ import FormControl from '@mui/material/FormControl';
4
+ import Checkbox from '@mui/material/Checkbox';
5
+ import Select from '@mui/material/Select';
6
+ import MenuItem from '@mui/material/MenuItem';
7
+ import Typography from 'stories/atoms/Typography/Typography';
8
+ import Button from 'stories/atoms/Button/Button';
9
+ import Box from '@mui/material/Box';
10
+ import Grid from '@mui/material/Grid';
11
+ import Paper from '@mui/material/Paper';
12
+ import Pagination from '@mui/material/Pagination';
13
+ import FullPageModal from './FullPageModal';
14
+ import SortableTable from '../Tables/SortableTable';
15
+ import {
16
+ MOCK_HEAD_CELLS, mockRowComponent, MOCK_TABLE_DATA
17
+ } from '../Tables/mockData';
18
+
19
+ import { FullPageModalType } from './sharedTypes';
20
+
21
+ // Fake data for rendering sections
22
+ const conferences = [{ id: 1, name: 'philly' }, { id: 2, name: 'NJ' }, { id: 3, name: 'PA' }];
23
+ const sessions = [{ sessionId: 1, sessionName: 'philly' }, { sessionId: 2, sessionName: 'NJ' }, { sessionId: 3, sessionName: 'PA' }];
24
+ const selectedSessionIds = [1];
25
+ const teamsToAdd = [{ id: 1, name: 'test', sessionName: 'test' }];
26
+ const selectedTeamIds = [1];
27
+
28
+ const InputSelections = [
29
+ <FormControl sx={{ width: 300, mr: 3 }}>
30
+ <InputLabel id="conference-select">Select Conference</InputLabel>
31
+ <Select
32
+ value={1 || ''}
33
+ label="Select Conference"
34
+ labelId="conference-select"
35
+ >
36
+ {conferences?.map((option) => (
37
+ <MenuItem key={option.id} value={option.id}>
38
+ {option.name}
39
+ </MenuItem>
40
+ ))}
41
+ </Select>
42
+ </FormControl>,
43
+ <FormControl sx={{ width: 300 }}>
44
+ <InputLabel id="session-select">test</InputLabel>
45
+ <Select
46
+ value={selectedSessionIds}
47
+ label="sample"
48
+ multiple
49
+ labelId="session-select"
50
+ >
51
+ {sessions?.map((option) => (
52
+ <MenuItem key={option.sessionId} value={option.sessionId}>
53
+ <Checkbox checked={selectedSessionIds?.indexOf(option.sessionId) > -1} />
54
+ <Typography>{option.sessionName}</Typography>
55
+ </MenuItem>
56
+ ))}
57
+ <Box mt={1} boxShadow="0px -3px 3px #00000024" display="flex" justifyContent="center" pt={1} px={1}>
58
+ <Button category="primary-extended">
59
+ Apply
60
+ </Button>
61
+ </Box>
62
+ </Select>
63
+ </FormControl>
64
+ ];
65
+
66
+ const MainComponent = (
67
+ <Grid container>
68
+ <Grid item borderRight={1} lg={10}>
69
+ <Box p={6}>
70
+ <Box display="flex" alignItems="center">
71
+ {InputSelections && InputSelections.map((select) => (
72
+ select
73
+ ))}
74
+ </Box>
75
+ </Box>
76
+ <Box p={6}>
77
+ <SortableTable
78
+ headCells={MOCK_HEAD_CELLS}
79
+ sortOrder="asc"
80
+ sortByProperty="player"
81
+ title="Player Table"
82
+ tableData={MOCK_TABLE_DATA}
83
+ // @ts-ignore
84
+ rowComponent={mockRowComponent}
85
+ />
86
+ <Pagination variant="text" color="primary" page={1} count={10} />
87
+ </Box>
88
+ </Grid>
89
+
90
+ <Grid item lg={2}>
91
+ <Box p={6}>
92
+ <Typography variant="h5">{`${teamsToAdd.length} selected teams`}</Typography>
93
+ <Typography>{`This session allows a max of ${1} teams`}</Typography>
94
+ {teamsToAdd.map((team) => (
95
+ <Paper key={team.id} sx={{ my: 1 }}>
96
+ <Box p={2} display="flex">
97
+ <Checkbox
98
+ color="primary"
99
+ checked={selectedTeamIds.indexOf(team.id) !== -1}
100
+ />
101
+ <Box ml={1}>
102
+ <Typography>{team.name}</Typography>
103
+ <Typography>{team.sessionName}</Typography>
104
+ </Box>
105
+ </Box>
106
+ </Paper>
107
+ ))}
108
+ </Box>
109
+ </Grid>
110
+ </Grid>
111
+ );
112
+
113
+ // Default
114
+ export default {
115
+ title: 'Organisms/Modals',
116
+ };
117
+
118
+ // Templates
119
+ function FullPageModalTemplate(args: FullPageModalType) {
120
+ return (
121
+ <FullPageModal {...args}>
122
+ {MainComponent}
123
+ </FullPageModal>
124
+ );
125
+ }
126
+
127
+ // Stories
128
+ export const FullPage = FullPageModalTemplate.bind({});
129
+ FullPage.args = {
130
+ isOpen: true,
131
+ onClose: () => {},
132
+ pageTitle: 'Sample Page',
133
+ bottomCTAText: 'Add here!',
134
+ handleBottomCTAClick: () => {},
135
+ isBottomCTAdisabled: false,
136
+ // PagePopupModal,
137
+ };
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ export type FullPageModalType = {
4
+ isOpen: boolean;
5
+ onClose: VoidFunction;
6
+ pageTitle: string;
7
+ children?:ReactNode;
8
+ bottomCTAText?: string;
9
+ handleBottomCTAClick?: VoidFunction;
10
+ isBottomCTAdisabled?: boolean;
11
+ PagePopupModal?: ReactNode;
12
+ }
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import Box from '@mui/material/Box';
3
3
  import { styled } from '@mui/material/styles';
4
4
  import Grid from '@mui/material/Grid';
5
- import Typography from '../atoms/Typography/Typography';
5
+ import Typography from '../../atoms/Typography/Typography';
6
6
  import { DrawCardTableProps } from './sharedTypes';
7
7
 
8
8
  const StyledHeader = styled(Grid)({
@@ -11,7 +11,7 @@ import Toolbar from "@mui/material/Toolbar";
11
11
  import Paper from "@mui/material/Paper";
12
12
 
13
13
  import { TableData } from "types/tableDataTypes";
14
- import Typography from '../atoms/Typography/Typography';
14
+ import Typography from '../../atoms/Typography/Typography';
15
15
 
16
16
  type Order = 'asc' | 'desc';
17
17
  type OrderProperty = string | number;
@@ -29,7 +29,7 @@ export type SortableTableProps = {
29
29
  sortByProperty: OrderProperty;
30
30
  rowComponent: ComponentType<{rowData: TableData, labelId: string}>;
31
31
  title?: string;
32
- onOrderPropertyChange: (property: OrderProperty) => VoidFunction
32
+ onOrderPropertyChange?: (property: OrderProperty) => VoidFunction
33
33
  }
34
34
 
35
35
  function SortableTable({
@@ -45,7 +45,9 @@ function SortableTable({
45
45
 
46
46
  const handleRequestSort = (property: OrderProperty) => (event: SyntheticEvent) => {
47
47
  event.preventDefault();
48
- onOrderPropertyChange(property);
48
+ if (onOrderPropertyChange) {
49
+ onOrderPropertyChange(property);
50
+ }
49
51
  };
50
52
 
51
53
  return (
@@ -0,0 +1,66 @@
1
+ import React from 'react';
2
+ import DrawCard from '../../molecules/Cards/DrawCard';
3
+ import DrawCardTable from './DrawCardTable';
4
+ import { DrawCardTableProps } from './sharedTypes';
5
+ import {
6
+ MOCK_HEAD_CELLS, mockRowComponent, MOCK_TABLE_DATA, SAMPLE_CARD_DATA
7
+ } from './mockData';
8
+
9
+ const onOrderPropertyChange = () => {};
10
+
11
+ // Default
12
+ export default {
13
+ title: 'Organisms/Tables',
14
+ };
15
+
16
+ // Templates
17
+ function DrawCardTableTemplate(args: DrawCardTableProps) {
18
+ return <DrawCardTable {...args} />;
19
+ }
20
+
21
+ const headerRows = [
22
+ { name: 'Round 1' },
23
+ { name: 'Quarterfinal' },
24
+ { name: 'SemiFinal' },
25
+ ];
26
+
27
+ const tableRows = [
28
+ [
29
+ <DrawCard {...SAMPLE_CARD_DATA} />,
30
+ <DrawCard {...SAMPLE_CARD_DATA} />,
31
+ <DrawCard {...SAMPLE_CARD_DATA} />,
32
+ <DrawCard {...SAMPLE_CARD_DATA} />,
33
+ <DrawCard {...SAMPLE_CARD_DATA} />,
34
+ <DrawCard {...SAMPLE_CARD_DATA} />,
35
+ <DrawCard {...SAMPLE_CARD_DATA} />,
36
+ <DrawCard {...SAMPLE_CARD_DATA} />,
37
+ ],
38
+ [
39
+ <DrawCard {...SAMPLE_CARD_DATA} />,
40
+ <DrawCard {...SAMPLE_CARD_DATA} />,
41
+ <DrawCard {...SAMPLE_CARD_DATA} />,
42
+ <DrawCard {...SAMPLE_CARD_DATA} />,
43
+ ],
44
+ [
45
+ <DrawCard {...SAMPLE_CARD_DATA} />,
46
+ <DrawCard {...SAMPLE_CARD_DATA} />,
47
+ ],
48
+ ];
49
+
50
+ // Stories
51
+ export const DrawTable = DrawCardTableTemplate.bind({});
52
+ DrawTable.args = {
53
+ headerRows,
54
+ tableRows,
55
+ };
56
+
57
+ export const SortableTable = DrawCardTableTemplate.bind({});
58
+ SortableTable.args = {
59
+ headCells: MOCK_HEAD_CELLS,
60
+ sortOrder: 'asc',
61
+ sortByProperty: 'player',
62
+ title: 'Player Table',
63
+ tableData: MOCK_TABLE_DATA,
64
+ rowComponent: mockRowComponent,
65
+ onOrderPropertyChange,
66
+ };
@@ -0,0 +1,93 @@
1
+ import React from 'react';
2
+ import { TableRow, TableCell, Typography } from '@mui/material';
3
+
4
+ interface RowData {
5
+ player: string;
6
+ team: string;
7
+ session: string;
8
+ }
9
+
10
+ interface RowProps {
11
+ rowData: RowData,
12
+ labelId: string;
13
+ }
14
+
15
+ export const mockRowComponent = ({ rowData, labelId }: RowProps) => {
16
+ const { player, session, team } = rowData;
17
+ return (
18
+ <TableRow>
19
+ <TableCell
20
+ component="th"
21
+ id={labelId}
22
+ scope="row"
23
+ padding="normal"
24
+ >
25
+ <Typography>{player}</Typography>
26
+ </TableCell>
27
+ <TableCell align="left">
28
+ <Typography>{team}</Typography>
29
+ </TableCell>
30
+ <TableCell align="left">
31
+ <Typography>{session}</Typography>
32
+ </TableCell>
33
+ </TableRow>
34
+
35
+ );
36
+ };
37
+
38
+ export const MOCK_HEAD_CELLS = [
39
+ { id: 'player', label: 'Player Name', isSortingDisabled: false },
40
+ { id: 'team', label: 'Team Name', isSortingDisabled: true },
41
+ { id: 'session', label: 'Session', isSortingDisabled: false }];
42
+
43
+ export const MOCK_TABLE_DATA = [
44
+ {
45
+ id: 1,
46
+ player: 'John Smith',
47
+ team: 'Mavericks',
48
+ session: 'NorCal Adults',
49
+ },
50
+ {
51
+ id: 2,
52
+ player: 'Megan Brown',
53
+ team: 'Mini Mavericks',
54
+ session: 'SoCal Juniors',
55
+ },
56
+ {
57
+ id: 3,
58
+ player: 'George Fox',
59
+ team: 'Grey Foxes',
60
+ session: 'North Bay Junios',
61
+ },
62
+ {
63
+ id: 4,
64
+ player: 'Alison Green',
65
+ team: 'Lions',
66
+ session: 'Outer Bay UTR 2-5',
67
+ },
68
+ {
69
+ id: 5,
70
+ player: 'Linda Belinda',
71
+ team: 'Green Hornets',
72
+ session: 'Tri-State UTR 1-3',
73
+ },
74
+ ];
75
+
76
+ export const SAMPLE_CARD_DATA = {
77
+ options: [
78
+ {
79
+ id: 1,
80
+ label: 'Team 1',
81
+ },
82
+ {
83
+ id: 2,
84
+ label: 'Team 2',
85
+ }
86
+ ],
87
+ selectedOptions: {
88
+ optionOne: 1,
89
+ optionTwo: 2,
90
+ },
91
+ dateLabel: 'Dec 20 at 9:00am',
92
+ locationLabel: 'Taube Tennis Center',
93
+ };
@@ -23,15 +23,15 @@ export interface Captain {
23
23
 
24
24
  export interface AddTeamsData {
25
25
  id: number;
26
- name: string;
27
- teamMemberCount: number;
28
- captains: Array<Captain>;
29
- sessionId: number;
30
- sessionName: string;
31
- sessionStartDateUtc: string;
32
- sessionEndDateUtc: string;
33
- wins: number;
34
- losses: number;
26
+ name?: string;
27
+ teamMemberCount?: number;
28
+ captains?: Array<Captain>;
29
+ sessionId?: number;
30
+ sessionName?: string;
31
+ sessionStartDateUtc?: string;
32
+ sessionEndDateUtc?: string;
33
+ wins?: number;
34
+ losses?: number;
35
35
  rank?: number;
36
36
  isSelected?: boolean;
37
37
  record?: string;
@@ -1 +0,0 @@
1
- {"version":3,"file":"DrawCardTable.js","sourceRoot":"","sources":["../../../src/stories/organisms/DrawCardTable.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,mBAAmB,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,UAAU,MAAM,gCAAgC,CAAC;AAGxD,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAChC,UAAU,EAAE,QAAQ;IACpB,cAAc,EAAE,QAAQ;IACxB,OAAO,EAAE,MAAM;CAChB,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC/B,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,QAAQ;IACpB,OAAO,EAAE,KAAK;CACf,CAAC,CAAC;AAEH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAIjB;QAJiB,EACpC,UAAU,EACV,SAAS,OAEU,EADhB,KAAK,cAH4B,2BAIrC,CADS;IAER,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC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@
1
- import React from 'react';
2
- import { TableRow, TableCell, Typography } from '@mui/material';
3
- import DrawCard from '../molecules/Cards/DrawCard';
4
- import DrawCardTable from './DrawCardTable';
5
- const rowComponent = ({ rowData, labelId }) => {
6
- const { player, session, team } = rowData;
7
- return (React.createElement(TableRow, null,
8
- React.createElement(TableCell, { component: "th", id: labelId, scope: "row", padding: "normal" },
9
- React.createElement(Typography, null, player)),
10
- React.createElement(TableCell, { align: "left" },
11
- React.createElement(Typography, null, team)),
12
- React.createElement(TableCell, { align: "left" },
13
- React.createElement(Typography, null, session))));
14
- };
15
- const headCells = [
16
- { id: 'player', label: 'Player Name', isSortingDisabled: false },
17
- { id: 'team', label: 'Team Name', isSortingDisabled: true },
18
- { id: 'session', label: 'Session', isSortingDisabled: false }
19
- ];
20
- const tableData = [
21
- {
22
- player: 'John Smith',
23
- team: 'Mavericks',
24
- session: 'NorCal Adults',
25
- },
26
- {
27
- player: 'Megan Brown',
28
- team: 'Mini Mavericks',
29
- session: 'SoCal Juniors',
30
- },
31
- {
32
- player: 'George Fox',
33
- team: 'Grey Foxes',
34
- session: 'North Bay Junios',
35
- },
36
- {
37
- player: 'Alison Green',
38
- team: 'Lions',
39
- session: 'Outer Bay UTR 2-5',
40
- },
41
- {
42
- player: 'Linda Belinda',
43
- team: 'Green Hornets',
44
- session: 'Tri-State UTR 1-3',
45
- },
46
- ];
47
- const onOrderPropertyChange = () => { };
48
- const SAMPLE_CARD_DATA = {
49
- options: [
50
- {
51
- id: 1,
52
- label: 'Team 1',
53
- },
54
- {
55
- id: 2,
56
- label: 'Team 2',
57
- }
58
- ],
59
- selectedOptions: {
60
- optionOne: 1,
61
- optionTwo: 2,
62
- },
63
- dateLabel: 'Dec 20 at 9:00am',
64
- locationLabel: 'Taube Tennis Center',
65
- };
66
- // Default
67
- export default {
68
- title: 'Organisms/Tables',
69
- };
70
- // Templates
71
- function DrawCardTableTemplate(args) {
72
- return React.createElement(DrawCardTable, Object.assign({}, args));
73
- }
74
- const headerRows = [
75
- { name: 'Round 1' },
76
- { name: 'Quarterfinal' },
77
- { name: 'SemiFinal' },
78
- ];
79
- const tableRows = [
80
- [
81
- React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
82
- React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
83
- React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
84
- React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
85
- React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
86
- React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
87
- React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
88
- React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
89
- ],
90
- [
91
- React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
92
- React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
93
- React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
94
- React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
95
- ],
96
- [
97
- React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
98
- React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
99
- ],
100
- ];
101
- // Stories
102
- export const DrawTable = DrawCardTableTemplate.bind({});
103
- DrawTable.args = {
104
- headerRows,
105
- tableRows,
106
- };
107
- export const SortableTable = DrawCardTableTemplate.bind({});
108
- SortableTable.args = {
109
- headCells,
110
- sortOrder: 'asc',
111
- sortByProperty: 'player',
112
- title: 'Player Table',
113
- tableData,
114
- rowComponent,
115
- onOrderPropertyChange,
116
- };
117
- //# sourceMappingURL=Tables.stories.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Tables.stories.js","sourceRoot":"","sources":["../../../src/stories/organisms/Tables.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,E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B,EAAI;KACrC;IACD;QACI,oBAAC,QAAQ,oBAAK,gBAAgB,EAAI;QAClC,oBAAC,QAAQ,oBAAK,gBAAgB,EAAI;QAClC,oBAAC,QAAQ,oBAAK,gBAAgB,EAAI;QAClC,oBAAC,QAAQ,oBAAK,gBAAgB,EAAI;KACrC;IACD;QACI,oBAAC,QAAQ,oBAAK,gBAAgB,EAAI;QAClC,oBAAC,QAAQ,oBAAK,gBAAgB,EAAI;KACrC;CACF,CAAC;AAEF,UAAU;AACV,MAAM,CAAC,MAAM,SAAS,GAAG,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACxD,SAAS,CAAC,IAAI,GAAG;IACf,UAAU;IACV,SAAS;CACV,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC5D,aAAa,CAAC,IAAI,GAAG;IACnB,SAAS;IACT,SAAS,EAAE,KAAK;IAChB,cAAc,EAAE,QAAQ;IACxB,KAAK,EAAE,cAAc;IACrB,SAAS;IACT,YAAY;IACZ,qBAAqB;CACtB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"sharedTypes.js","sourceRoot":"","sources":["../../../src/stories/organisms/sharedTypes.ts"],"names":[],"mappings":""}
@@ -1,150 +0,0 @@
1
- import React from 'react';
2
- import { TableRow, TableCell, Typography } from '@mui/material';
3
- import DrawCard from '../molecules/Cards/DrawCard';
4
- import DrawCardTable from './DrawCardTable';
5
- import { DrawCardTableProps } from './sharedTypes';
6
-
7
- interface RowData {
8
- player: string;
9
- team: string;
10
- session: string;
11
- }
12
-
13
- interface RowProps {
14
- rowData: RowData,
15
- labelId: string;
16
- }
17
-
18
- const rowComponent = ({ rowData, labelId }: RowProps) => {
19
- const { player, session, team } = rowData;
20
- return (
21
- <TableRow>
22
- <TableCell
23
- component="th"
24
- id={labelId}
25
- scope="row"
26
- padding="normal"
27
- >
28
- <Typography>{player}</Typography>
29
- </TableCell>
30
- <TableCell align="left">
31
- <Typography>{team}</Typography>
32
- </TableCell>
33
- <TableCell align="left">
34
- <Typography>{session}</Typography>
35
- </TableCell>
36
- </TableRow>
37
-
38
- );
39
- };
40
-
41
- const headCells = [
42
- { id: 'player', label: 'Player Name', isSortingDisabled: false },
43
- { id: 'team', label: 'Team Name', isSortingDisabled: true },
44
- { id: 'session', label: 'Session', isSortingDisabled: false }];
45
-
46
- const tableData = [
47
- {
48
- player: 'John Smith',
49
- team: 'Mavericks',
50
- session: 'NorCal Adults',
51
- },
52
- {
53
- player: 'Megan Brown',
54
- team: 'Mini Mavericks',
55
- session: 'SoCal Juniors',
56
- },
57
- {
58
- player: 'George Fox',
59
- team: 'Grey Foxes',
60
- session: 'North Bay Junios',
61
- },
62
- {
63
- player: 'Alison Green',
64
- team: 'Lions',
65
- session: 'Outer Bay UTR 2-5',
66
- },
67
- {
68
- player: 'Linda Belinda',
69
- team: 'Green Hornets',
70
- session: 'Tri-State UTR 1-3',
71
- },
72
- ];
73
-
74
- const onOrderPropertyChange = () => {};
75
-
76
- const SAMPLE_CARD_DATA = {
77
- options: [
78
- {
79
- id: 1,
80
- label: 'Team 1',
81
- },
82
- {
83
- id: 2,
84
- label: 'Team 2',
85
- }
86
- ],
87
- selectedOptions: {
88
- optionOne: 1,
89
- optionTwo: 2,
90
- },
91
- dateLabel: 'Dec 20 at 9:00am',
92
- locationLabel: 'Taube Tennis Center',
93
- };
94
-
95
- // Default
96
- export default {
97
- title: 'Organisms/Tables',
98
- };
99
-
100
- // Templates
101
- function DrawCardTableTemplate(args: DrawCardTableProps) {
102
- return <DrawCardTable {...args} />;
103
- }
104
-
105
- const headerRows = [
106
- { name: 'Round 1' },
107
- { name: 'Quarterfinal' },
108
- { name: 'SemiFinal' },
109
- ];
110
-
111
- const tableRows = [
112
- [
113
- <DrawCard {...SAMPLE_CARD_DATA} />,
114
- <DrawCard {...SAMPLE_CARD_DATA} />,
115
- <DrawCard {...SAMPLE_CARD_DATA} />,
116
- <DrawCard {...SAMPLE_CARD_DATA} />,
117
- <DrawCard {...SAMPLE_CARD_DATA} />,
118
- <DrawCard {...SAMPLE_CARD_DATA} />,
119
- <DrawCard {...SAMPLE_CARD_DATA} />,
120
- <DrawCard {...SAMPLE_CARD_DATA} />,
121
- ],
122
- [
123
- <DrawCard {...SAMPLE_CARD_DATA} />,
124
- <DrawCard {...SAMPLE_CARD_DATA} />,
125
- <DrawCard {...SAMPLE_CARD_DATA} />,
126
- <DrawCard {...SAMPLE_CARD_DATA} />,
127
- ],
128
- [
129
- <DrawCard {...SAMPLE_CARD_DATA} />,
130
- <DrawCard {...SAMPLE_CARD_DATA} />,
131
- ],
132
- ];
133
-
134
- // Stories
135
- export const DrawTable = DrawCardTableTemplate.bind({});
136
- DrawTable.args = {
137
- headerRows,
138
- tableRows,
139
- };
140
-
141
- export const SortableTable = DrawCardTableTemplate.bind({});
142
- SortableTable.args = {
143
- headCells,
144
- sortOrder: 'asc',
145
- sortByProperty: 'player',
146
- title: 'Player Table',
147
- tableData,
148
- rowComponent,
149
- onOrderPropertyChange,
150
- };