@universal-tennis/ui-shared 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/preview.js +1 -0
- package/.storybook/variables.css +12 -0
- package/dist/components.d.ts +3 -0
- package/dist/components.js +3 -1
- package/dist/components.js.map +1 -1
- package/dist/stories/assets/css/variables.css +2 -0
- package/dist/stories/atoms/Button/Button.d.ts +1 -0
- package/dist/stories/atoms/Button/Button.js.map +1 -1
- package/dist/stories/atoms/Typography/Typography.d.ts +38 -0
- package/dist/stories/atoms/Typography/Typography.js +38 -0
- package/dist/stories/atoms/Typography/Typography.js.map +1 -1
- package/dist/stories/molecules/Cards/Cards.stories.d.ts +1 -0
- package/dist/stories/molecules/Cards/Cards.stories.js +24 -0
- package/dist/stories/molecules/Cards/Cards.stories.js.map +1 -1
- package/dist/stories/molecules/Cards/ContactCard.d.ts +1 -7
- package/dist/stories/molecules/Cards/ContactCard.js.map +1 -1
- package/dist/stories/molecules/Cards/DrawCard.d.ts +3 -0
- package/dist/stories/molecules/Cards/DrawCard.js +66 -0
- package/dist/stories/molecules/Cards/DrawCard.js.map +1 -0
- package/dist/stories/molecules/Cards/TeamCard.d.ts +1 -5
- package/dist/stories/molecules/Cards/TeamCard.js.map +1 -1
- package/dist/stories/molecules/Cards/sharedTypes.d.ts +31 -0
- package/dist/stories/molecules/Cards/sharedTypes.js +3 -0
- package/dist/stories/molecules/Cards/sharedTypes.js.map +1 -0
- package/dist/stories/organisms/Modals/FullPageModal.d.ts +4 -0
- package/dist/stories/organisms/Modals/FullPageModal.js +37 -0
- package/dist/stories/organisms/Modals/FullPageModal.js.map +1 -0
- package/dist/stories/{oraganisms/SortableTable.stories.d.ts → organisms/Modals/Modals.stories.d.ts} +1 -1
- package/dist/stories/organisms/Modals/Modals.stories.js +73 -0
- package/dist/stories/organisms/Modals/Modals.stories.js.map +1 -0
- package/dist/stories/organisms/Modals/sharedTypes.d.ts +11 -0
- package/dist/stories/organisms/Modals/sharedTypes.js +2 -0
- package/dist/stories/organisms/Modals/sharedTypes.js.map +1 -0
- package/dist/stories/organisms/Tables/DrawCardTable.d.ts +3 -0
- package/dist/stories/organisms/Tables/DrawCardTable.js +40 -0
- package/dist/stories/organisms/Tables/DrawCardTable.js.map +1 -0
- package/dist/stories/{oraganisms → organisms/Tables}/SortableTable.d.ts +1 -1
- package/dist/stories/{oraganisms → organisms/Tables}/SortableTable.js +4 -2
- package/dist/stories/organisms/Tables/SortableTable.js.map +1 -0
- package/dist/stories/organisms/Tables/Tables.stories.d.ts +6 -0
- package/dist/stories/organisms/Tables/Tables.stories.js +57 -0
- package/dist/stories/organisms/Tables/Tables.stories.js.map +1 -0
- package/dist/stories/organisms/Tables/mockData.d.ts +35 -0
- package/dist/stories/{oraganisms/SortableTable.stories.js → organisms/Tables/mockData.js} +26 -25
- package/dist/stories/organisms/Tables/mockData.js.map +1 -0
- package/dist/stories/organisms/Tables/sharedTypes.d.ts +7 -0
- package/dist/stories/organisms/Tables/sharedTypes.js +2 -0
- package/dist/stories/organisms/Tables/sharedTypes.js.map +1 -0
- package/dist/types/tableDataTypes.d.ts +9 -9
- package/package.json +1 -1
- package/src/components.jsx +3 -1
- package/src/stories/assets/css/variables.css +2 -0
- package/src/stories/atoms/Button/Button.tsx +1 -0
- package/src/stories/atoms/Typography/Typography.tsx +42 -0
- package/src/stories/molecules/Cards/Cards.stories.tsx +30 -13
- package/src/stories/molecules/Cards/ContactCard.tsx +1 -7
- package/src/stories/molecules/Cards/DrawCard.tsx +101 -0
- package/src/stories/molecules/Cards/TeamCard.tsx +1 -5
- package/src/stories/molecules/Cards/sharedTypes.ts +37 -0
- package/src/stories/organisms/Modals/FullPageModal.tsx +70 -0
- package/src/stories/organisms/Modals/Modals.stories.tsx +137 -0
- package/src/stories/organisms/Modals/sharedTypes.ts +12 -0
- package/src/stories/organisms/Tables/DrawCardTable.tsx +56 -0
- package/src/stories/{oraganisms → organisms/Tables}/SortableTable.tsx +5 -3
- package/src/stories/organisms/Tables/Tables.stories.tsx +66 -0
- package/src/stories/{oraganisms/SortableTable.stories.tsx → organisms/Tables/mockData.tsx} +30 -35
- package/src/stories/organisms/Tables/sharedTypes.ts +8 -0
- package/src/types/tableDataTypes.ts +9 -9
- package/workflows/package-release-1.yml +4 -1
- package/dist/stories/oraganisms/SortableTable.js.map +0 -1
- package/dist/stories/oraganisms/SortableTable.stories.js.map +0 -1
|
@@ -17,7 +17,7 @@ export type SortableTableProps = {
|
|
|
17
17
|
labelId: string;
|
|
18
18
|
}>;
|
|
19
19
|
title?: string;
|
|
20
|
-
onOrderPropertyChange
|
|
20
|
+
onOrderPropertyChange?: (property: OrderProperty) => VoidFunction;
|
|
21
21
|
};
|
|
22
22
|
declare function SortableTable({ headCells, tableData, rowComponent, sortOrder, sortByProperty, title, onOrderPropertyChange, }: SortableTableProps): JSX.Element;
|
|
23
23
|
export default SortableTable;
|
|
@@ -8,12 +8,14 @@ import MuiTableRow from "@mui/material/TableRow";
|
|
|
8
8
|
import TableSortLabel from "@mui/material/TableSortLabel";
|
|
9
9
|
import Toolbar from "@mui/material/Toolbar";
|
|
10
10
|
import Paper from "@mui/material/Paper";
|
|
11
|
-
import Typography from '
|
|
11
|
+
import Typography from '../../atoms/Typography/Typography';
|
|
12
12
|
function SortableTable({ headCells, tableData, rowComponent, sortOrder, sortByProperty, title = '', onOrderPropertyChange, }) {
|
|
13
13
|
const TableRow = rowComponent;
|
|
14
14
|
const handleRequestSort = (property) => (event) => {
|
|
15
15
|
event.preventDefault();
|
|
16
|
-
onOrderPropertyChange
|
|
16
|
+
if (onOrderPropertyChange) {
|
|
17
|
+
onOrderPropertyChange(property);
|
|
18
|
+
}
|
|
17
19
|
};
|
|
18
20
|
return (React.createElement(Paper, { sx: { width: "100%", mb: 2 } },
|
|
19
21
|
title && (React.createElement(Toolbar, { sx: { pl: { sm: 2 }, pr: { xs: 1, sm: 1 } } },
|
|
@@ -0,0 +1 @@
|
|
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,CACK,CACb,CACX,CAAC;AACJ,CAAC;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import DrawCard from '../../molecules/Cards/DrawCard';
|
|
3
|
+
import DrawCardTable from './DrawCardTable';
|
|
4
|
+
import { MOCK_HEAD_CELLS, mockRowComponent, MOCK_TABLE_DATA, SAMPLE_CARD_DATA } from './mockData';
|
|
5
|
+
const onOrderPropertyChange = () => { };
|
|
6
|
+
// Default
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Organisms/Tables',
|
|
9
|
+
};
|
|
10
|
+
// Templates
|
|
11
|
+
function DrawCardTableTemplate(args) {
|
|
12
|
+
return React.createElement(DrawCardTable, Object.assign({}, args));
|
|
13
|
+
}
|
|
14
|
+
const headerRows = [
|
|
15
|
+
{ name: 'Round 1' },
|
|
16
|
+
{ name: 'Quarterfinal' },
|
|
17
|
+
{ name: 'SemiFinal' },
|
|
18
|
+
];
|
|
19
|
+
const tableRows = [
|
|
20
|
+
[
|
|
21
|
+
React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
|
|
22
|
+
React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
|
|
23
|
+
React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
|
|
24
|
+
React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
|
|
25
|
+
React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
|
|
26
|
+
React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
|
|
27
|
+
React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
|
|
28
|
+
React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
|
|
29
|
+
],
|
|
30
|
+
[
|
|
31
|
+
React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
|
|
32
|
+
React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
|
|
33
|
+
React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
|
|
34
|
+
React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
|
|
35
|
+
],
|
|
36
|
+
[
|
|
37
|
+
React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
|
|
38
|
+
React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
|
|
39
|
+
],
|
|
40
|
+
];
|
|
41
|
+
// Stories
|
|
42
|
+
export const DrawTable = DrawCardTableTemplate.bind({});
|
|
43
|
+
DrawTable.args = {
|
|
44
|
+
headerRows,
|
|
45
|
+
tableRows,
|
|
46
|
+
};
|
|
47
|
+
export const SortableTable = DrawCardTableTemplate.bind({});
|
|
48
|
+
SortableTable.args = {
|
|
49
|
+
headCells: MOCK_HEAD_CELLS,
|
|
50
|
+
sortOrder: 'asc',
|
|
51
|
+
sortByProperty: 'player',
|
|
52
|
+
title: 'Player Table',
|
|
53
|
+
tableData: MOCK_TABLE_DATA,
|
|
54
|
+
rowComponent: mockRowComponent,
|
|
55
|
+
onOrderPropertyChange,
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=Tables.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tables.stories.js","sourceRoot":"","sources":["../../../../src/stories/organisms/Tables/Tables.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,gCAAgC,CAAC;AACtD,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EACL,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,gBAAgB,EACrE,MAAM,YAAY,CAAC;AAEpB,MAAM,qBAAqB,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAEvC,UAAU;AACV,eAAe;IACb,KAAK,EAAE,kBAAkB;CAC1B,CAAC;AAEF,YAAY;AACZ,SAAS,qBAA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AE,cAAc;IACrB,SAAS,EAAE,eAAe;IAC1B,YAAY,EAAE,gBAAgB;IAC9B,qBAAqB;CACtB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface RowData {
|
|
3
|
+
player: string;
|
|
4
|
+
team: string;
|
|
5
|
+
session: string;
|
|
6
|
+
}
|
|
7
|
+
interface RowProps {
|
|
8
|
+
rowData: RowData;
|
|
9
|
+
labelId: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const mockRowComponent: ({ rowData, labelId }: RowProps) => JSX.Element;
|
|
12
|
+
export declare const MOCK_HEAD_CELLS: {
|
|
13
|
+
id: string;
|
|
14
|
+
label: string;
|
|
15
|
+
isSortingDisabled: boolean;
|
|
16
|
+
}[];
|
|
17
|
+
export declare const MOCK_TABLE_DATA: {
|
|
18
|
+
id: number;
|
|
19
|
+
player: string;
|
|
20
|
+
team: string;
|
|
21
|
+
session: string;
|
|
22
|
+
}[];
|
|
23
|
+
export declare const SAMPLE_CARD_DATA: {
|
|
24
|
+
options: {
|
|
25
|
+
id: number;
|
|
26
|
+
label: string;
|
|
27
|
+
}[];
|
|
28
|
+
selectedOptions: {
|
|
29
|
+
optionOne: number;
|
|
30
|
+
optionTwo: number;
|
|
31
|
+
};
|
|
32
|
+
dateLabel: string;
|
|
33
|
+
locationLabel: string;
|
|
34
|
+
};
|
|
35
|
+
export {};
|
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TableRow, TableCell, Typography } from '@mui/material';
|
|
3
|
-
|
|
4
|
-
// Default
|
|
5
|
-
export default {
|
|
6
|
-
title: 'Organisms/SortableTable',
|
|
7
|
-
};
|
|
8
|
-
// Templates
|
|
9
|
-
function SortableTableTemplate(args) {
|
|
10
|
-
return React.createElement(SortableTable, Object.assign({}, args));
|
|
11
|
-
}
|
|
12
|
-
const rowComponent = ({ rowData, labelId }) => {
|
|
3
|
+
export const mockRowComponent = ({ rowData, labelId }) => {
|
|
13
4
|
const { player, session, team } = rowData;
|
|
14
5
|
return (React.createElement(TableRow, null,
|
|
15
6
|
React.createElement(TableCell, { component: "th", id: labelId, scope: "row", padding: "normal" },
|
|
@@ -19,49 +10,59 @@ const rowComponent = ({ rowData, labelId }) => {
|
|
|
19
10
|
React.createElement(TableCell, { align: "left" },
|
|
20
11
|
React.createElement(Typography, null, session))));
|
|
21
12
|
};
|
|
22
|
-
const
|
|
13
|
+
export const MOCK_HEAD_CELLS = [
|
|
23
14
|
{ id: 'player', label: 'Player Name', isSortingDisabled: false },
|
|
24
15
|
{ id: 'team', label: 'Team Name', isSortingDisabled: true },
|
|
25
16
|
{ id: 'session', label: 'Session', isSortingDisabled: false }
|
|
26
17
|
];
|
|
27
|
-
const
|
|
18
|
+
export const MOCK_TABLE_DATA = [
|
|
28
19
|
{
|
|
20
|
+
id: 1,
|
|
29
21
|
player: 'John Smith',
|
|
30
22
|
team: 'Mavericks',
|
|
31
23
|
session: 'NorCal Adults',
|
|
32
24
|
},
|
|
33
25
|
{
|
|
26
|
+
id: 2,
|
|
34
27
|
player: 'Megan Brown',
|
|
35
28
|
team: 'Mini Mavericks',
|
|
36
29
|
session: 'SoCal Juniors',
|
|
37
30
|
},
|
|
38
31
|
{
|
|
32
|
+
id: 3,
|
|
39
33
|
player: 'George Fox',
|
|
40
34
|
team: 'Grey Foxes',
|
|
41
35
|
session: 'North Bay Junios',
|
|
42
36
|
},
|
|
43
37
|
{
|
|
38
|
+
id: 4,
|
|
44
39
|
player: 'Alison Green',
|
|
45
40
|
team: 'Lions',
|
|
46
41
|
session: 'Outer Bay UTR 2-5',
|
|
47
42
|
},
|
|
48
43
|
{
|
|
44
|
+
id: 5,
|
|
49
45
|
player: 'Linda Belinda',
|
|
50
46
|
team: 'Green Hornets',
|
|
51
47
|
session: 'Tri-State UTR 1-3',
|
|
52
48
|
},
|
|
53
49
|
];
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
50
|
+
export const SAMPLE_CARD_DATA = {
|
|
51
|
+
options: [
|
|
52
|
+
{
|
|
53
|
+
id: 1,
|
|
54
|
+
label: 'Team 1',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: 2,
|
|
58
|
+
label: 'Team 2',
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
selectedOptions: {
|
|
62
|
+
optionOne: 1,
|
|
63
|
+
optionTwo: 2,
|
|
64
|
+
},
|
|
65
|
+
dateLabel: 'Dec 20 at 9:00am',
|
|
66
|
+
locationLabel: 'Taube Tennis Center',
|
|
64
67
|
};
|
|
65
|
-
|
|
66
|
-
DefaultTable.args = args;
|
|
67
|
-
//# sourceMappingURL=SortableTable.stories.js.map
|
|
68
|
+
//# sourceMappingURL=mockData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mockData.js","sourceRoot":"","sources":["../../../../src/stories/organisms/Tables/mockData.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAahE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAAE,OAAO,EAAE,OAAO,EAAY,EAAE,EAAE;IACjE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IAC1C,OAAO,CACH,oBAAC,QAAQ;QACL,oBAAC,SAAS,IACN,SAAS,EAAC,IAAI,EACd,EAAE,EAAE,OAAO,EACX,KAAK,EAAC,KAAK,EACX,OAAO,EAAC,QAAQ;YAEhB,oBAAC,UAAU,QAAE,MAAM,CAAc,CACzB;QACZ,oBAAC,SAAS,IAAC,KAAK,EAAC,MAAM;YACnB,oBAAC,UAAU,QAAE,IAAI,CAAc,CACvB;QACZ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C;QACZ,SAAS,EAAE,CAAC;KACb;IACD,SAAS,EAAE,kBAAkB;IAC7B,aAAa,EAAE,qBAAqB;CACrC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sharedTypes.js","sourceRoot":"","sources":["../../../../src/stories/organisms/Tables/sharedTypes.ts"],"names":[],"mappings":""}
|
|
@@ -21,15 +21,15 @@ export interface Captain {
|
|
|
21
21
|
}
|
|
22
22
|
export interface AddTeamsData {
|
|
23
23
|
id: number;
|
|
24
|
-
name
|
|
25
|
-
teamMemberCount
|
|
26
|
-
captains
|
|
27
|
-
sessionId
|
|
28
|
-
sessionName
|
|
29
|
-
sessionStartDateUtc
|
|
30
|
-
sessionEndDateUtc
|
|
31
|
-
wins
|
|
32
|
-
losses
|
|
24
|
+
name?: string;
|
|
25
|
+
teamMemberCount?: number;
|
|
26
|
+
captains?: Array<Captain>;
|
|
27
|
+
sessionId?: number;
|
|
28
|
+
sessionName?: string;
|
|
29
|
+
sessionStartDateUtc?: string;
|
|
30
|
+
sessionEndDateUtc?: string;
|
|
31
|
+
wins?: number;
|
|
32
|
+
losses?: number;
|
|
33
33
|
rank?: number;
|
|
34
34
|
isSelected?: boolean;
|
|
35
35
|
record?: string;
|
package/package.json
CHANGED
package/src/components.jsx
CHANGED
|
@@ -9,4 +9,6 @@ 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';
|
|
12
|
+
export { default as SortableTable } from './stories/organisms/Tables/SortableTable';
|
|
13
|
+
export { default as DrawCardTable } from './stories/organisms/Tables/DrawCardTable';
|
|
14
|
+
export { default as FullPageModal } from './stories/organisms/Modals/FullPageModal';
|
|
@@ -141,3 +141,45 @@ export default function Typography({
|
|
|
141
141
|
);
|
|
142
142
|
}
|
|
143
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
|
+
};
|
|
@@ -2,19 +2,8 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import ContactCard from './ContactCard';
|
|
4
4
|
import TeamCard from './TeamCard';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
interface ContactCardProps {
|
|
8
|
-
name: string;
|
|
9
|
-
phone: string;
|
|
10
|
-
email: string;
|
|
11
|
-
handleOnMessageClick?: VoidFunction;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
interface TeamCardProps {
|
|
15
|
-
title: string;
|
|
16
|
-
description: string;
|
|
17
|
-
}
|
|
5
|
+
import DrawCard from './DrawCard';
|
|
6
|
+
import { DrawCardProps, TeamCardProps, ContactCardProps } from "./sharedTypes";
|
|
18
7
|
|
|
19
8
|
// Default
|
|
20
9
|
export default {
|
|
@@ -30,6 +19,14 @@ function TeamCardTemplate(args: TeamCardProps) {
|
|
|
30
19
|
return <TeamCard {...args} />;
|
|
31
20
|
}
|
|
32
21
|
|
|
22
|
+
function DrawCardTemplate(args: DrawCardProps) {
|
|
23
|
+
return (
|
|
24
|
+
<div style={{ width: '372px' }}>
|
|
25
|
+
<DrawCard {...args} />
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
33
30
|
// Stories
|
|
34
31
|
export const Contact = ContactCardTemplate.bind({});
|
|
35
32
|
Contact.args = {
|
|
@@ -43,3 +40,23 @@ Team.args = {
|
|
|
43
40
|
title: 'team 1',
|
|
44
41
|
description: 'Captained by Lenny McDowell, Josh Palmer, and Michael Ballast. Requires a passcode for registration.'
|
|
45
42
|
};
|
|
43
|
+
|
|
44
|
+
export const Draw = DrawCardTemplate.bind({});
|
|
45
|
+
Draw.args = {
|
|
46
|
+
options: [
|
|
47
|
+
{
|
|
48
|
+
id: 1,
|
|
49
|
+
label: 'Team 1',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: 2,
|
|
53
|
+
label: 'Team 2',
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
selectedOptions: {
|
|
57
|
+
optionOne: 1,
|
|
58
|
+
optionTwo: 2,
|
|
59
|
+
},
|
|
60
|
+
dateLabel: 'Dec 20 at 9:00am',
|
|
61
|
+
locationLabel: 'Taube Tennis Center',
|
|
62
|
+
};
|
|
@@ -8,13 +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
|
-
|
|
12
|
-
type ContactCardProps = {
|
|
13
|
-
name: string;
|
|
14
|
-
phone: string;
|
|
15
|
-
email: string;
|
|
16
|
-
onMessageClick?: VoidFunction;
|
|
17
|
-
}
|
|
11
|
+
import { ContactCardProps } from './sharedTypes';
|
|
18
12
|
|
|
19
13
|
export default function ContactCard({
|
|
20
14
|
name, phone, email, onMessageClick, ...props
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
import MuiSelect, { SelectChangeEvent } from '@mui/material/Select';
|
|
5
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
6
|
+
import Button from '../../atoms/Button/Button';
|
|
7
|
+
import Typography, { SECONDARY_SIZES_ENUM, CATEGORY_ENUM } from '../../atoms/Typography/Typography';
|
|
8
|
+
import { DrawCardProps } from "./sharedTypes";
|
|
9
|
+
|
|
10
|
+
const StyledCard = styled(Box)({
|
|
11
|
+
display: 'flex',
|
|
12
|
+
flexDirection: 'column',
|
|
13
|
+
borderRadius: '4px',
|
|
14
|
+
padding: '16px 24px',
|
|
15
|
+
width: '100%',
|
|
16
|
+
backgroundColor: 'var(--cool-grey-150)',
|
|
17
|
+
|
|
18
|
+
'&:hover': {
|
|
19
|
+
cursor: 'pointer'
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const StyledMuiSelect = styled(MuiSelect)({
|
|
24
|
+
border: '1px solid var(--cool-grey-600)',
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const BottomGrid = styled(Box)({
|
|
28
|
+
display: 'flex',
|
|
29
|
+
alignItems: 'center',
|
|
30
|
+
justifyContent: 'space-between',
|
|
31
|
+
paddingTop: '32px',
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const Positions = {
|
|
35
|
+
ONE: '1',
|
|
36
|
+
TWO: '2',
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default function DrawCard({
|
|
40
|
+
options, onChange, onEditClick, selectedOptions, dateLabel, locationLabel, ...props
|
|
41
|
+
}: DrawCardProps) {
|
|
42
|
+
const { optionOne, optionTwo } = selectedOptions || null;
|
|
43
|
+
|
|
44
|
+
const handleOnSelectionChange = (event: SelectChangeEvent<unknown>, position: string) => {
|
|
45
|
+
const id = event.target.value as string;
|
|
46
|
+
|
|
47
|
+
if (onChange) {
|
|
48
|
+
onChange({ position, id });
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<StyledCard
|
|
54
|
+
{...props}
|
|
55
|
+
>
|
|
56
|
+
<StyledMuiSelect
|
|
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
|
+
>
|
|
63
|
+
{options.map((option) => <MenuItem key={option.id} value={option.id}>{option.label}</MenuItem>)}
|
|
64
|
+
</StyledMuiSelect>
|
|
65
|
+
|
|
66
|
+
<Box pt={1} />
|
|
67
|
+
<StyledMuiSelect
|
|
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)}
|
|
73
|
+
>
|
|
74
|
+
{options.map((option) => <MenuItem key={option.id} value={option.id}>{option.label}</MenuItem>)}
|
|
75
|
+
</StyledMuiSelect>
|
|
76
|
+
<BottomGrid>
|
|
77
|
+
|
|
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>
|
|
99
|
+
</StyledCard>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
@@ -2,11 +2,7 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import Typography from '../../atoms/Typography/Typography';
|
|
4
4
|
import { StyledCard } from './shared';
|
|
5
|
-
|
|
6
|
-
type TeamCardProps = {
|
|
7
|
-
title: string;
|
|
8
|
-
description: string;
|
|
9
|
-
}
|
|
5
|
+
import { TeamCardProps } from './sharedTypes';
|
|
10
6
|
|
|
11
7
|
export default function TeamCard({ title, description, ...props }: TeamCardProps) {
|
|
12
8
|
return (
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Card types
|
|
2
|
+
|
|
3
|
+
type SelectedOptions = {
|
|
4
|
+
optionOne: number;
|
|
5
|
+
optionTwo: number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
type Options = {
|
|
9
|
+
id: number;
|
|
10
|
+
label: string;
|
|
11
|
+
}[];
|
|
12
|
+
|
|
13
|
+
type OnChangeArgs = {
|
|
14
|
+
position: string;
|
|
15
|
+
id: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type DrawCardProps = {
|
|
19
|
+
options: Options;
|
|
20
|
+
selectedOptions: SelectedOptions;
|
|
21
|
+
dateLabel: string;
|
|
22
|
+
locationLabel: string;
|
|
23
|
+
onEditClick?: VoidFunction;
|
|
24
|
+
onChange?: ({ position, id }: OnChangeArgs) => null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface TeamCardProps {
|
|
28
|
+
title: string;
|
|
29
|
+
description: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface ContactCardProps {
|
|
33
|
+
name: string;
|
|
34
|
+
phone: string;
|
|
35
|
+
email: string;
|
|
36
|
+
onMessageClick?: VoidFunction;
|
|
37
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Button from 'stories/atoms/Button/Button';
|
|
3
|
+
import AppBar from '@mui/material/AppBar';
|
|
4
|
+
import Box from '@mui/material/Box';
|
|
5
|
+
import CloseIcon from '@mui/icons-material/Close';
|
|
6
|
+
import Container from '@mui/material/Container';
|
|
7
|
+
import Dialog from '@mui/material/Dialog';
|
|
8
|
+
import IconButton from '@mui/material/IconButton';
|
|
9
|
+
import Toolbar from '@mui/material/Toolbar';
|
|
10
|
+
import Typography from '@mui/material/Typography';
|
|
11
|
+
import Grid from '@mui/material/Grid';
|
|
12
|
+
import { FullPageModalType } from './sharedTypes';
|
|
13
|
+
|
|
14
|
+
function FullPageModal({
|
|
15
|
+
isOpen,
|
|
16
|
+
onClose,
|
|
17
|
+
pageTitle,
|
|
18
|
+
bottomCTAText,
|
|
19
|
+
handleBottomCTAClick,
|
|
20
|
+
isBottomCTAdisabled,
|
|
21
|
+
PagePopupModal,
|
|
22
|
+
children,
|
|
23
|
+
}: FullPageModalType) {
|
|
24
|
+
const handleOnClose = () => {
|
|
25
|
+
onClose();
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Box position="relative">
|
|
30
|
+
<Dialog
|
|
31
|
+
PaperProps={{
|
|
32
|
+
style: {
|
|
33
|
+
backgroundColor: 'var(--cool-grey-150)',
|
|
34
|
+
boxShadow: 'none',
|
|
35
|
+
},
|
|
36
|
+
}}
|
|
37
|
+
fullScreen
|
|
38
|
+
open={isOpen}
|
|
39
|
+
onClose={(event, reason) => console.log('reason', reason)}
|
|
40
|
+
>
|
|
41
|
+
<AppBar sx={{ position: 'relative', backgroundColor: 'var(--white)' }}>
|
|
42
|
+
<Toolbar>
|
|
43
|
+
<Container maxWidth={false}>
|
|
44
|
+
<Box display="flex" justifyContent="space-between" alignItems="center">
|
|
45
|
+
<Typography variant="h6">{pageTitle}</Typography>
|
|
46
|
+
<IconButton edge="start" onClick={handleOnClose} aria-label="close">
|
|
47
|
+
<CloseIcon />
|
|
48
|
+
</IconButton>
|
|
49
|
+
</Box>
|
|
50
|
+
</Container>
|
|
51
|
+
</Toolbar>
|
|
52
|
+
</AppBar>
|
|
53
|
+
<Grid height="100vh" container>
|
|
54
|
+
{children}
|
|
55
|
+
</Grid>
|
|
56
|
+
{bottomCTAText && !!handleBottomCTAClick && (
|
|
57
|
+
<Box sx={{ position: "fixed", width: "100%", backgroundColor: 'black' }} p={2} bottom={0}>
|
|
58
|
+
<Box display="flex" justifyContent="flex-end">
|
|
59
|
+
<Button onClick={handleBottomCTAClick} disabled={isBottomCTAdisabled} category="primary">
|
|
60
|
+
{bottomCTAText}
|
|
61
|
+
</Button>
|
|
62
|
+
</Box>
|
|
63
|
+
</Box>
|
|
64
|
+
)}
|
|
65
|
+
{PagePopupModal}
|
|
66
|
+
</Dialog>
|
|
67
|
+
</Box>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
export default FullPageModal;
|