@universal-tennis/ui-shared 0.0.6 → 0.0.7
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/dist/components.js +1 -0
- package/dist/components.js.map +1 -1
- package/dist/stories/atoms/{Button.d.ts → Button/Button.d.ts} +1 -1
- package/dist/stories/atoms/{Button.js → Button/Button.js} +6 -3
- package/dist/stories/atoms/Button/Button.js.map +1 -0
- package/dist/stories/atoms/{Button.stories.d.ts → Button/Button.stories.d.ts} +2 -1
- package/dist/stories/atoms/{Button.stories.js → Button/Button.stories.js} +6 -1
- package/dist/stories/atoms/Button/Button.stories.js.map +1 -0
- package/dist/stories/atoms/Button/index.d.ts +1 -0
- package/dist/stories/atoms/Button/index.js +2 -0
- package/dist/stories/atoms/Button/index.js.map +1 -0
- package/dist/stories/atoms/Typography/Typography.d.ts +9 -0
- package/dist/stories/atoms/Typography/Typography.js +76 -0
- package/dist/stories/atoms/Typography/Typography.js.map +1 -0
- package/dist/stories/atoms/Typography/Typography.stories.d.ts +37 -0
- package/dist/stories/atoms/Typography/Typography.stories.js +191 -0
- package/dist/stories/atoms/Typography/Typography.stories.js.map +1 -0
- package/dist/stories/atoms/Typography/index.d.ts +1 -0
- package/dist/stories/atoms/Typography/index.js +2 -0
- package/dist/stories/atoms/Typography/index.js.map +1 -0
- package/package.json +1 -1
- package/public/index.html +2 -0
- package/src/components.jsx +1 -0
- package/src/stories/atoms/{Button.stories.tsx → Button/Button.stories.tsx} +7 -1
- package/src/stories/atoms/{Button.tsx → Button/Button.tsx} +18 -4
- package/src/stories/atoms/Button/index.tsx +1 -0
- package/src/stories/atoms/Typography/Typography.stories.tsx +229 -0
- package/src/stories/atoms/Typography/Typography.tsx +113 -0
- package/src/stories/atoms/Typography/index.tsx +1 -0
- package/src/stories/atoms/Typography/typography.css +26 -0
- package/dist/stories/atoms/Button.js.map +0 -1
- package/dist/stories/atoms/Button.stories.js.map +0 -1
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import Typography from './Typography';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
children: string;
|
|
7
|
+
category: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: 'Atoms/Typography',
|
|
12
|
+
component: Typography,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
function Template(args: Props) {
|
|
16
|
+
return <Typography {...args} />;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const Default = Template.bind({});
|
|
20
|
+
Default.args = {
|
|
21
|
+
children: 'Text',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const Display = Template.bind({});
|
|
25
|
+
Display.args = {
|
|
26
|
+
category: "display",
|
|
27
|
+
children: 'Text',
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const DisplayXXXLarge = Template.bind({});
|
|
31
|
+
DisplayXXXLarge.args = {
|
|
32
|
+
children: 'Text',
|
|
33
|
+
category: "display",
|
|
34
|
+
size: 'XXX-large'
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const DisplayXXLarge = Template.bind({});
|
|
38
|
+
DisplayXXLarge.args = {
|
|
39
|
+
children: 'Text',
|
|
40
|
+
category: "display",
|
|
41
|
+
size: 'XX-large'
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const DisplayXLarge = Template.bind({});
|
|
45
|
+
DisplayXLarge.args = {
|
|
46
|
+
children: 'Text',
|
|
47
|
+
category: "display",
|
|
48
|
+
size: 'X-large'
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const DisplayLarge = Template.bind({});
|
|
52
|
+
DisplayLarge.args = {
|
|
53
|
+
children: 'Text',
|
|
54
|
+
category: "display",
|
|
55
|
+
size: 'large'
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const DisplayLargelight = Template.bind({});
|
|
59
|
+
DisplayLargelight.args = {
|
|
60
|
+
children: 'Text',
|
|
61
|
+
category: "display",
|
|
62
|
+
size: 'large-light'
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const DisplayMediumBook = Template.bind({});
|
|
66
|
+
DisplayMediumBook.args = {
|
|
67
|
+
children: 'Text',
|
|
68
|
+
category: "display",
|
|
69
|
+
size: 'medium-book'
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const Primary = Template.bind({});
|
|
73
|
+
Primary.args = {
|
|
74
|
+
category: "primary",
|
|
75
|
+
children: 'Text',
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const PrimaryLargeBold = Template.bind({});
|
|
79
|
+
PrimaryLargeBold.args = {
|
|
80
|
+
children: 'Text',
|
|
81
|
+
category: "primary",
|
|
82
|
+
size: 'large-bold'
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const PrimaryLargeBook = Template.bind({});
|
|
86
|
+
PrimaryLargeBook.args = {
|
|
87
|
+
children: 'Text',
|
|
88
|
+
category: "primary",
|
|
89
|
+
size: 'large-book'
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export const PrimaryLargeLight = Template.bind({});
|
|
93
|
+
PrimaryLargeLight.args = {
|
|
94
|
+
children: 'Text',
|
|
95
|
+
category: "primary",
|
|
96
|
+
size: 'large-light'
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const PrimaryMediumSemiBold = Template.bind({});
|
|
100
|
+
PrimaryMediumSemiBold.args = {
|
|
101
|
+
children: 'Text',
|
|
102
|
+
category: "primary",
|
|
103
|
+
size: 'medium-semibold'
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export const PrimaryMediumMedium = Template.bind({});
|
|
107
|
+
PrimaryMediumMedium.args = {
|
|
108
|
+
children: 'Text',
|
|
109
|
+
category: "primary",
|
|
110
|
+
size: 'medium-medium'
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export const PrimaryMediumBook = Template.bind({});
|
|
114
|
+
PrimaryMediumBook.args = {
|
|
115
|
+
children: 'Text',
|
|
116
|
+
category: "primary",
|
|
117
|
+
size: 'medium-book'
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export const PrimarySmallBook = Template.bind({});
|
|
121
|
+
PrimarySmallBook.args = {
|
|
122
|
+
children: 'Text',
|
|
123
|
+
category: "primary",
|
|
124
|
+
size: 'small-book'
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export const PrimaryXSmallBook = Template.bind({});
|
|
128
|
+
PrimaryXSmallBook.args = {
|
|
129
|
+
children: 'Text',
|
|
130
|
+
category: "primary",
|
|
131
|
+
size: 'x-small-book'
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export const Secondary = Template.bind({});
|
|
135
|
+
Secondary.args = {
|
|
136
|
+
category: "secondary",
|
|
137
|
+
children: 'Text',
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export const SecondaryLargeMedium = Template.bind({});
|
|
141
|
+
SecondaryLargeMedium.args = {
|
|
142
|
+
category: "secondary",
|
|
143
|
+
children: 'Text',
|
|
144
|
+
size: 'large-medium'
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export const SecondaryLargeBook = Template.bind({});
|
|
148
|
+
SecondaryLargeBook.args = {
|
|
149
|
+
category: "secondary",
|
|
150
|
+
children: 'Text',
|
|
151
|
+
size: 'large-book'
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export const SecondaryMediumMedium = Template.bind({});
|
|
155
|
+
SecondaryMediumMedium.args = {
|
|
156
|
+
category: "secondary",
|
|
157
|
+
children: 'Text',
|
|
158
|
+
size: 'medium-medium'
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export const SecondaryMediumBook = Template.bind({});
|
|
162
|
+
SecondaryMediumBook.args = {
|
|
163
|
+
category: "secondary",
|
|
164
|
+
children: 'Text',
|
|
165
|
+
size: 'medium-book'
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
export const SecondarySmallMediumCap = Template.bind({});
|
|
169
|
+
SecondarySmallMediumCap.args = {
|
|
170
|
+
category: "secondary",
|
|
171
|
+
children: 'Text',
|
|
172
|
+
size: 'small-medium-cap'
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export const SecondarySmallMedium = Template.bind({});
|
|
176
|
+
SecondarySmallMedium.args = {
|
|
177
|
+
category: "secondary",
|
|
178
|
+
children: 'Text',
|
|
179
|
+
size: 'small-medium'
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
export const SecondarySmallBook = Template.bind({});
|
|
183
|
+
SecondarySmallBook.args = {
|
|
184
|
+
category: "secondary",
|
|
185
|
+
children: 'Text',
|
|
186
|
+
size: 'small-book'
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export const SecondaryXSmallMediumCap = Template.bind({});
|
|
190
|
+
SecondaryXSmallMediumCap.args = {
|
|
191
|
+
category: "secondary",
|
|
192
|
+
children: 'Text',
|
|
193
|
+
size: 'x-small-medium-cap'
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export const SecondaryXSmallMedium = Template.bind({});
|
|
197
|
+
SecondaryXSmallMedium.args = {
|
|
198
|
+
category: "secondary",
|
|
199
|
+
children: 'Text',
|
|
200
|
+
size: 'x-small-medium'
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
export const SecondaryXSmallBookCap = Template.bind({});
|
|
204
|
+
SecondaryXSmallBookCap.args = {
|
|
205
|
+
category: "secondary",
|
|
206
|
+
children: 'Text',
|
|
207
|
+
size: 'x-small-book-cap'
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
export const SecondaryXSmallBook = Template.bind({});
|
|
211
|
+
SecondaryXSmallBook.args = {
|
|
212
|
+
category: "secondary",
|
|
213
|
+
children: 'Text',
|
|
214
|
+
size: 'x-small-book'
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
export const SecondaryXXSmallMediumCap = Template.bind({});
|
|
218
|
+
SecondaryXXSmallMediumCap.args = {
|
|
219
|
+
category: "secondary",
|
|
220
|
+
children: 'Text',
|
|
221
|
+
size: 'xx-small-medium-cap'
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
export const SecondaryXXSmallBook = Template.bind({});
|
|
225
|
+
SecondaryXXSmallBook.args = {
|
|
226
|
+
category: "secondary",
|
|
227
|
+
children: 'Text',
|
|
228
|
+
size: 'xx-small-book'
|
|
229
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import React, {ReactElement} from 'react';
|
|
2
|
+
import MuiTypography from '@mui/material/Typography';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
import "./typography.css";
|
|
5
|
+
|
|
6
|
+
type TypographyProps = {
|
|
7
|
+
children: string | ReactElement;
|
|
8
|
+
category?: string;
|
|
9
|
+
size?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
type MuiTypographyProps = {
|
|
13
|
+
size?: string;
|
|
14
|
+
isCap?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const DISPLAY_SIZES = {
|
|
18
|
+
"XXX-large": '120px',
|
|
19
|
+
"XX-large": '100px',
|
|
20
|
+
"X-large": '75px',
|
|
21
|
+
large: '50px',
|
|
22
|
+
"large-light": '50px',
|
|
23
|
+
"medium-book": '36px',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const PRIMARY_SIZES = {
|
|
27
|
+
"large-bold": '34px',
|
|
28
|
+
"large-book": '34px',
|
|
29
|
+
"large-light": '34px',
|
|
30
|
+
"medium-semibold": '22px',
|
|
31
|
+
"medium-medium": '22px',
|
|
32
|
+
"medium-book": '22px',
|
|
33
|
+
"small-book": '16px',
|
|
34
|
+
"x-small-book": '12px',
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const SECONDARY_SIZES = {
|
|
38
|
+
"large-medium": '20px',
|
|
39
|
+
"large-book": '20px',
|
|
40
|
+
"medium-medium": '16px',
|
|
41
|
+
"medium-book": '16px',
|
|
42
|
+
"small-medium-cap": '14px',
|
|
43
|
+
"small-medium": '14px',
|
|
44
|
+
"small-book": '14px',
|
|
45
|
+
"x-small-medium-cap": '12px',
|
|
46
|
+
"x-small-medium": '12px',
|
|
47
|
+
"x-small-book-cap": '12px',
|
|
48
|
+
"x-small-book": '12px',
|
|
49
|
+
"xx-small-medium-cap": '10px',
|
|
50
|
+
"xx-small-book": '10px',
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const DisplayTypography = styled(MuiTypography)((props: MuiTypographyProps) => ({
|
|
54
|
+
fontFamily: 'var(--display)',
|
|
55
|
+
fontSize: DISPLAY_SIZES[props.size as keyof typeof DISPLAY_SIZES],
|
|
56
|
+
}));
|
|
57
|
+
|
|
58
|
+
const PrimaryTypography = styled(MuiTypography)((props: MuiTypographyProps) => ({
|
|
59
|
+
fontFamily: 'var(--primary)',
|
|
60
|
+
fontSize: PRIMARY_SIZES[props.size as keyof typeof PRIMARY_SIZES],
|
|
61
|
+
}));
|
|
62
|
+
|
|
63
|
+
const SecondaryTypography = styled(MuiTypography)((props: MuiTypographyProps) => ({
|
|
64
|
+
fontFamily: 'var(--secondary)',
|
|
65
|
+
fontSize: SECONDARY_SIZES[props.size as keyof typeof SECONDARY_SIZES],
|
|
66
|
+
textTransform: props.isCap ? 'uppercase' : 'inherit'
|
|
67
|
+
}));
|
|
68
|
+
|
|
69
|
+
export default function Typography({
|
|
70
|
+
children, category, size, ...props
|
|
71
|
+
}: TypographyProps) {
|
|
72
|
+
const isCap = size?.includes("cap");
|
|
73
|
+
|
|
74
|
+
switch (category) {
|
|
75
|
+
case 'primary':
|
|
76
|
+
return (
|
|
77
|
+
<PrimaryTypography
|
|
78
|
+
size={size}
|
|
79
|
+
{...props}
|
|
80
|
+
>
|
|
81
|
+
{children}
|
|
82
|
+
</PrimaryTypography>
|
|
83
|
+
);
|
|
84
|
+
case 'secondary':
|
|
85
|
+
return (
|
|
86
|
+
<SecondaryTypography
|
|
87
|
+
size={size}
|
|
88
|
+
isCap={isCap}
|
|
89
|
+
{...props}
|
|
90
|
+
>
|
|
91
|
+
{children}
|
|
92
|
+
</SecondaryTypography>
|
|
93
|
+
);
|
|
94
|
+
case 'display':
|
|
95
|
+
return (
|
|
96
|
+
<DisplayTypography
|
|
97
|
+
size={size}
|
|
98
|
+
{...props}
|
|
99
|
+
>
|
|
100
|
+
{children}
|
|
101
|
+
</DisplayTypography>
|
|
102
|
+
);
|
|
103
|
+
default:
|
|
104
|
+
return (
|
|
105
|
+
<PrimaryTypography
|
|
106
|
+
size={size}
|
|
107
|
+
{...props}
|
|
108
|
+
>
|
|
109
|
+
{children}
|
|
110
|
+
</PrimaryTypography>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Typography } from './Typography';
|