@universal-tennis/ui-shared 0.1.1 → 0.1.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.
- package/.eslintignore +1 -1
- package/.eslintrc.js +10 -3
- package/.storybook/preview.js +0 -1
- package/dist/components.js +1 -0
- package/dist/components.js.map +1 -1
- package/dist/stories/assets/css/variables.css +0 -2
- package/dist/stories/atoms/Button/Button.js.map +1 -1
- package/dist/stories/atoms/Typography/Typography.d.ts +6 -5
- package/dist/stories/atoms/Typography/Typography.js +16 -10
- package/dist/stories/atoms/Typography/Typography.js.map +1 -1
- package/dist/stories/molecules/Cards/Cards.stories.d.ts +0 -1
- package/dist/stories/molecules/Cards/Cards.stories.js +0 -24
- package/dist/stories/molecules/Cards/Cards.stories.js.map +1 -1
- package/dist/stories/molecules/Cards/ContactCard.d.ts +7 -1
- package/dist/stories/molecules/Cards/ContactCard.js.map +1 -1
- package/dist/stories/molecules/Cards/TeamCard.d.ts +5 -1
- package/dist/stories/molecules/Cards/TeamCard.js.map +1 -1
- package/dist/stories/oraganisms/SortableTable.d.ts +23 -0
- package/dist/stories/oraganisms/SortableTable.js +32 -0
- package/dist/stories/oraganisms/SortableTable.js.map +1 -0
- package/dist/stories/{organisms/Tables.stories.d.ts → oraganisms/SortableTable.stories.d.ts} +1 -1
- package/dist/stories/oraganisms/SortableTable.stories.js +67 -0
- package/dist/stories/oraganisms/SortableTable.stories.js.map +1 -0
- package/dist/types/tableDataTypes.d.ts +38 -0
- package/dist/types/tableDataTypes.js +2 -0
- package/dist/types/tableDataTypes.js.map +1 -0
- package/package.json +1 -1
- package/src/components.jsx +1 -0
- package/src/stories/assets/css/variables.css +0 -2
- package/src/stories/atoms/Button/Button.tsx +19 -19
- package/src/stories/atoms/Typography/Typography.tsx +44 -49
- package/src/stories/molecules/Cards/Cards.stories.tsx +13 -30
- package/src/stories/molecules/Cards/ContactCard.tsx +29 -25
- package/src/stories/molecules/Cards/TeamCard.tsx +8 -6
- package/src/stories/oraganisms/SortableTable.stories.tsx +98 -0
- package/src/stories/oraganisms/SortableTable.tsx +110 -0
- package/src/types/tableDataTypes.ts +42 -0
- package/tsconfig.json +19 -21
- package/workflows/package-release-1.yml +0 -3
- package/.storybook/variables.css +0 -12
- package/dist/stories/molecules/Cards/DrawCard.d.ts +0 -3
- package/dist/stories/molecules/Cards/DrawCard.js +0 -66
- package/dist/stories/molecules/Cards/DrawCard.js.map +0 -1
- package/dist/stories/molecules/Cards/sharedTypes.d.ts +0 -27
- package/dist/stories/molecules/Cards/sharedTypes.js +0 -3
- package/dist/stories/molecules/Cards/sharedTypes.js.map +0 -1
- package/dist/stories/organisms/DrawCardTable.d.ts +0 -3
- package/dist/stories/organisms/DrawCardTable.js +0 -40
- package/dist/stories/organisms/DrawCardTable.js.map +0 -1
- package/dist/stories/organisms/Tables.stories.js +0 -63
- package/dist/stories/organisms/Tables.stories.js.map +0 -1
- package/dist/stories/organisms/sharedTypes.d.ts +0 -7
- package/dist/stories/organisms/sharedTypes.js +0 -2
- package/dist/stories/organisms/sharedTypes.js.map +0 -1
- package/src/stories/molecules/Cards/DrawCard.tsx +0 -102
- package/src/stories/molecules/Cards/sharedTypes.ts +0 -32
- package/src/stories/organisms/DrawCardTable.tsx +0 -57
- package/src/stories/organisms/Tables.stories.tsx +0 -69
- package/src/stories/organisms/sharedTypes.ts +0 -8
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import React from 'react';
|
|
13
|
-
import Box from '@mui/material/Box';
|
|
14
|
-
import { styled } from '@mui/material/styles';
|
|
15
|
-
import MuiSelect from '@mui/material/Select';
|
|
16
|
-
import MenuItem from '@mui/material/MenuItem';
|
|
17
|
-
import Button from '../../atoms/Button/Button';
|
|
18
|
-
import Typography from '../../atoms/Typography/Typography';
|
|
19
|
-
const StyledCard = styled(Box)({
|
|
20
|
-
display: 'flex',
|
|
21
|
-
flexDirection: 'column',
|
|
22
|
-
borderRadius: '4px',
|
|
23
|
-
padding: '16px 24px',
|
|
24
|
-
width: '100%',
|
|
25
|
-
backgroundColor: 'var(--cool-grey-150)',
|
|
26
|
-
'&:hover': {
|
|
27
|
-
cursor: 'pointer'
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
const StyledMuiSelect = styled(MuiSelect)({
|
|
31
|
-
border: '1px solid var(--cool-grey-600)',
|
|
32
|
-
});
|
|
33
|
-
const BottomGrid = styled(Box)({
|
|
34
|
-
display: 'flex',
|
|
35
|
-
alignItems: 'center',
|
|
36
|
-
justifyContent: 'space-between',
|
|
37
|
-
paddingTop: '32px',
|
|
38
|
-
});
|
|
39
|
-
export default function DrawCard(_a) {
|
|
40
|
-
var { choices, onChange, onEditClick, selectedTeams, dateLabel, locationLabel } = _a, props = __rest(_a, ["choices", "onChange", "onEditClick", "selectedTeams", "dateLabel", "locationLabel"]);
|
|
41
|
-
const { teamOne, teamTwo } = selectedTeams || null;
|
|
42
|
-
const handleOnTeamOneChange = () => {
|
|
43
|
-
if (onChange) {
|
|
44
|
-
onChange(0);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
const handleOnTeamTwoChange = () => {
|
|
48
|
-
if (onChange) {
|
|
49
|
-
onChange(1);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
return (React.createElement(StyledCard, Object.assign({}, props),
|
|
53
|
-
React.createElement(StyledMuiSelect, { labelId: "draw-card-select-label-top", id: "draw-card-select-top", value: teamOne, label: "teamOne", onChange: handleOnTeamOneChange }, choices.map((choice) => React.createElement(MenuItem, { value: choice.id }, choice.label))),
|
|
54
|
-
React.createElement(Box, { pt: 1 }),
|
|
55
|
-
React.createElement(StyledMuiSelect, { labelId: "draw-card-select-label-bot", id: "draw-card-select-bot", value: teamTwo, label: "teamTwo", onChange: handleOnTeamTwoChange }, choices.map((choice) => React.createElement(MenuItem, { value: choice.id }, choice.label))),
|
|
56
|
-
React.createElement(BottomGrid, null,
|
|
57
|
-
React.createElement(Box, null,
|
|
58
|
-
React.createElement(Typography, { category: "secondary", size: "small-book" }, dateLabel),
|
|
59
|
-
React.createElement(Typography, { category: "secondary", size: "small-book" }, locationLabel)),
|
|
60
|
-
React.createElement(Button, { style: {
|
|
61
|
-
display: 'flex',
|
|
62
|
-
justifyContent: 'end'
|
|
63
|
-
}, onClick: onEditClick, category: "link" },
|
|
64
|
-
React.createElement(Typography, { category: "secondary", size: "x-small-medium-cap" }, "Edit")))));
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=DrawCard.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DrawCard.js","sourceRoot":"","sources":["../../../../src/stories/molecules/Cards/DrawCard.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,SAAS,MAAM,sBAAsB,CAAC;AAC7C,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAC9C,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAC/C,OAAO,UAAU,MAAM,mCAAmC,CAAC;AAG3D,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC7B,OAAO,EAAE,MAAM;IACf,aAAa,EAAE,QAAQ;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AM,CAAC,KAAK,CAAY,CAAC,CAC/D;QAEhB,oBAAC,GAAG,IAAC,EAAE,EAAE,CAAC,GAAI;QAEhB,oBAAC,eAAe,IACd,OAAO,EAAC,4BAA4B,EACpC,EAAE,EAAC,sBAAsB,EACzB,KAAK,EAAE,OAAO,EACd,KAAK,EAAC,SAAS,EACf,QAAQ,EAAE,qBAAqB,IAE9B,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,oBAAC,QAAQ,IAAC,KAAK,EAAE,MAAM,CAAC,EAAE,IAAG,MAAM,CAAC,KAAK,CAAY,CAAC,CAC/D;QACpB,oBAAC,UAAU;YAEP,oBAAC,GAAG;gBACN,oBAAC,UAAU,IAAC,QAAQ,EAAC,WAAW,EAAC,IAAI,EAAC,YAAY,IAC/C,SAAS,CACC;gBACb,oBAAC,UAAU,IAAC,QAAQ,EAAC,WAAW,EAAC,IAAI,EAAC,YAAY,IAC/C,aAAa,CACH,CACL;YACN,oBAAC,MAAM,IACL,KAAK,EAAE;oBACL,OAAO,EAAE,MAAM;oBACf,cAAc,EAAE,KAAK;iBACtB,EACD,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAC,MAAM;gBAEb,oBAAC,UAAU,IAAC,QAAQ,EAAC,WAAW,EAAC,IAAI,EAAC,oBAAoB,WAE7C,CACR,CACA,CACF,CAChB,CAAC;AACJ,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
type SelectedTeams = {
|
|
2
|
-
teamOne: number;
|
|
3
|
-
teamTwo: number;
|
|
4
|
-
};
|
|
5
|
-
type Choices = {
|
|
6
|
-
id: number;
|
|
7
|
-
label: string;
|
|
8
|
-
}[];
|
|
9
|
-
export type DrawCardProps = {
|
|
10
|
-
choices: Choices;
|
|
11
|
-
selectedTeams: SelectedTeams;
|
|
12
|
-
dateLabel: string;
|
|
13
|
-
locationLabel: string;
|
|
14
|
-
onEditClick?: VoidFunction;
|
|
15
|
-
onChange?: (arg0: number) => null;
|
|
16
|
-
};
|
|
17
|
-
export interface TeamCardProps {
|
|
18
|
-
title: string;
|
|
19
|
-
description: string;
|
|
20
|
-
}
|
|
21
|
-
export interface ContactCardProps {
|
|
22
|
-
name: string;
|
|
23
|
-
phone: string;
|
|
24
|
-
email: string;
|
|
25
|
-
onMessageClick?: VoidFunction;
|
|
26
|
-
}
|
|
27
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sharedTypes.js","sourceRoot":"","sources":["../../../../src/stories/molecules/Cards/sharedTypes.ts"],"names":[],"mappings":"AAAA,aAAa"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import React from 'react';
|
|
13
|
-
import Box from '@mui/material/Box';
|
|
14
|
-
import { styled } from '@mui/material/styles';
|
|
15
|
-
import Grid from '@mui/material/Grid';
|
|
16
|
-
import Typography from '../atoms/Typography/Typography';
|
|
17
|
-
const StyledHeader = styled(Grid)({
|
|
18
|
-
alignItems: 'center',
|
|
19
|
-
justifyContent: 'center',
|
|
20
|
-
display: 'flex',
|
|
21
|
-
});
|
|
22
|
-
const GridSections = styled(Box)({
|
|
23
|
-
display: 'flex',
|
|
24
|
-
alignItems: 'center',
|
|
25
|
-
padding: '8px'
|
|
26
|
-
});
|
|
27
|
-
export default function DrawCardTable(_a) {
|
|
28
|
-
var { headerRows, tableRows } = _a, props = __rest(_a, ["headerRows", "tableRows"]);
|
|
29
|
-
const totalColumns = Math.floor(12 / headerRows.length);
|
|
30
|
-
const formatTableRows = tableRows.map((row, index) => {
|
|
31
|
-
const rowSectionsWidth = `${100 / tableRows[index].length}%`;
|
|
32
|
-
const sectionAmount = tableRows[index].length;
|
|
33
|
-
return (React.createElement(Grid, { xs: totalColumns }, [...Array(sectionAmount)].map((section, idx) => (React.createElement(GridSections, { sx: { height: rowSectionsWidth } }, row[idx])))));
|
|
34
|
-
});
|
|
35
|
-
return (React.createElement(Box, Object.assign({}, props, { sx: { flexGrow: 1 }, "aria-label": "draw table" }),
|
|
36
|
-
React.createElement(Grid, { container: true, sx: { height: '60px' } }, headerRows.map((row) => (React.createElement(StyledHeader, { key: row.name, xs: totalColumns },
|
|
37
|
-
React.createElement(Typography, { category: "secondary", size: "small-medium-cap" }, row.name))))),
|
|
38
|
-
React.createElement(Grid, { container: true }, formatTableRows)));
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=DrawCardTable.js.map
|
|
@@ -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;AAE9C,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,QAA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C,IAAI,CAAc,CACnE,CAClB,CAAC,CACD;QACP,oBAAC,IAAI,IAAC,SAAS,UACJ,eAAe,CACnB,CACH,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import DrawCard from '../molecules/Cards/DrawCard';
|
|
3
|
-
import DrawCardTable from './DrawCardTable';
|
|
4
|
-
const SAMPLE_CARD_DATA = {
|
|
5
|
-
choices: [
|
|
6
|
-
{
|
|
7
|
-
id: 1,
|
|
8
|
-
label: 'Team 1',
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
id: 2,
|
|
12
|
-
label: 'Team 2',
|
|
13
|
-
}
|
|
14
|
-
],
|
|
15
|
-
selectedTeams: {
|
|
16
|
-
teamOne: 1,
|
|
17
|
-
teamTwo: 2,
|
|
18
|
-
},
|
|
19
|
-
dateLabel: 'Dec 20 at 9:00am',
|
|
20
|
-
locationLabel: 'Taube Tennis Center',
|
|
21
|
-
};
|
|
22
|
-
// Default
|
|
23
|
-
export default {
|
|
24
|
-
title: 'Organisms/Tables',
|
|
25
|
-
};
|
|
26
|
-
// Templates
|
|
27
|
-
function DrawCardTableTemplate(args) {
|
|
28
|
-
return React.createElement(DrawCardTable, Object.assign({}, args));
|
|
29
|
-
}
|
|
30
|
-
const headerRows = [
|
|
31
|
-
{ name: 'Round 1' },
|
|
32
|
-
{ name: 'Quarterfinal' },
|
|
33
|
-
{ name: 'SemiFinal' },
|
|
34
|
-
];
|
|
35
|
-
const tableRows = [
|
|
36
|
-
[
|
|
37
|
-
React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
|
|
38
|
-
React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
|
|
39
|
-
React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
|
|
40
|
-
React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
|
|
41
|
-
React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
|
|
42
|
-
React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
|
|
43
|
-
React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
|
|
44
|
-
React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
|
|
45
|
-
],
|
|
46
|
-
[
|
|
47
|
-
React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
|
|
48
|
-
React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
|
|
49
|
-
React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
|
|
50
|
-
React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
|
|
51
|
-
],
|
|
52
|
-
[
|
|
53
|
-
React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
|
|
54
|
-
React.createElement(DrawCard, Object.assign({}, SAMPLE_CARD_DATA)),
|
|
55
|
-
],
|
|
56
|
-
];
|
|
57
|
-
// Stories
|
|
58
|
-
export const DrawTable = DrawCardTableTemplate.bind({});
|
|
59
|
-
DrawTable.args = {
|
|
60
|
-
headerRows,
|
|
61
|
-
tableRows,
|
|
62
|
-
};
|
|
63
|
-
//# 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,QAAQ,MAAM,6BAA6B,CAAC;AACnD,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAG5C,MAAM,gBAAgB,GAAG;IACvB,OAAO,EAAE;QACP;YACE,EAAE,EAAE,CAAC;YACL,KAAK,EAAE,QAAQ;SAChB;QACD;YACE,EAAE,EAAE,CAAC;YACL,KAAK,EAAE,QAAQ;SAChB;KACF;IACD,aAAa,EAAE;QACb,OAAO,EAAE,CAAC;QACV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@
|
|
|
1
|
-
{"version":3,"file":"sharedTypes.js","sourceRoot":"","sources":["../../../src/stories/organisms/sharedTypes.ts"],"names":[],"mappings":""}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Box from '@mui/material/Box';
|
|
3
|
-
import { styled } from '@mui/material/styles';
|
|
4
|
-
import MuiSelect from '@mui/material/Select';
|
|
5
|
-
import MenuItem from '@mui/material/MenuItem';
|
|
6
|
-
import Button from '../../atoms/Button/Button';
|
|
7
|
-
import Typography 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
|
-
|
|
35
|
-
export default function DrawCard({
|
|
36
|
-
choices, onChange, onEditClick, selectedTeams, dateLabel, locationLabel, ...props
|
|
37
|
-
}: DrawCardProps) {
|
|
38
|
-
const {teamOne, teamTwo} = selectedTeams || null;
|
|
39
|
-
|
|
40
|
-
const handleOnTeamOneChange = () => {
|
|
41
|
-
if (onChange) {
|
|
42
|
-
onChange(0);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const handleOnTeamTwoChange = () => {
|
|
47
|
-
if (onChange) {
|
|
48
|
-
onChange(1);
|
|
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={teamOne}
|
|
60
|
-
label="teamOne"
|
|
61
|
-
onChange={handleOnTeamOneChange}
|
|
62
|
-
>
|
|
63
|
-
{choices.map((choice) => <MenuItem value={choice.id}>{choice.label}</MenuItem>)}
|
|
64
|
-
</StyledMuiSelect>
|
|
65
|
-
|
|
66
|
-
<Box pt={1} />
|
|
67
|
-
|
|
68
|
-
<StyledMuiSelect
|
|
69
|
-
labelId="draw-card-select-label-bot"
|
|
70
|
-
id="draw-card-select-bot"
|
|
71
|
-
value={teamTwo}
|
|
72
|
-
label="teamTwo"
|
|
73
|
-
onChange={handleOnTeamTwoChange}
|
|
74
|
-
>
|
|
75
|
-
{choices.map((choice) => <MenuItem value={choice.id}>{choice.label}</MenuItem>)}
|
|
76
|
-
</StyledMuiSelect>
|
|
77
|
-
<BottomGrid>
|
|
78
|
-
|
|
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>
|
|
100
|
-
</StyledCard>
|
|
101
|
-
);
|
|
102
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// Card types
|
|
2
|
-
|
|
3
|
-
type SelectedTeams = {
|
|
4
|
-
teamOne: number;
|
|
5
|
-
teamTwo: number;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
type Choices = {
|
|
9
|
-
id: number;
|
|
10
|
-
label: string;
|
|
11
|
-
}[];
|
|
12
|
-
|
|
13
|
-
export type DrawCardProps = {
|
|
14
|
-
choices: Choices;
|
|
15
|
-
selectedTeams: SelectedTeams;
|
|
16
|
-
dateLabel: string;
|
|
17
|
-
locationLabel: string;
|
|
18
|
-
onEditClick?: VoidFunction;
|
|
19
|
-
onChange?: (arg0: number) => null;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface TeamCardProps {
|
|
23
|
-
title: string;
|
|
24
|
-
description: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface ContactCardProps {
|
|
28
|
-
name: string;
|
|
29
|
-
phone: string;
|
|
30
|
-
email: string;
|
|
31
|
-
onMessageClick?: VoidFunction;
|
|
32
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Box from '@mui/material/Box';
|
|
3
|
-
import { styled } from '@mui/material/styles';
|
|
4
|
-
import Paper from '@mui/material/Paper';
|
|
5
|
-
import Grid from '@mui/material/Grid';
|
|
6
|
-
import Typography from '../atoms/Typography/Typography';
|
|
7
|
-
import {DrawCardTableProps} from './sharedTypes';
|
|
8
|
-
|
|
9
|
-
const StyledHeader = styled(Grid)({
|
|
10
|
-
alignItems: 'center',
|
|
11
|
-
justifyContent: 'center',
|
|
12
|
-
display: 'flex',
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
const GridSections = styled(Box)({
|
|
16
|
-
display: 'flex',
|
|
17
|
-
alignItems: 'center',
|
|
18
|
-
padding: '8px'
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
export default function DrawCardTable({
|
|
22
|
-
headerRows,
|
|
23
|
-
tableRows,
|
|
24
|
-
...props
|
|
25
|
-
}: DrawCardTableProps) {
|
|
26
|
-
const totalColumns = Math.floor(12 / headerRows.length);
|
|
27
|
-
|
|
28
|
-
const formatTableRows = tableRows.map((row, index) => {
|
|
29
|
-
const rowSectionsWidth = `${100 / tableRows[index].length}%`;
|
|
30
|
-
const sectionAmount = tableRows[index].length;
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<Grid xs={totalColumns}>
|
|
34
|
-
{[...Array(sectionAmount)].map((section, idx) => (
|
|
35
|
-
<GridSections sx={{height: rowSectionsWidth}}>
|
|
36
|
-
{row[idx]}
|
|
37
|
-
</GridSections>
|
|
38
|
-
))}
|
|
39
|
-
</Grid>
|
|
40
|
-
);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
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>
|
|
56
|
-
);
|
|
57
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import DrawCard from '../molecules/Cards/DrawCard';
|
|
3
|
-
import DrawCardTable from './DrawCardTable';
|
|
4
|
-
import {DrawCardTableProps } from './sharedTypes';
|
|
5
|
-
|
|
6
|
-
const SAMPLE_CARD_DATA = {
|
|
7
|
-
choices: [
|
|
8
|
-
{
|
|
9
|
-
id: 1,
|
|
10
|
-
label: 'Team 1',
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
id: 2,
|
|
14
|
-
label: 'Team 2',
|
|
15
|
-
}
|
|
16
|
-
],
|
|
17
|
-
selectedTeams: {
|
|
18
|
-
teamOne: 1,
|
|
19
|
-
teamTwo: 2,
|
|
20
|
-
},
|
|
21
|
-
dateLabel: 'Dec 20 at 9:00am',
|
|
22
|
-
locationLabel: 'Taube Tennis Center',
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
// Default
|
|
26
|
-
export default {
|
|
27
|
-
title: 'Organisms/Tables',
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
// Templates
|
|
31
|
-
function DrawCardTableTemplate(args: DrawCardTableProps) {
|
|
32
|
-
return <DrawCardTable {...args} />;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const headerRows = [
|
|
36
|
-
{name: 'Round 1' },
|
|
37
|
-
{name: 'Quarterfinal' },
|
|
38
|
-
{name: 'SemiFinal' },
|
|
39
|
-
];
|
|
40
|
-
|
|
41
|
-
const tableRows = [
|
|
42
|
-
[
|
|
43
|
-
<DrawCard {...SAMPLE_CARD_DATA} />,
|
|
44
|
-
<DrawCard {...SAMPLE_CARD_DATA} />,
|
|
45
|
-
<DrawCard {...SAMPLE_CARD_DATA} />,
|
|
46
|
-
<DrawCard {...SAMPLE_CARD_DATA} />,
|
|
47
|
-
<DrawCard {...SAMPLE_CARD_DATA} />,
|
|
48
|
-
<DrawCard {...SAMPLE_CARD_DATA} />,
|
|
49
|
-
<DrawCard {...SAMPLE_CARD_DATA} />,
|
|
50
|
-
<DrawCard {...SAMPLE_CARD_DATA} />,
|
|
51
|
-
],
|
|
52
|
-
[
|
|
53
|
-
<DrawCard {...SAMPLE_CARD_DATA} />,
|
|
54
|
-
<DrawCard {...SAMPLE_CARD_DATA} />,
|
|
55
|
-
<DrawCard {...SAMPLE_CARD_DATA} />,
|
|
56
|
-
<DrawCard {...SAMPLE_CARD_DATA} />,
|
|
57
|
-
],
|
|
58
|
-
[
|
|
59
|
-
<DrawCard {...SAMPLE_CARD_DATA} />,
|
|
60
|
-
<DrawCard {...SAMPLE_CARD_DATA} />,
|
|
61
|
-
],
|
|
62
|
-
];
|
|
63
|
-
|
|
64
|
-
// Stories
|
|
65
|
-
export const DrawTable = DrawCardTableTemplate.bind({});
|
|
66
|
-
DrawTable.args = {
|
|
67
|
-
headerRows,
|
|
68
|
-
tableRows,
|
|
69
|
-
};
|