@universal-tennis/ui-shared 0.0.25 → 0.1.0

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 (35) hide show
  1. package/.storybook/preview.js +1 -0
  2. package/.storybook/variables.css +12 -0
  3. package/dist/stories/assets/css/variables.css +2 -0
  4. package/dist/stories/molecules/Cards/Cards.stories.d.ts +1 -0
  5. package/dist/stories/molecules/Cards/Cards.stories.js +24 -0
  6. package/dist/stories/molecules/Cards/Cards.stories.js.map +1 -1
  7. package/dist/stories/molecules/Cards/ContactCard.d.ts +1 -7
  8. package/dist/stories/molecules/Cards/ContactCard.js.map +1 -1
  9. package/dist/stories/molecules/Cards/DrawCard.d.ts +3 -0
  10. package/dist/stories/molecules/Cards/DrawCard.js +66 -0
  11. package/dist/stories/molecules/Cards/DrawCard.js.map +1 -0
  12. package/dist/stories/molecules/Cards/TeamCard.d.ts +1 -5
  13. package/dist/stories/molecules/Cards/TeamCard.js.map +1 -1
  14. package/dist/stories/molecules/Cards/sharedTypes.d.ts +27 -0
  15. package/dist/stories/molecules/Cards/sharedTypes.js +3 -0
  16. package/dist/stories/molecules/Cards/sharedTypes.js.map +1 -0
  17. package/dist/stories/organisms/DrawCardTable.d.ts +3 -0
  18. package/dist/stories/organisms/DrawCardTable.js +40 -0
  19. package/dist/stories/organisms/DrawCardTable.js.map +1 -0
  20. package/dist/stories/organisms/Tables.stories.d.ts +5 -0
  21. package/dist/stories/organisms/Tables.stories.js +63 -0
  22. package/dist/stories/organisms/Tables.stories.js.map +1 -0
  23. package/dist/stories/organisms/sharedTypes.d.ts +7 -0
  24. package/dist/stories/organisms/sharedTypes.js +2 -0
  25. package/dist/stories/organisms/sharedTypes.js.map +1 -0
  26. package/package.json +1 -1
  27. package/src/stories/assets/css/variables.css +2 -0
  28. package/src/stories/molecules/Cards/Cards.stories.tsx +30 -13
  29. package/src/stories/molecules/Cards/ContactCard.tsx +1 -7
  30. package/src/stories/molecules/Cards/DrawCard.tsx +102 -0
  31. package/src/stories/molecules/Cards/TeamCard.tsx +1 -5
  32. package/src/stories/molecules/Cards/sharedTypes.ts +32 -0
  33. package/src/stories/organisms/DrawCardTable.tsx +57 -0
  34. package/src/stories/organisms/Tables.stories.tsx +69 -0
  35. package/src/stories/organisms/sharedTypes.ts +8 -0
@@ -1,4 +1,5 @@
1
1
  import "./typography.css";
2
+ import './variables.css';
2
3
 
3
4
  export const parameters = {
4
5
  actions: { argTypesRegex: "^on[A-Z].*" },
@@ -0,0 +1,12 @@
1
+ :root {
2
+ --primary: #008ded;
3
+ --secondary: #e0004f;
4
+ --disabled: #bac6d6;
5
+ --black: #000;
6
+ --white: #fff;
7
+ --light-grey: #d7e0ea;
8
+ --darkest-grey: #3b4859;
9
+ --cool-grey-600: #A7B2C1;
10
+ --cool-grey-300: #DDE3EB;
11
+ --cool-grey-150: #F0F4F9;
12
+ }
@@ -6,5 +6,7 @@
6
6
  --white: #fff;
7
7
  --light-grey: #d7e0ea;
8
8
  --darkest-grey: #3b4859;
9
+ --cool-grey-600: #A7B2C1;
9
10
  --cool-grey-300: #DDE3EB;
11
+ --cool-grey-150: #F0F4F9;
10
12
  }
@@ -4,3 +4,4 @@ declare const _default: {
4
4
  export default _default;
5
5
  export declare const Contact: any;
6
6
  export declare const Team: any;
7
+ export declare const Draw: any;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import ContactCard from './ContactCard';
3
3
  import TeamCard from './TeamCard';
4
+ import DrawCard from './DrawCard';
4
5
  // Default
5
6
  export default {
6
7
  title: 'Molecules/Cards',
@@ -12,6 +13,10 @@ function ContactCardTemplate(args) {
12
13
  function TeamCardTemplate(args) {
13
14
  return React.createElement(TeamCard, Object.assign({}, args));
14
15
  }
16
+ function DrawCardTemplate(args) {
17
+ return (React.createElement("div", { style: { width: '372px' } },
18
+ React.createElement(DrawCard, Object.assign({}, args))));
19
+ }
15
20
  // Stories
16
21
  export const Contact = ContactCardTemplate.bind({});
17
22
  Contact.args = {
@@ -24,4 +29,23 @@ Team.args = {
24
29
  title: 'team 1',
25
30
  description: 'Captained by Lenny McDowell, Josh Palmer, and Michael Ballast. Requires a passcode for registration.'
26
31
  };
32
+ export const Draw = DrawCardTemplate.bind({});
33
+ Draw.args = {
34
+ choices: [
35
+ {
36
+ id: 1,
37
+ label: 'Team 1',
38
+ },
39
+ {
40
+ id: 2,
41
+ label: 'Team 2',
42
+ }
43
+ ],
44
+ selectedTeams: {
45
+ teamOne: 1,
46
+ teamTwo: 2,
47
+ },
48
+ dateLabel: 'Dec 20 at 9:00am',
49
+ locationLabel: 'Taube Tennis Center',
50
+ };
27
51
  //# sourceMappingURL=Cards.stories.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Cards.stories.js","sourceRoot":"","sources":["../../../../src/stories/molecules/Cards/Cards.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAelC,UAAU;AACV,eAAe;IACb,KAAK,EAAE,iBAAiB;CACzB,CAAC;AAEF,YAAY;AACZ,SAAS,mBAAmB,CAAC,IAAsB;IACjD,OAAO,oBAAC,WAAW,oBAAK,IAAI,EAAI,CAAC;AACnC,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAmB;IAC3C,OAAO,oBAAC,QAAQ,oBAAK,IAAI,EAAI,CAAC;AAChC,CAAC;AAED,UAAU;AACV,MAAM,CAAC,MAAM,OAAO,GAAG,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACpD,OAAO,CAAC,IAAI,GAAG;IACb,IAAI,EAAE,gBAAgB;IACtB,KAAK,EAAE,iBAAiB;IACxB,KAAK,EAAE,iBAAiB;CACzB,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC9C,IAAI,CAAC,IAAI,GAAG;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G;IACV,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,OAAO,EAAE,CAAC;KACX;IACD,SAAS,EAAE,kBAAkB;IAC7B,aAAa,EAAE,qBAAqB;CACrC,CAAC"}
@@ -1,9 +1,3 @@
1
1
  /// <reference types="react" />
2
- type ContactCardProps = {
3
- name: string;
4
- phone: string;
5
- email: string;
6
- onMessageClick?: VoidFunction;
7
- };
2
+ import { ContactCardProps } from './sharedTypes';
8
3
  export default function ContactCard({ name, phone, email, onMessageClick, ...props }: ContactCardProps): JSX.Element;
9
- export {};
@@ -1 +1 @@
1
- {"version":3,"file":"ContactCard.js","sourceRoot":"","sources":["../../../../src/stories/molecules/Cards/ContactCard.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,gBAAgB,MAAM,mBAAmB,CAAC;AACjD,OAAO,sBAAsB,MAAM,wCAAwC,CAAC;AAC5E,OAAO,iBAAiB,MAAM,mCAAmC,CAAC;AAClE,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAC/C,OAAO,UAAU,MAAM,mCAAmC,CAAC;AAC3D,OAAO,QAAQ,MAAM,iCAAiC,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAStC,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAEjB;QAFiB,EAClC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,cAAc,OACjB,EADsB,KAAK,cADV,4CAEnC,CAD6C;IAE5C,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACrC,MAAM,YAAY,GAAG,gBAAgB,CA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Props } from "./sharedTypes";
3
+ export default function DrawCard({ choices, onChange, onEditClick, selectedTeams, dateLabel, locationLabel, ...props }: DrawCardProps): JSX.Element;
@@ -0,0 +1,66 @@
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
@@ -0,0 +1 @@
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;IACvB,YAAY,EAAE,KAAK;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AC,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,7 +1,3 @@
1
1
  /// <reference types="react" />
2
- type TeamCardProps = {
3
- title: string;
4
- description: string;
5
- };
2
+ import { TeamCardProps } from './sharedTypes';
6
3
  export default function TeamCard({ title, description, ...props }: TeamCardProps): JSX.Element;
7
- export {};
@@ -1 +1 @@
1
- {"version":3,"file":"TeamCard.js","sourceRoot":"","sources":["../../../../src/stories/molecules/Cards/TeamCard.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,UAAU,MAAM,mCAAmC,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAOtC,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAA+C;QAA/C,EAAE,KAAK,EAAE,WAAW,OAA2B,EAAtB,KAAK,cAA9B,wBAAgC,CAAF;IAC7D,OAAO,CACH,oBAAC,UAAU,oBACL,KAAK;QAET,oBAAC,UAAU,IAAC,QAAQ,EAAC,WAAW,EAAC,IAAI,EAAC,eAAe,IAAE,KAAK,CAAc;QAC1E,oBAAC,UAAU,IAAC,QAAQ,EAAC,WAAW,EAAC,IAAI,EAAC,cAAc,IAAE,WAAW,CAAc,CACpE,CAChB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"TeamCard.js","sourceRoot":"","sources":["../../../../src/stories/molecules/Cards/TeamCard.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,UAAU,MAAM,mCAAmC,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGtC,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAA+C;QAA/C,EAAE,KAAK,EAAE,WAAW,OAA2B,EAAtB,KAAK,cAA9B,wBAAgC,CAAF;IAC7D,OAAO,CACH,oBAAC,UAAU,oBACL,KAAK;QAET,oBAAC,UAAU,IAAC,QAAQ,EAAC,WAAW,EAAC,IAAI,EAAC,eAAe,IAAE,KAAK,CAAc;QAC1E,oBAAC,UAAU,IAAC,QAAQ,EAAC,WAAW,EAAC,IAAI,EAAC,cAAc,IAAE,WAAW,CAAc,CACpE,CAChB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,27 @@
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 {};
@@ -0,0 +1,3 @@
1
+ // Card types
2
+ export {};
3
+ //# sourceMappingURL=sharedTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sharedTypes.js","sourceRoot":"","sources":["../../../../src/stories/molecules/Cards/sharedTypes.ts"],"names":[],"mappings":"AAAA,aAAa"}
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { DrawCardTableProps } from './sharedTypes';
3
+ export default function DrawCardTable({ headerRows, tableRows, ...props }: DrawCardTableProps): JSX.Element;
@@ -0,0 +1,40 @@
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
@@ -0,0 +1 @@
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,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,C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0,0 +1,63 @@
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
@@ -0,0 +1 @@
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,OAAO,EAAE,CAAC;KACX;IACD,SAAS,EAAE,kBAAkB;IAC7B,aAAa,EAAE,qBAAqB;CACrC,CAAC;AAEF,UAAU;AACV,eAAe;IACb,KAAK,EAAE,kBAAkB;CAC1B,CAAC;AAEF,YAAY;AACZ,SAAS,qBAAqB,CAAC,IAAwB;IACrD,OAAO,oBAAC,aAAa,oBAAK,IAAI,EAAI,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,GAAG;IACjB,EAAC,IAAI,EAAE,SAAS,EAAE;IAClB,EAAC,IAAI,EAAE,cAAc,EAAE;IACvB,EAAC,IAAI,EAAE,WAAW,EAAE;CACrB,CAAC;AAEF,MAAM,SAAS,GAAG;IAChB;QACI,oBAAC,QAAQ,oBAAK,gBAAgB,EAAI;QAClC,oBAAC,QAAQ,oBAAK,gBAAgB,EAAI;QAClC,oBAAC,QAAQ,oBAAK,gBAAgB,EAAI;QAClC,oBAAC,QAAQ,oBAAK,gBAAgB,EAAI;QAClC,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;QAClC,oBAAC,QAAQ,oBAAK,gBAAgB,EAAI;QAClC,oBAAC,QAAQ,oBAAK,gBAAgB,EAAI;KACrC;IACD;QACM,oBAAC,QAAQ,oBAAK,gBAAgB,EAAI;QAClC,oBAAC,QAAQ,oBAAK,gBAAgB,EAAI;KACvC;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"}
@@ -0,0 +1,7 @@
1
+ import { ReactNode } from 'react';
2
+ export type DrawCardTableProps = {
3
+ headerRows: {
4
+ name: string;
5
+ }[];
6
+ tableRows: ReactNode[][];
7
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sharedTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sharedTypes.js","sourceRoot":"","sources":["../../../src/stories/organisms/sharedTypes.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@universal-tennis/ui-shared",
3
- "version": "0.0.25",
3
+ "version": "0.1.0",
4
4
  "main": "dist/items.js",
5
5
  "license": "MIT",
6
6
  "homepage": "https://universaltennis.com",
@@ -6,5 +6,7 @@
6
6
  --white: #fff;
7
7
  --light-grey: #d7e0ea;
8
8
  --darkest-grey: #3b4859;
9
+ --cool-grey-600: #A7B2C1;
9
10
  --cool-grey-300: #DDE3EB;
11
+ --cool-grey-150: #F0F4F9;
10
12
  }
@@ -2,19 +2,8 @@ import React from 'react';
2
2
 
3
3
  import ContactCard from './ContactCard';
4
4
  import TeamCard from './TeamCard';
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
- }
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
+ 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,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,102 @@
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
+ }
@@ -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,32 @@
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
+ }
@@ -0,0 +1,57 @@
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
+ }
@@ -0,0 +1,69 @@
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
+ };
@@ -0,0 +1,8 @@
1
+ import React, { ReactNode } from 'react';
2
+
3
+ export type DrawCardTableProps = {
4
+ headerRows: {
5
+ name: string;
6
+ }[],
7
+ tableRows: ReactNode[][];
8
+ }