@universal-tennis/ui-shared 0.0.5 → 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/App.d.ts +2 -2
- package/dist/App.js +12 -10
- package/dist/App.js.map +1 -1
- package/dist/components.d.ts +1 -0
- package/dist/components.js +5 -1
- package/dist/components.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +12 -12
- package/dist/items.d.ts +2 -2
- package/dist/items.js +1 -1
- package/dist/stories/atoms/Button/Button.d.ts +7 -0
- package/dist/stories/atoms/Button/Button.js +61 -0
- package/dist/stories/atoms/Button/Button.js.map +1 -0
- package/dist/stories/atoms/{Button.stories.d.ts → Button/Button.stories.d.ts} +15 -13
- package/dist/stories/atoms/Button/Button.stories.js +32 -0
- 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 +86 -86
- package/public/index.html +2 -0
- package/src/components.jsx +1 -0
- package/src/custom.d.ts +13 -13
- package/src/items.jsx +1 -1
- 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/tsconfig.json +24 -24
- package/workflows/package-release-1.yml +32 -32
- package/dist/stories/Button.d.ts +0 -27
- package/dist/stories/Button.js +0 -51
- package/dist/stories/Button.js.map +0 -1
- package/dist/stories/Button.stories.d.ts +0 -15
- package/dist/stories/Button.stories.js +0 -34
- package/dist/stories/Button.stories.js.map +0 -1
- package/dist/stories/Header.d.ts +0 -19
- package/dist/stories/Header.js +0 -31
- package/dist/stories/Header.js.map +0 -1
- package/dist/stories/Header.stories.d.ts +0 -11
- package/dist/stories/Header.stories.js +0 -20
- package/dist/stories/Header.stories.js.map +0 -1
- package/dist/stories/Page.d.ts +0 -1
- package/dist/stories/Page.js +0 -38
- package/dist/stories/Page.js.map +0 -1
- package/dist/stories/Page.stories.d.ts +0 -11
- package/dist/stories/Page.stories.js +0 -30
- package/dist/stories/Page.stories.js.map +0 -1
- package/dist/stories/assets/comments.svg +0 -1
- package/dist/stories/assets/direction.svg +0 -1
- package/dist/stories/atoms/Button.d.ts +0 -7
- package/dist/stories/atoms/Button.js +0 -20
- package/dist/stories/atoms/Button.js.map +0 -1
- package/dist/stories/atoms/Button.stories.js +0 -22
- package/dist/stories/atoms/Button.stories.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@universal-tennis/ui-shared",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"main": "dist/items.js",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"homepage": "https://universaltennis.com",
|
|
7
|
-
"dependencies": {
|
|
8
|
-
"@emotion/react": "^11.10.5",
|
|
9
|
-
"@emotion/styled": "^11.10.5",
|
|
10
|
-
"@mui/material": "^5.10.15",
|
|
11
|
-
"copyfiles": "^2.4.1",
|
|
12
|
-
"cross-env": "^7.0.3",
|
|
13
|
-
"react": "^18.2.0",
|
|
14
|
-
"react-dom": "^18.2.0",
|
|
15
|
-
"react-scripts": "5.0.1",
|
|
16
|
-
"typescript": "^4.9.3",
|
|
17
|
-
"web-vitals": "^2.1.4"
|
|
18
|
-
},
|
|
19
|
-
"scripts": {
|
|
20
|
-
"start": "start-storybook -p 6006 -s public",
|
|
21
|
-
"build-storybook": "build-storybook -s public",
|
|
22
|
-
"publish:npm": "tsc && yarn copy-files",
|
|
23
|
-
"publish-package": "npm publish --access public",
|
|
24
|
-
"copy-files": "copyfiles -u 1 src/stories/assets/*.svg src/stories/assets/*.png src/stories/assets/*.gif src/stories/assets/css/*.css dist/",
|
|
25
|
-
"eslint": "npx eslint --ext .jsx,.js src --fix"
|
|
26
|
-
},
|
|
27
|
-
"eslintConfig": {
|
|
28
|
-
"extends": [
|
|
29
|
-
"react-app",
|
|
30
|
-
"react-app/jest"
|
|
31
|
-
],
|
|
32
|
-
"overrides": [
|
|
33
|
-
{
|
|
34
|
-
"files": [
|
|
35
|
-
"**/*.stories.*"
|
|
36
|
-
],
|
|
37
|
-
"rules": {
|
|
38
|
-
"import/no-anonymous-default-export": "off"
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
]
|
|
42
|
-
},
|
|
43
|
-
"browserslist": {
|
|
44
|
-
"production": [
|
|
45
|
-
">0.2%",
|
|
46
|
-
"not dead",
|
|
47
|
-
"not op_mini all"
|
|
48
|
-
],
|
|
49
|
-
"development": [
|
|
50
|
-
"last 1 chrome version",
|
|
51
|
-
"last 1 firefox version",
|
|
52
|
-
"last 1 safari version"
|
|
53
|
-
]
|
|
54
|
-
},
|
|
55
|
-
"devDependencies": {
|
|
56
|
-
"@storybook/addon-actions": "^6.5.13",
|
|
57
|
-
"@storybook/addon-essentials": "^6.5.13",
|
|
58
|
-
"@storybook/addon-interactions": "^6.5.13",
|
|
59
|
-
"@storybook/addon-links": "^6.5.13",
|
|
60
|
-
"@storybook/builder-webpack5": "^6.5.13",
|
|
61
|
-
"@storybook/manager-webpack5": "^6.5.13",
|
|
62
|
-
"@storybook/node-logger": "^6.5.13",
|
|
63
|
-
"@storybook/preset-create-react-app": "^4.1.2",
|
|
64
|
-
"@storybook/react": "^6.5.13",
|
|
65
|
-
"@storybook/testing-library": "^0.0.13",
|
|
66
|
-
"@types/babel__core": "^7.1.20",
|
|
67
|
-
"@types/react": "^18.0.25",
|
|
68
|
-
"babel-plugin-named-exports-order": "^0.0.2",
|
|
69
|
-
"eslint": "^8.28.0",
|
|
70
|
-
"eslint-config-airbnb": "^19.0.4",
|
|
71
|
-
"eslint-import-resolver-typescript": "^3.5.2",
|
|
72
|
-
"eslint-plugin-import": "^2.25.3",
|
|
73
|
-
"eslint-plugin-jsx-a11y": "^6.5.1",
|
|
74
|
-
"eslint-plugin-react": "^7.28.0",
|
|
75
|
-
"eslint-plugin-react-hooks": "^4.3.0",
|
|
76
|
-
"eslint-plugin-storybook": "^0.6.7",
|
|
77
|
-
"prop-types": "^15.8.1",
|
|
78
|
-
"webpack": "^5.75.0"
|
|
79
|
-
},
|
|
80
|
-
"description": "Shared UI components for UT",
|
|
81
|
-
"repository": {
|
|
82
|
-
"type": "git",
|
|
83
|
-
"url": "git+https://bitbucket.org/universaltennis/ui-shared.git"
|
|
84
|
-
},
|
|
85
|
-
"author": "universal-tennis"
|
|
86
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@universal-tennis/ui-shared",
|
|
3
|
+
"version": "0.0.7",
|
|
4
|
+
"main": "dist/items.js",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://universaltennis.com",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@emotion/react": "^11.10.5",
|
|
9
|
+
"@emotion/styled": "^11.10.5",
|
|
10
|
+
"@mui/material": "^5.10.15",
|
|
11
|
+
"copyfiles": "^2.4.1",
|
|
12
|
+
"cross-env": "^7.0.3",
|
|
13
|
+
"react": "^18.2.0",
|
|
14
|
+
"react-dom": "^18.2.0",
|
|
15
|
+
"react-scripts": "5.0.1",
|
|
16
|
+
"typescript": "^4.9.3",
|
|
17
|
+
"web-vitals": "^2.1.4"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"start": "start-storybook -p 6006 -s public",
|
|
21
|
+
"build-storybook": "build-storybook -s public",
|
|
22
|
+
"publish:npm": "tsc && yarn copy-files",
|
|
23
|
+
"publish-package": "npm publish --access public",
|
|
24
|
+
"copy-files": "copyfiles -u 1 src/stories/assets/*.svg src/stories/assets/*.png src/stories/assets/*.gif src/stories/assets/css/*.css dist/",
|
|
25
|
+
"eslint": "npx eslint --ext .jsx,.js src --fix"
|
|
26
|
+
},
|
|
27
|
+
"eslintConfig": {
|
|
28
|
+
"extends": [
|
|
29
|
+
"react-app",
|
|
30
|
+
"react-app/jest"
|
|
31
|
+
],
|
|
32
|
+
"overrides": [
|
|
33
|
+
{
|
|
34
|
+
"files": [
|
|
35
|
+
"**/*.stories.*"
|
|
36
|
+
],
|
|
37
|
+
"rules": {
|
|
38
|
+
"import/no-anonymous-default-export": "off"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"browserslist": {
|
|
44
|
+
"production": [
|
|
45
|
+
">0.2%",
|
|
46
|
+
"not dead",
|
|
47
|
+
"not op_mini all"
|
|
48
|
+
],
|
|
49
|
+
"development": [
|
|
50
|
+
"last 1 chrome version",
|
|
51
|
+
"last 1 firefox version",
|
|
52
|
+
"last 1 safari version"
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@storybook/addon-actions": "^6.5.13",
|
|
57
|
+
"@storybook/addon-essentials": "^6.5.13",
|
|
58
|
+
"@storybook/addon-interactions": "^6.5.13",
|
|
59
|
+
"@storybook/addon-links": "^6.5.13",
|
|
60
|
+
"@storybook/builder-webpack5": "^6.5.13",
|
|
61
|
+
"@storybook/manager-webpack5": "^6.5.13",
|
|
62
|
+
"@storybook/node-logger": "^6.5.13",
|
|
63
|
+
"@storybook/preset-create-react-app": "^4.1.2",
|
|
64
|
+
"@storybook/react": "^6.5.13",
|
|
65
|
+
"@storybook/testing-library": "^0.0.13",
|
|
66
|
+
"@types/babel__core": "^7.1.20",
|
|
67
|
+
"@types/react": "^18.0.25",
|
|
68
|
+
"babel-plugin-named-exports-order": "^0.0.2",
|
|
69
|
+
"eslint": "^8.28.0",
|
|
70
|
+
"eslint-config-airbnb": "^19.0.4",
|
|
71
|
+
"eslint-import-resolver-typescript": "^3.5.2",
|
|
72
|
+
"eslint-plugin-import": "^2.25.3",
|
|
73
|
+
"eslint-plugin-jsx-a11y": "^6.5.1",
|
|
74
|
+
"eslint-plugin-react": "^7.28.0",
|
|
75
|
+
"eslint-plugin-react-hooks": "^4.3.0",
|
|
76
|
+
"eslint-plugin-storybook": "^0.6.7",
|
|
77
|
+
"prop-types": "^15.8.1",
|
|
78
|
+
"webpack": "^5.75.0"
|
|
79
|
+
},
|
|
80
|
+
"description": "Shared UI components for UT",
|
|
81
|
+
"repository": {
|
|
82
|
+
"type": "git",
|
|
83
|
+
"url": "git+https://bitbucket.org/universaltennis/ui-shared.git"
|
|
84
|
+
},
|
|
85
|
+
"author": "universal-tennis"
|
|
86
|
+
}
|
package/public/index.html
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
content="Web site created using create-react-app"
|
|
11
11
|
/>
|
|
12
12
|
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
|
13
|
+
<link rel="stylesheet" type="text/css" href="https://cloud.typography.com/6323816/6761592/css/fonts.css" />
|
|
14
|
+
|
|
13
15
|
<!--
|
|
14
16
|
manifest.json provides metadata used when your web app is installed on a
|
|
15
17
|
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
package/src/components.jsx
CHANGED
package/src/custom.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
declare module '*.jpg';
|
|
2
|
-
declare module '*.png';
|
|
3
|
-
declare module '*.woff2';
|
|
4
|
-
declare module '*.woff';
|
|
5
|
-
declare module '*.ttf';
|
|
6
|
-
|
|
7
|
-
declare module '*.svg' {
|
|
8
|
-
import React = require('react');
|
|
9
|
-
|
|
10
|
-
export const ReactComponent: React.SFC<React.SVGProps<SVGSVGElement>>;
|
|
11
|
-
const src: string;
|
|
12
|
-
export default src;
|
|
13
|
-
}
|
|
1
|
+
declare module '*.jpg';
|
|
2
|
+
declare module '*.png';
|
|
3
|
+
declare module '*.woff2';
|
|
4
|
+
declare module '*.woff';
|
|
5
|
+
declare module '*.ttf';
|
|
6
|
+
|
|
7
|
+
declare module '*.svg' {
|
|
8
|
+
import React = require('react');
|
|
9
|
+
|
|
10
|
+
export const ReactComponent: React.SFC<React.SVGProps<SVGSVGElement>>;
|
|
11
|
+
const src: string;
|
|
12
|
+
export default src;
|
|
13
|
+
}
|
package/src/items.jsx
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = require('./components');
|
|
1
|
+
module.exports = require('./components');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import Button from './Button';
|
|
4
4
|
|
|
5
5
|
interface Props {
|
|
6
6
|
children: string;
|
|
@@ -25,6 +25,12 @@ Primary.args = {
|
|
|
25
25
|
children: 'Button',
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
+
export const PrimaryExpanded = Template.bind({});
|
|
29
|
+
PrimaryExpanded.args = {
|
|
30
|
+
category: "primary-expanded",
|
|
31
|
+
children: 'Button',
|
|
32
|
+
};
|
|
33
|
+
|
|
28
34
|
export const Secondary = Template.bind({});
|
|
29
35
|
Secondary.args = {
|
|
30
36
|
category: "secondary",
|
|
@@ -7,6 +7,10 @@ type ButtonProps = {
|
|
|
7
7
|
category?: string;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
type StyledButtonProps = {
|
|
11
|
+
isExpanded?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
const StyledButton = styled(MuiButton)({
|
|
11
15
|
borderRadius: '24px',
|
|
12
16
|
fontSize: '12px',
|
|
@@ -17,10 +21,11 @@ const StyledButton = styled(MuiButton)({
|
|
|
17
21
|
border: '1px solid transparent'
|
|
18
22
|
});
|
|
19
23
|
|
|
20
|
-
const PrimaryButton = styled(StyledButton)({
|
|
24
|
+
const PrimaryButton = styled(StyledButton)((props: StyledButtonProps) => ({
|
|
21
25
|
backgroundColor: 'var(--black)',
|
|
22
26
|
color: 'var(--white)',
|
|
23
|
-
|
|
27
|
+
width: props.isExpanded ? '100%' : 'inherit',
|
|
28
|
+
|
|
24
29
|
'&:hover': {
|
|
25
30
|
backgroundColor: 'var(--darkest-grey)',
|
|
26
31
|
borderColor: 'var(--darkest-grey)',
|
|
@@ -29,7 +34,7 @@ const PrimaryButton = styled(StyledButton)({
|
|
|
29
34
|
backgroundColor: 'var(--lightest-grey)',
|
|
30
35
|
borderColor: 'var(--lightest-grey)',
|
|
31
36
|
},
|
|
32
|
-
});
|
|
37
|
+
}));
|
|
33
38
|
|
|
34
39
|
const SecondaryButton = styled(StyledButton)({
|
|
35
40
|
borderColor: 'var(--black)',
|
|
@@ -44,7 +49,7 @@ const SecondaryButton = styled(StyledButton)({
|
|
|
44
49
|
},
|
|
45
50
|
});
|
|
46
51
|
|
|
47
|
-
export function Button({ children, category, ...props }: ButtonProps) {
|
|
52
|
+
export default function Button({ children, category, ...props }: ButtonProps) {
|
|
48
53
|
switch (category) {
|
|
49
54
|
case 'primary':
|
|
50
55
|
return (
|
|
@@ -54,6 +59,15 @@ export function Button({ children, category, ...props }: ButtonProps) {
|
|
|
54
59
|
{children}
|
|
55
60
|
</PrimaryButton>
|
|
56
61
|
);
|
|
62
|
+
case 'primary-expanded':
|
|
63
|
+
return (
|
|
64
|
+
<PrimaryButton
|
|
65
|
+
isExpanded
|
|
66
|
+
{...props}
|
|
67
|
+
>
|
|
68
|
+
{children}
|
|
69
|
+
</PrimaryButton>
|
|
70
|
+
);
|
|
57
71
|
case 'secondary':
|
|
58
72
|
return (
|
|
59
73
|
<SecondaryButton
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Button } from './Button';
|
|
@@ -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';
|