@universal-tennis/ui-shared 0.1.2 → 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,16 +1,10 @@
|
|
|
1
|
-
import 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
|
-
|
|
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
|
|
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[
|
|
58
|
-
fontWeight:
|
|
53
|
+
fontSize: DISPLAY_SIZES[size as keyof typeof DISPLAY_SIZES],
|
|
54
|
+
fontWeight: weight
|
|
59
55
|
}));
|
|
60
56
|
|
|
61
|
-
const PrimaryTypography = styled(MuiTypography
|
|
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[
|
|
64
|
-
fontWeight:
|
|
61
|
+
fontSize: PRIMARY_SIZES[size as keyof typeof PRIMARY_SIZES],
|
|
62
|
+
fontWeight: weight
|
|
65
63
|
}));
|
|
66
64
|
|
|
67
|
-
const SecondaryTypography = styled(MuiTypography
|
|
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[
|
|
70
|
-
textTransform:
|
|
71
|
-
fontWeight:
|
|
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,64 +84,59 @@ 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
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
104
|
+
<PrimaryTypography
|
|
105
|
+
size={size}
|
|
106
|
+
{...props}
|
|
107
|
+
>
|
|
108
|
+
{children}
|
|
109
|
+
</PrimaryTypography>
|
|
115
110
|
);
|
|
116
111
|
case 'secondary':
|
|
117
112
|
return (
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
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
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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
|
-
|
|
141
|
-
|
|
142
|
-
|
|
135
|
+
size={size}
|
|
136
|
+
weight={weight}
|
|
137
|
+
{...props}
|
|
143
138
|
>
|
|
144
|
-
|
|
139
|
+
{children}
|
|
145
140
|
</PrimaryTypography>
|
|
146
141
|
);
|
|
147
142
|
}
|
|
@@ -2,8 +2,19 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import ContactCard from './ContactCard';
|
|
4
4
|
import TeamCard from './TeamCard';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
|
|
6
|
+
// Prop types
|
|
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
|
+
}
|
|
7
18
|
|
|
8
19
|
// Default
|
|
9
20
|
export default {
|
|
@@ -19,14 +30,6 @@ function TeamCardTemplate(args: TeamCardProps) {
|
|
|
19
30
|
return <TeamCard {...args} />;
|
|
20
31
|
}
|
|
21
32
|
|
|
22
|
-
function DrawCardTemplate(args: DrawCardProps) {
|
|
23
|
-
return (
|
|
24
|
-
<div style={{width: '372px'}}>
|
|
25
|
-
<DrawCard {...args} />
|
|
26
|
-
</div>
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
33
|
// Stories
|
|
31
34
|
export const Contact = ContactCardTemplate.bind({});
|
|
32
35
|
Contact.args = {
|
|
@@ -40,23 +43,3 @@ Team.args = {
|
|
|
40
43
|
title: 'team 1',
|
|
41
44
|
description: 'Captained by Lenny McDowell, Josh Palmer, and Michael Ballast. Requires a passcode for registration.'
|
|
42
45
|
};
|
|
43
|
-
|
|
44
|
-
export const Draw = DrawCardTemplate.bind({});
|
|
45
|
-
Draw.args = {
|
|
46
|
-
choices: [
|
|
47
|
-
{
|
|
48
|
-
id: 1,
|
|
49
|
-
label: 'Team 1',
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
id: 2,
|
|
53
|
-
label: 'Team 2',
|
|
54
|
-
}
|
|
55
|
-
],
|
|
56
|
-
selectedTeams: {
|
|
57
|
-
teamOne: 1,
|
|
58
|
-
teamTwo: 2,
|
|
59
|
-
},
|
|
60
|
-
dateLabel: 'Dec 20 at 9:00am',
|
|
61
|
-
locationLabel: 'Taube Tennis Center',
|
|
62
|
-
};
|
|
@@ -8,7 +8,13 @@ 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
|
-
|
|
11
|
+
|
|
12
|
+
type ContactCardProps = {
|
|
13
|
+
name: string;
|
|
14
|
+
phone: string;
|
|
15
|
+
email: string;
|
|
16
|
+
onMessageClick?: VoidFunction;
|
|
17
|
+
}
|
|
12
18
|
|
|
13
19
|
export default function ContactCard({
|
|
14
20
|
name, phone, email, onMessageClick, ...props
|
|
@@ -18,30 +24,28 @@ export default function ContactCard({
|
|
|
18
24
|
const phoneNumber = parsedNumber?.formatInternational();
|
|
19
25
|
|
|
20
26
|
return (
|
|
21
|
-
<StyledCard
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
</>
|
|
44
|
-
</Button>
|
|
27
|
+
<StyledCard {...props}>
|
|
28
|
+
<Typography style={{ marginBottom: '8px' }} category="secondary" size="medium-medium">{name}</Typography>
|
|
29
|
+
{phoneNumber && (
|
|
30
|
+
<Link sx={{ display: 'flex' }} mt={1} fontSize={14} href={`tel:${phone}`}>
|
|
31
|
+
<LocalPhoneOutlinedIcon fontSize="small" sx={{ mr: 1 }} />
|
|
32
|
+
<Typography category="secondary" size="x-small-book">{phoneNumber}</Typography>
|
|
33
|
+
</Link>
|
|
34
|
+
)}
|
|
35
|
+
{email && (
|
|
36
|
+
<Link sx={{ display: 'flex' }} mt={1} fontSize={14} href={`mailto:${email}`}>
|
|
37
|
+
<EmailOutlinedIcon fontSize="small" sx={{ mr: 1 }} />
|
|
38
|
+
<Typography category="secondary" size="x-small-book">{email}</Typography>
|
|
39
|
+
</Link>
|
|
40
|
+
)}
|
|
41
|
+
<Button onClick={onMessageClick} category="link" style={{ marginTop: '8px' }}>
|
|
42
|
+
<>
|
|
43
|
+
<img src={ChatIcon} alt="message" style={{ width: '20px' }} />
|
|
44
|
+
<Typography style={{ paddingLeft: '8px' }} category="secondary" size="x-small-book">
|
|
45
|
+
{`Message ${firstName}`}
|
|
46
|
+
</Typography>
|
|
47
|
+
</>
|
|
48
|
+
</Button>
|
|
45
49
|
</StyledCard>
|
|
46
50
|
);
|
|
47
51
|
}
|
|
@@ -2,15 +2,17 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import Typography from '../../atoms/Typography/Typography';
|
|
4
4
|
import { StyledCard } from './shared';
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
type TeamCardProps = {
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
}
|
|
6
10
|
|
|
7
11
|
export default function TeamCard({ title, description, ...props }: TeamCardProps) {
|
|
8
12
|
return (
|
|
9
|
-
<StyledCard
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
<Typography category="secondary" size="medium-medium">{title}</Typography>
|
|
13
|
-
<Typography category="secondary" size="x-small-book">{description}</Typography>
|
|
13
|
+
<StyledCard {...props}>
|
|
14
|
+
<Typography category="secondary" size="medium-medium">{title}</Typography>
|
|
15
|
+
<Typography category="secondary" size="x-small-book">{description}</Typography>
|
|
14
16
|
</StyledCard>
|
|
15
17
|
);
|
|
16
18
|
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TableRow, TableCell, Typography } from '@mui/material';
|
|
3
|
+
|
|
4
|
+
import SortableTable, { SortableTableProps } from './SortableTable';
|
|
5
|
+
|
|
6
|
+
// Default
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Organisms/SortableTable',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// Templates
|
|
12
|
+
function SortableTableTemplate(args: SortableTableProps) {
|
|
13
|
+
return <SortableTable {...args} />;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface RowData {
|
|
17
|
+
player: string;
|
|
18
|
+
team: string;
|
|
19
|
+
session: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface RowProps {
|
|
23
|
+
rowData: RowData,
|
|
24
|
+
labelId: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const rowComponent = ({ rowData, labelId }: RowProps) => {
|
|
28
|
+
const { player, session, team } = rowData;
|
|
29
|
+
return (
|
|
30
|
+
<TableRow>
|
|
31
|
+
<TableCell
|
|
32
|
+
component="th"
|
|
33
|
+
id={labelId}
|
|
34
|
+
scope="row"
|
|
35
|
+
padding="normal"
|
|
36
|
+
>
|
|
37
|
+
<Typography>{player}</Typography>
|
|
38
|
+
</TableCell>
|
|
39
|
+
<TableCell align="left">
|
|
40
|
+
<Typography>{team}</Typography>
|
|
41
|
+
</TableCell>
|
|
42
|
+
<TableCell align="left">
|
|
43
|
+
<Typography>{session}</Typography>
|
|
44
|
+
</TableCell>
|
|
45
|
+
</TableRow>
|
|
46
|
+
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const headCells = [
|
|
51
|
+
{ id: 'player', label: 'Player Name', isSortingDisabled: false },
|
|
52
|
+
{ id: 'team', label: 'Team Name', isSortingDisabled: true },
|
|
53
|
+
{ id: 'session', label: 'Session', isSortingDisabled: false }];
|
|
54
|
+
|
|
55
|
+
const tableData = [
|
|
56
|
+
{
|
|
57
|
+
player: 'John Smith',
|
|
58
|
+
team: 'Mavericks',
|
|
59
|
+
session: 'NorCal Adults',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
player: 'Megan Brown',
|
|
63
|
+
team: 'Mini Mavericks',
|
|
64
|
+
session: 'SoCal Juniors',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
player: 'George Fox',
|
|
68
|
+
team: 'Grey Foxes',
|
|
69
|
+
session: 'North Bay Junios',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
player: 'Alison Green',
|
|
73
|
+
team: 'Lions',
|
|
74
|
+
session: 'Outer Bay UTR 2-5',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
player: 'Linda Belinda',
|
|
78
|
+
team: 'Green Hornets',
|
|
79
|
+
session: 'Tri-State UTR 1-3',
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
const onOrderPropertyChange = () => {};
|
|
84
|
+
|
|
85
|
+
// Stories
|
|
86
|
+
|
|
87
|
+
const args = {
|
|
88
|
+
headCells,
|
|
89
|
+
sortOrder: 'asc',
|
|
90
|
+
sortByProperty: 'player',
|
|
91
|
+
title: 'Player Table',
|
|
92
|
+
tableData,
|
|
93
|
+
rowComponent,
|
|
94
|
+
onOrderPropertyChange,
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const DefaultTable = SortableTableTemplate.bind({});
|
|
98
|
+
DefaultTable.args = args;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import React, { ComponentType, SyntheticEvent } from "react";
|
|
2
|
+
|
|
3
|
+
import Table from "@mui/material/Table";
|
|
4
|
+
import TableBody from "@mui/material/TableBody";
|
|
5
|
+
import TableCell from "@mui/material/TableCell";
|
|
6
|
+
import TableContainer from "@mui/material/TableContainer";
|
|
7
|
+
import TableHead from "@mui/material/TableHead";
|
|
8
|
+
import MuiTableRow from "@mui/material/TableRow";
|
|
9
|
+
import TableSortLabel from "@mui/material/TableSortLabel";
|
|
10
|
+
import Toolbar from "@mui/material/Toolbar";
|
|
11
|
+
import Paper from "@mui/material/Paper";
|
|
12
|
+
|
|
13
|
+
import { TableData } from "types/tableDataTypes";
|
|
14
|
+
import Typography from '../atoms/Typography/Typography';
|
|
15
|
+
|
|
16
|
+
type Order = 'asc' | 'desc';
|
|
17
|
+
type OrderProperty = string | number;
|
|
18
|
+
|
|
19
|
+
interface HeadCell {
|
|
20
|
+
id: string;
|
|
21
|
+
label?: string;
|
|
22
|
+
isSortingDisabled: boolean
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type SortableTableProps = {
|
|
26
|
+
headCells: Array<HeadCell>;
|
|
27
|
+
tableData: Array<TableData>;
|
|
28
|
+
sortOrder: Order;
|
|
29
|
+
sortByProperty: OrderProperty;
|
|
30
|
+
rowComponent: ComponentType<{rowData: TableData, labelId: string}>;
|
|
31
|
+
title?: string;
|
|
32
|
+
onOrderPropertyChange: (property: OrderProperty) => VoidFunction
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function SortableTable({
|
|
36
|
+
headCells,
|
|
37
|
+
tableData,
|
|
38
|
+
rowComponent,
|
|
39
|
+
sortOrder,
|
|
40
|
+
sortByProperty,
|
|
41
|
+
title = '',
|
|
42
|
+
onOrderPropertyChange,
|
|
43
|
+
}: SortableTableProps) {
|
|
44
|
+
const TableRow = rowComponent;
|
|
45
|
+
|
|
46
|
+
const handleRequestSort = (property: OrderProperty) => (event: SyntheticEvent) => {
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
onOrderPropertyChange(property);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<Paper sx={{ width: "100%", mb: 2 }}>
|
|
53
|
+
{title && (
|
|
54
|
+
<Toolbar sx={{ pl: { sm: 2 }, pr: { xs: 1, sm: 1 } }}>
|
|
55
|
+
<Typography
|
|
56
|
+
category="secondary"
|
|
57
|
+
size="large-medium"
|
|
58
|
+
id="tableTitle"
|
|
59
|
+
>
|
|
60
|
+
{title}
|
|
61
|
+
</Typography>
|
|
62
|
+
</Toolbar>
|
|
63
|
+
)}
|
|
64
|
+
<TableContainer>
|
|
65
|
+
<Table
|
|
66
|
+
sx={{ minWidth: 750 }}
|
|
67
|
+
aria-labelledby="tableTitle"
|
|
68
|
+
size="medium"
|
|
69
|
+
>
|
|
70
|
+
<TableHead>
|
|
71
|
+
<MuiTableRow>
|
|
72
|
+
{headCells.map((headCell) => (
|
|
73
|
+
<TableCell
|
|
74
|
+
key={headCell.id}
|
|
75
|
+
align="left"
|
|
76
|
+
padding="normal"
|
|
77
|
+
sortDirection={sortByProperty === headCell.id ? sortOrder : false}
|
|
78
|
+
>
|
|
79
|
+
<TableSortLabel
|
|
80
|
+
disabled={headCell.isSortingDisabled}
|
|
81
|
+
hideSortIcon={!headCell?.label}
|
|
82
|
+
active={sortByProperty === headCell.id}
|
|
83
|
+
direction={sortByProperty === headCell.id ? sortOrder : 'asc'}
|
|
84
|
+
onClick={handleRequestSort(headCell.id)}
|
|
85
|
+
>
|
|
86
|
+
{headCell?.label}
|
|
87
|
+
</TableSortLabel>
|
|
88
|
+
</TableCell>
|
|
89
|
+
))}
|
|
90
|
+
</MuiTableRow>
|
|
91
|
+
</TableHead>
|
|
92
|
+
<TableBody>
|
|
93
|
+
{tableData && tableData.map((data: TableData, index: number) => {
|
|
94
|
+
const labelId = `table-${index}`;
|
|
95
|
+
return (
|
|
96
|
+
<TableRow
|
|
97
|
+
key={data.id}
|
|
98
|
+
rowData={data}
|
|
99
|
+
labelId={labelId}
|
|
100
|
+
/>
|
|
101
|
+
);
|
|
102
|
+
})}
|
|
103
|
+
</TableBody>
|
|
104
|
+
</Table>
|
|
105
|
+
</TableContainer>
|
|
106
|
+
</Paper>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export default SortableTable;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface Location {
|
|
2
|
+
placeId: string;
|
|
3
|
+
formattedAddress: string;
|
|
4
|
+
placeName: string;
|
|
5
|
+
lat: number;
|
|
6
|
+
lng: number
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface Captain {
|
|
10
|
+
id: number;
|
|
11
|
+
teamId: number;
|
|
12
|
+
memberId: number;
|
|
13
|
+
playerId: number;
|
|
14
|
+
gender?: string;
|
|
15
|
+
firstName: string;
|
|
16
|
+
lastName: string;
|
|
17
|
+
email?: string;
|
|
18
|
+
phone?: string;
|
|
19
|
+
phoneCountryCode?: string;
|
|
20
|
+
profileImage?: string;
|
|
21
|
+
location?: Location
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface AddTeamsData {
|
|
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;
|
|
35
|
+
rank?: number;
|
|
36
|
+
isSelected?: boolean;
|
|
37
|
+
record?: string;
|
|
38
|
+
sessionDates?: string;
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type TableData = AddTeamsData
|
package/tsconfig.json
CHANGED
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
3
|
+
"noImplicitThis": true,
|
|
4
|
+
"preserveConstEnums": true,
|
|
5
|
+
"strictNullChecks": true,
|
|
6
|
+
"sourceMap": true,
|
|
7
|
+
"declaration": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"outDir": "dist",
|
|
10
|
+
"target": "es6",
|
|
11
|
+
"module": "es6",
|
|
12
|
+
"allowJs": true,
|
|
13
|
+
"moduleResolution": "node",
|
|
14
|
+
"skipLibCheck": true,
|
|
15
|
+
"jsx": "react",
|
|
16
|
+
"lib": ["ES2017", "DOM"],
|
|
17
|
+
"baseUrl": "src",
|
|
18
|
+
"allowSyntheticDefaultImports": true,
|
|
19
|
+
"noImplicitAny": true
|
|
20
20
|
},
|
|
21
|
-
"exclude": [
|
|
22
|
-
"node_modules",
|
|
23
|
-
],
|
|
21
|
+
"exclude": ["node_modules"],
|
|
24
22
|
"include": ["src", "src/custom.d.ts"]
|
|
25
|
-
|
|
23
|
+
}
|
package/.storybook/variables.css
DELETED