beyond-system 0.1.0 → 0.1.2
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/package.json +16 -1
- package/.auto-changelog +0 -10
- package/.editorconfig +0 -9
- package/.eslintrc.js +0 -74
- package/.storybook/growth-theme.js +0 -23
- package/.storybook/main.js +0 -21
- package/.storybook/manager.js +0 -7
- package/.storybook/preview-head.html +0 -13
- package/.storybook/preview.js +0 -29
- package/README.md +0 -38
- package/changelog-template.hbs +0 -19
- package/next.config.js +0 -6
- package/prettier.config.js +0 -5
- package/public/favicon.ico +0 -0
- package/public/next.svg +0 -1
- package/public/thirteen.svg +0 -1
- package/public/vercel.svg +0 -1
- package/setup.js +0 -15
- package/src/colors/base-colors.ts +0 -75
- package/src/colors/gradients.ts +0 -9
- package/src/colors/index.ts +0 -3
- package/src/colors/shadows.ts +0 -9
- package/src/components/react/Checkbox/Checkbox.stories.tsx +0 -59
- package/src/components/react/Checkbox/Checkbox.styles.ts +0 -84
- package/src/components/react/Checkbox/Checkbox.tsx +0 -33
- package/src/components/react/Checkbox/Checkbox.variants.ts +0 -27
- package/src/components/react/DefaultButton/DefaultButton.stories.tsx +0 -98
- package/src/components/react/DefaultButton/DefaultButton.styles.ts +0 -106
- package/src/components/react/DefaultButton/DefaultButton.tsx +0 -67
- package/src/components/react/DefaultButton/DefaultButton.variants.ts +0 -49
- package/src/components/react/IconButton/IconButton.stories.tsx +0 -71
- package/src/components/react/IconButton/IconButton.styles.ts +0 -98
- package/src/components/react/IconButton/IconButton.tsx +0 -55
- package/src/components/react/IconButton/IconButton.variants.ts +0 -40
- package/src/components/react/Loader/Loader.stories.tsx +0 -36
- package/src/components/react/Loader/Loader.tsx +0 -40
- package/src/components/react/Loader/index.tsx +0 -1
- package/src/components/react/OutlineButton/OutlineButton.stories.tsx +0 -98
- package/src/components/react/OutlineButton/OutlineButton.styles.ts +0 -97
- package/src/components/react/OutlineButton/OutlineButton.tsx +0 -67
- package/src/components/react/OutlineButton/OutlineButton.variants.ts +0 -40
- package/src/components/react/RadioInput/RadioInput.stories.tsx +0 -53
- package/src/components/react/RadioInput/RadioInput.styles.ts +0 -69
- package/src/components/react/RadioInput/RadioInput.tsx +0 -23
- package/src/components/react/RadioInput/RadioInput.variants.ts +0 -23
- package/src/components/react/Switch/Switch.stories.tsx +0 -53
- package/src/components/react/Switch/Switch.styles.ts +0 -60
- package/src/components/react/Switch/Switch.tsx +0 -28
- package/src/components/react/Switch/Switch.variants.ts +0 -19
- package/src/components/react/TransparentButton/TransparentButton.stories.tsx +0 -53
- package/src/components/react/TransparentButton/TransparentButton.styles.ts +0 -74
- package/src/components/react/TransparentButton/TransparentButton.tsx +0 -41
- package/src/components/react/TransparentButton/TransparentButton.variants.ts +0 -35
- package/src/stories/base-colors/base-colors.stories.styles.ts +0 -65
- package/src/stories/base-colors/base-colors.stories.tsx +0 -89
- package/src/stories/gradients/gradients.stories.styles.ts +0 -60
- package/src/stories/gradients/gradients.stories.tsx +0 -39
- package/src/stories/shadows/shadows.stories.styles.ts +0 -59
- package/src/stories/shadows/shadows.stories.tsx +0 -37
- package/src/web/border.ts +0 -13
- package/src/web/font.ts +0 -38
- package/src/web/index.ts +0 -2
- package/tsconfig.json +0 -24
- package/vercel.json +0 -8
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import styled from 'styled-components'
|
|
3
|
-
import { Meta } from '@storybook/react/types-6-0'
|
|
4
|
-
import { MdCheck } from 'react-icons/md'
|
|
5
|
-
|
|
6
|
-
import ButtonComponent from './DefaultButton'
|
|
7
|
-
import { DEFAULT_BUTTON_VARIANTS } from './DefaultButton.variants'
|
|
8
|
-
|
|
9
|
-
type Props = React.ComponentProps<typeof ButtonComponent>
|
|
10
|
-
|
|
11
|
-
const Container = styled.div`
|
|
12
|
-
display: flex;
|
|
13
|
-
flex-direction: column;
|
|
14
|
-
align-items: flex-start;
|
|
15
|
-
gap: 1rem;
|
|
16
|
-
`
|
|
17
|
-
|
|
18
|
-
export const DefaultButton = (props: Props) => {
|
|
19
|
-
return (
|
|
20
|
-
<Container>
|
|
21
|
-
<ButtonComponent {...props} />
|
|
22
|
-
<ButtonComponent {...props} leftIcon={<MdCheck />} />
|
|
23
|
-
<ButtonComponent {...props} rightIcon={<MdCheck />} />
|
|
24
|
-
<ButtonComponent
|
|
25
|
-
{...props}
|
|
26
|
-
leftIcon={<MdCheck />}
|
|
27
|
-
rightIcon={<MdCheck />}
|
|
28
|
-
/>
|
|
29
|
-
</Container>
|
|
30
|
-
)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export default {
|
|
34
|
-
title: 'Buttons/DefaultButton',
|
|
35
|
-
parameters: {
|
|
36
|
-
component: DefaultButton,
|
|
37
|
-
},
|
|
38
|
-
args: {
|
|
39
|
-
text: 'Button',
|
|
40
|
-
variant: 'primary',
|
|
41
|
-
size: 'MD',
|
|
42
|
-
shape: 'square',
|
|
43
|
-
fullWidth: false,
|
|
44
|
-
disabled: false,
|
|
45
|
-
loading: false,
|
|
46
|
-
},
|
|
47
|
-
argTypes: {
|
|
48
|
-
text: {
|
|
49
|
-
control: {
|
|
50
|
-
type: 'text',
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
leftIcon: {
|
|
54
|
-
control: {},
|
|
55
|
-
},
|
|
56
|
-
rightIcon: {
|
|
57
|
-
control: {},
|
|
58
|
-
},
|
|
59
|
-
variant: {
|
|
60
|
-
control: {
|
|
61
|
-
type: 'select',
|
|
62
|
-
options: Object.keys(DEFAULT_BUTTON_VARIANTS.color),
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
size: {
|
|
66
|
-
control: {
|
|
67
|
-
type: 'select',
|
|
68
|
-
options: Object.keys(DEFAULT_BUTTON_VARIANTS.size),
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
shape: {
|
|
72
|
-
control: {
|
|
73
|
-
type: 'select',
|
|
74
|
-
options: Object.keys(DEFAULT_BUTTON_VARIANTS.shape),
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
loading: {
|
|
78
|
-
control: {
|
|
79
|
-
type: 'boolean',
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
fullWidth: {
|
|
83
|
-
control: {
|
|
84
|
-
type: 'boolean',
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
disabled: {
|
|
88
|
-
control: {
|
|
89
|
-
type: 'boolean',
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
onClick: {
|
|
93
|
-
control: {
|
|
94
|
-
action: 'clicked',
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
} as Meta
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components'
|
|
2
|
-
import { COLORS, SHADOWS } from '@/colors'
|
|
3
|
-
|
|
4
|
-
type StyledButtonProps = {
|
|
5
|
-
padding: string
|
|
6
|
-
color: string
|
|
7
|
-
backgroundColor: string
|
|
8
|
-
borderRadius: string
|
|
9
|
-
borderColor: string
|
|
10
|
-
fontSize: string
|
|
11
|
-
gap: string
|
|
12
|
-
hoverBackgroundColor: string
|
|
13
|
-
activeBackgroundColor: string
|
|
14
|
-
fullWidth: boolean
|
|
15
|
-
loading: boolean
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const StyledButtonContainer = styled.button<StyledButtonProps>`
|
|
19
|
-
all: unset;
|
|
20
|
-
position: relative;
|
|
21
|
-
|
|
22
|
-
display: flex;
|
|
23
|
-
flex-direction: row;
|
|
24
|
-
|
|
25
|
-
align-items: center;
|
|
26
|
-
justify-content: center;
|
|
27
|
-
|
|
28
|
-
width: ${(props) => (props.fullWidth ? '100%' : 'auto')};
|
|
29
|
-
|
|
30
|
-
transition: 0.05s ease-in-out;
|
|
31
|
-
|
|
32
|
-
padding: ${(props) => props.padding};
|
|
33
|
-
gap: ${(props) => props.gap};
|
|
34
|
-
|
|
35
|
-
color: ${(props) => props.color};
|
|
36
|
-
font-size: ${(props) => props.fontSize};
|
|
37
|
-
font-weight: 600;
|
|
38
|
-
|
|
39
|
-
.default-btn-icon {
|
|
40
|
-
display: flex;
|
|
41
|
-
align-items: center;
|
|
42
|
-
font-size: ${(props) => props.fontSize};
|
|
43
|
-
opacity: ${(props) => (props.loading ? 0 : 1)};
|
|
44
|
-
|
|
45
|
-
* {
|
|
46
|
-
color: ${(props) => props.color};
|
|
47
|
-
font-size: ${(props) => props.fontSize};
|
|
48
|
-
font-weight: 600;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.default-btn-text {
|
|
53
|
-
opacity: ${(props) => (props.loading ? 0 : 1)};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.default-btn-loader {
|
|
57
|
-
position: absolute;
|
|
58
|
-
display: flex;
|
|
59
|
-
align-items: center;
|
|
60
|
-
justify-content: center;
|
|
61
|
-
height: 100%;
|
|
62
|
-
width: 100%;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
background-color: ${(props) => props.backgroundColor};
|
|
66
|
-
border: 1px solid ${(props) => props.borderColor};
|
|
67
|
-
border-radius: ${(props) => props.borderRadius};
|
|
68
|
-
|
|
69
|
-
padding: ${(props) => props.padding};
|
|
70
|
-
|
|
71
|
-
pointer-events: ${(props) => (props.loading ? 'none' : 'auto')};
|
|
72
|
-
|
|
73
|
-
:hover {
|
|
74
|
-
cursor: pointer;
|
|
75
|
-
background-color: ${(props) => props.hoverBackgroundColor};
|
|
76
|
-
transform: scale(1.01);
|
|
77
|
-
box-shadow: ${SHADOWS.HOVER};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
:active {
|
|
81
|
-
transform: scale(0.98);
|
|
82
|
-
background-color: ${(props) => props.activeBackgroundColor};
|
|
83
|
-
box-shadow: none;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
:disabled {
|
|
87
|
-
color: ${COLORS.NEUTRAL_LIGHT};
|
|
88
|
-
border-color: ${COLORS.NEUTRAL_LIGHT};
|
|
89
|
-
background-color: ${COLORS.NEUTRAL_LIGHTER};
|
|
90
|
-
|
|
91
|
-
* {
|
|
92
|
-
color: ${COLORS.NEUTRAL_LIGHT};
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
:hover {
|
|
96
|
-
cursor: default;
|
|
97
|
-
transform: scale(1);
|
|
98
|
-
box-shadow: none;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
:active {
|
|
102
|
-
transform: scale(1);
|
|
103
|
-
box-shadow: none;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
`
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react'
|
|
2
|
-
|
|
3
|
-
import { COLORS } from '@/colors'
|
|
4
|
-
import { Loader } from '@/components/react/Loader'
|
|
5
|
-
|
|
6
|
-
import { DEFAULT_BUTTON_VARIANTS } from './DefaultButton.variants'
|
|
7
|
-
import { StyledButtonContainer } from './DefaultButton.styles'
|
|
8
|
-
|
|
9
|
-
type DefaultButtonProps = {
|
|
10
|
-
text: string
|
|
11
|
-
variant?: keyof typeof DEFAULT_BUTTON_VARIANTS.color
|
|
12
|
-
size?: keyof typeof DEFAULT_BUTTON_VARIANTS.size
|
|
13
|
-
shape?: keyof typeof DEFAULT_BUTTON_VARIANTS.shape
|
|
14
|
-
leftIcon?: React.ReactNode
|
|
15
|
-
rightIcon?: React.ReactNode
|
|
16
|
-
fullWidth?: boolean
|
|
17
|
-
loading?: boolean
|
|
18
|
-
} & React.ButtonHTMLAttributes<HTMLButtonElement>
|
|
19
|
-
|
|
20
|
-
const DefaultButton = forwardRef<HTMLButtonElement, DefaultButtonProps>(
|
|
21
|
-
(
|
|
22
|
-
{
|
|
23
|
-
text,
|
|
24
|
-
variant = 'primary',
|
|
25
|
-
size = 'MD',
|
|
26
|
-
shape = 'square',
|
|
27
|
-
fullWidth = false,
|
|
28
|
-
leftIcon: LeftIcon,
|
|
29
|
-
rightIcon: RightIcon,
|
|
30
|
-
loading = false,
|
|
31
|
-
...props
|
|
32
|
-
}: DefaultButtonProps,
|
|
33
|
-
ref: any
|
|
34
|
-
) => {
|
|
35
|
-
const colorProps = DEFAULT_BUTTON_VARIANTS.color[variant]
|
|
36
|
-
const sizeProps = DEFAULT_BUTTON_VARIANTS.size[size]
|
|
37
|
-
const shapeProps = DEFAULT_BUTTON_VARIANTS.shape[shape]
|
|
38
|
-
|
|
39
|
-
const loaderColor = colorProps.color as keyof typeof COLORS
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<StyledButtonContainer
|
|
43
|
-
type="button"
|
|
44
|
-
{...props}
|
|
45
|
-
{...colorProps}
|
|
46
|
-
{...sizeProps}
|
|
47
|
-
{...shapeProps}
|
|
48
|
-
fullWidth={fullWidth}
|
|
49
|
-
loading={loading}
|
|
50
|
-
ref={ref}
|
|
51
|
-
>
|
|
52
|
-
{loading && (
|
|
53
|
-
<span className="default-btn-loader">
|
|
54
|
-
<Loader size={size} color={loaderColor} />
|
|
55
|
-
</span>
|
|
56
|
-
)}
|
|
57
|
-
{LeftIcon && <span className="default-btn-icon">{LeftIcon}</span>}
|
|
58
|
-
<span className="default-btn-text">{text}</span>
|
|
59
|
-
{RightIcon && <span className="default-btn-icon">{RightIcon}</span>}
|
|
60
|
-
</StyledButtonContainer>
|
|
61
|
-
)
|
|
62
|
-
}
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
DefaultButton.displayName = 'DefaultButton'
|
|
66
|
-
|
|
67
|
-
export default DefaultButton
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { COLORS } from '@/colors'
|
|
2
|
-
import { FONT, BORDER } from '@/web'
|
|
3
|
-
|
|
4
|
-
export const DEFAULT_BUTTON_VARIANTS = {
|
|
5
|
-
color: {
|
|
6
|
-
primary: {
|
|
7
|
-
color: COLORS.NEUTRAL_LIGHTER,
|
|
8
|
-
borderColor: COLORS.GROWTH_MID,
|
|
9
|
-
backgroundColor: COLORS.GROWTH_MID,
|
|
10
|
-
hoverBackgroundColor: COLORS.GROWTH_DARK,
|
|
11
|
-
activeBackgroundColor: COLORS.GROWTH_LIGHT,
|
|
12
|
-
},
|
|
13
|
-
light: {
|
|
14
|
-
color: COLORS.GROWTH_MID,
|
|
15
|
-
borderColor: COLORS.GROWTH_MID,
|
|
16
|
-
backgroundColor: COLORS.NEUTRAL_HIGH,
|
|
17
|
-
hoverBackgroundColor: COLORS.NEUTRAL_HIGH,
|
|
18
|
-
activeBackgroundColor: COLORS.NEUTRAL_LIGHTER,
|
|
19
|
-
},
|
|
20
|
-
dark: {
|
|
21
|
-
color: COLORS.NEUTRAL_LIGHTER,
|
|
22
|
-
borderColor: COLORS.NEUTRAL_DARKER,
|
|
23
|
-
backgroundColor: COLORS.NEUTRAL_DARKER,
|
|
24
|
-
hoverBackgroundColor: COLORS.NEUTRAL_DARKER,
|
|
25
|
-
activeBackgroundColor: COLORS.NEUTRAL_LOW,
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
size: {
|
|
29
|
-
SM: {
|
|
30
|
-
fontSize: FONT.SIZE.SM,
|
|
31
|
-
padding: '5px 6px',
|
|
32
|
-
gap: '6px',
|
|
33
|
-
},
|
|
34
|
-
MD: {
|
|
35
|
-
fontSize: FONT.SIZE.MD,
|
|
36
|
-
padding: '6px 10px',
|
|
37
|
-
gap: '8px',
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
shape: {
|
|
42
|
-
square: {
|
|
43
|
-
borderRadius: BORDER.RADIUS.MD,
|
|
44
|
-
},
|
|
45
|
-
round: {
|
|
46
|
-
borderRadius: '55px',
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { Meta } from '@storybook/react/types-6-0'
|
|
3
|
-
import { MdCheck } from 'react-icons/md'
|
|
4
|
-
|
|
5
|
-
import ButtonComponent from './IconButton'
|
|
6
|
-
import { ICON_BUTTON_VARIANTS } from './IconButton.variants'
|
|
7
|
-
|
|
8
|
-
type Props = React.ComponentProps<typeof ButtonComponent>
|
|
9
|
-
|
|
10
|
-
export const IconButton = (props: Props) => {
|
|
11
|
-
return (
|
|
12
|
-
<ButtonComponent {...props}>
|
|
13
|
-
<MdCheck />
|
|
14
|
-
</ButtonComponent>
|
|
15
|
-
)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default {
|
|
19
|
-
title: 'Buttons/IconButton',
|
|
20
|
-
parameters: {
|
|
21
|
-
component: IconButton,
|
|
22
|
-
},
|
|
23
|
-
args: {
|
|
24
|
-
children: 'Button',
|
|
25
|
-
variant: 'primary',
|
|
26
|
-
size: 'MD',
|
|
27
|
-
shape: 'square',
|
|
28
|
-
disabled: false,
|
|
29
|
-
loading: false,
|
|
30
|
-
},
|
|
31
|
-
argTypes: {
|
|
32
|
-
children: {
|
|
33
|
-
control: {
|
|
34
|
-
type: 'text',
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
variant: {
|
|
38
|
-
control: {
|
|
39
|
-
type: 'select',
|
|
40
|
-
options: Object.keys(ICON_BUTTON_VARIANTS.color),
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
size: {
|
|
44
|
-
control: {
|
|
45
|
-
type: 'select',
|
|
46
|
-
options: Object.keys(ICON_BUTTON_VARIANTS.size),
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
shape: {
|
|
50
|
-
control: {
|
|
51
|
-
type: 'select',
|
|
52
|
-
options: Object.keys(ICON_BUTTON_VARIANTS.shape),
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
loading: {
|
|
56
|
-
control: {
|
|
57
|
-
type: 'boolean',
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
disabled: {
|
|
61
|
-
control: {
|
|
62
|
-
type: 'boolean',
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
onClick: {
|
|
66
|
-
control: {
|
|
67
|
-
action: 'clicked',
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
} as Meta
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components'
|
|
2
|
-
import { COLORS, SHADOWS } from '@/colors'
|
|
3
|
-
|
|
4
|
-
type StyledButtonProps = {
|
|
5
|
-
padding: string
|
|
6
|
-
color: string
|
|
7
|
-
backgroundColor: string
|
|
8
|
-
borderRadius: string
|
|
9
|
-
borderColor: string
|
|
10
|
-
fontSize: string
|
|
11
|
-
hoverBackgroundColor: string
|
|
12
|
-
activeBackgroundColor: string
|
|
13
|
-
loading: boolean
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const StyledButtonContainer = styled.button<StyledButtonProps>`
|
|
17
|
-
all: unset;
|
|
18
|
-
position: relative;
|
|
19
|
-
|
|
20
|
-
display: flex;
|
|
21
|
-
flex-direction: row;
|
|
22
|
-
|
|
23
|
-
align-items: center;
|
|
24
|
-
justify-content: center;
|
|
25
|
-
|
|
26
|
-
aspect-ratio: 1/1;
|
|
27
|
-
|
|
28
|
-
transition: 0.05s ease-in-out;
|
|
29
|
-
|
|
30
|
-
padding: ${(props) => props.padding};
|
|
31
|
-
|
|
32
|
-
color: ${(props) => props.color};
|
|
33
|
-
font-size: ${(props) => props.fontSize};
|
|
34
|
-
|
|
35
|
-
* {
|
|
36
|
-
color: ${(props) => props.color};
|
|
37
|
-
font-size: ${(props) => props.fontSize};
|
|
38
|
-
font-weight: 600;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
background-color: ${(props) => props.backgroundColor};
|
|
42
|
-
border: 1px solid ${(props) => props.borderColor};
|
|
43
|
-
border-radius: ${(props) => props.borderRadius};
|
|
44
|
-
|
|
45
|
-
padding: ${(props) => props.padding};
|
|
46
|
-
|
|
47
|
-
pointer-events: ${(props) => (props.loading ? 'none' : 'auto')};
|
|
48
|
-
|
|
49
|
-
.icon-btn-loader {
|
|
50
|
-
opacity: ${(props) => (props.loading ? 1 : 0)};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.icon-btn-content {
|
|
54
|
-
position: absolute;
|
|
55
|
-
|
|
56
|
-
display: flex;
|
|
57
|
-
align-items: center;
|
|
58
|
-
justify-content: center;
|
|
59
|
-
height: 100%;
|
|
60
|
-
width: 100%;
|
|
61
|
-
|
|
62
|
-
opacity: ${(props) => (props.loading ? 0 : 1)};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
:hover {
|
|
66
|
-
cursor: pointer;
|
|
67
|
-
background-color: ${(props) => props.hoverBackgroundColor};
|
|
68
|
-
transform: scale(1.01);
|
|
69
|
-
box-shadow: ${SHADOWS.HOVER};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
:active {
|
|
73
|
-
transform: scale(0.98);
|
|
74
|
-
background-color: ${(props) => props.activeBackgroundColor};
|
|
75
|
-
box-shadow: none;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
:disabled {
|
|
79
|
-
color: ${COLORS.NEUTRAL_LIGHT};
|
|
80
|
-
border-color: ${COLORS.NEUTRAL_LIGHT};
|
|
81
|
-
background-color: ${COLORS.NEUTRAL_LIGHTER};
|
|
82
|
-
|
|
83
|
-
* {
|
|
84
|
-
color: ${COLORS.NEUTRAL_LIGHT};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
:hover {
|
|
88
|
-
cursor: default;
|
|
89
|
-
transform: scale(1);
|
|
90
|
-
box-shadow: none;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
:active {
|
|
94
|
-
transform: scale(1);
|
|
95
|
-
box-shadow: none;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
`
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react'
|
|
2
|
-
|
|
3
|
-
import { COLORS } from '@/colors'
|
|
4
|
-
import { Loader } from '@/components/react/Loader'
|
|
5
|
-
|
|
6
|
-
import { ICON_BUTTON_VARIANTS } from './IconButton.variants'
|
|
7
|
-
import { StyledButtonContainer } from './IconButton.styles'
|
|
8
|
-
|
|
9
|
-
type IconButtonProps = {
|
|
10
|
-
children: React.ReactNode
|
|
11
|
-
variant?: keyof typeof ICON_BUTTON_VARIANTS.color
|
|
12
|
-
size?: keyof typeof ICON_BUTTON_VARIANTS.size
|
|
13
|
-
shape?: keyof typeof ICON_BUTTON_VARIANTS.shape
|
|
14
|
-
fullWidth?: boolean
|
|
15
|
-
loading?: boolean
|
|
16
|
-
} & React.ButtonHTMLAttributes<HTMLButtonElement>
|
|
17
|
-
|
|
18
|
-
const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(
|
|
19
|
-
(
|
|
20
|
-
{
|
|
21
|
-
children,
|
|
22
|
-
variant = 'primary',
|
|
23
|
-
size = 'MD',
|
|
24
|
-
shape = 'square',
|
|
25
|
-
loading = false,
|
|
26
|
-
...props
|
|
27
|
-
}: IconButtonProps,
|
|
28
|
-
ref: any
|
|
29
|
-
) => {
|
|
30
|
-
const colorProps = ICON_BUTTON_VARIANTS.color[variant]
|
|
31
|
-
const sizeProps = ICON_BUTTON_VARIANTS.size[size]
|
|
32
|
-
const shapeProps = ICON_BUTTON_VARIANTS.shape[shape]
|
|
33
|
-
|
|
34
|
-
const loaderColor = colorProps.color as keyof typeof COLORS
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<StyledButtonContainer
|
|
38
|
-
type="button"
|
|
39
|
-
{...props}
|
|
40
|
-
{...colorProps}
|
|
41
|
-
{...sizeProps}
|
|
42
|
-
{...shapeProps}
|
|
43
|
-
loading={loading}
|
|
44
|
-
ref={ref}
|
|
45
|
-
>
|
|
46
|
-
<Loader size={size} color={loaderColor} className="icon-btn-loader" />
|
|
47
|
-
<div className="icon-btn-content">{children}</div>
|
|
48
|
-
</StyledButtonContainer>
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
IconButton.displayName = 'IconButton'
|
|
54
|
-
|
|
55
|
-
export default IconButton
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { COLORS } from '@/colors'
|
|
2
|
-
import { FONT, BORDER } from '@/web'
|
|
3
|
-
|
|
4
|
-
export const ICON_BUTTON_VARIANTS = {
|
|
5
|
-
color: {
|
|
6
|
-
primary: {
|
|
7
|
-
color: COLORS.NEUTRAL_LIGHTER,
|
|
8
|
-
borderColor: COLORS.GROWTH_MID,
|
|
9
|
-
backgroundColor: COLORS.GROWTH_MID,
|
|
10
|
-
hoverBackgroundColor: COLORS.GROWTH_DARK,
|
|
11
|
-
activeBackgroundColor: COLORS.GROWTH_LIGHT,
|
|
12
|
-
},
|
|
13
|
-
light: {
|
|
14
|
-
color: COLORS.GROWTH_MID,
|
|
15
|
-
borderColor: COLORS.GROWTH_MID,
|
|
16
|
-
backgroundColor: COLORS.NEUTRAL_HIGH,
|
|
17
|
-
hoverBackgroundColor: COLORS.NEUTRAL_LIGHTER,
|
|
18
|
-
activeBackgroundColor: COLORS.NEUTRAL_LIGHTER,
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
size: {
|
|
22
|
-
SM: {
|
|
23
|
-
fontSize: FONT.SIZE.LG,
|
|
24
|
-
padding: '4px',
|
|
25
|
-
},
|
|
26
|
-
MD: {
|
|
27
|
-
fontSize: FONT.SIZE.XL,
|
|
28
|
-
padding: '6px',
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
shape: {
|
|
33
|
-
square: {
|
|
34
|
-
borderRadius: BORDER.RADIUS.MD,
|
|
35
|
-
},
|
|
36
|
-
round: {
|
|
37
|
-
borderRadius: '50%',
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { Meta } from '@storybook/react/types-6-0'
|
|
3
|
-
|
|
4
|
-
import { Loader as LoaderComponent } from './Loader'
|
|
5
|
-
import { COLORS } from '@/colors'
|
|
6
|
-
|
|
7
|
-
type Props = React.ComponentProps<typeof LoaderComponent>
|
|
8
|
-
|
|
9
|
-
export const Loader = (props: Props) => {
|
|
10
|
-
return <LoaderComponent {...props} />
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default {
|
|
14
|
-
title: 'Fundation/Loader',
|
|
15
|
-
parameters: {
|
|
16
|
-
component: Loader,
|
|
17
|
-
},
|
|
18
|
-
args: {
|
|
19
|
-
color: 'GROWTH_MID',
|
|
20
|
-
size: 'MD',
|
|
21
|
-
},
|
|
22
|
-
argTypes: {
|
|
23
|
-
color: {
|
|
24
|
-
control: {
|
|
25
|
-
type: 'select',
|
|
26
|
-
options: Object.keys(COLORS),
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
size: {
|
|
30
|
-
control: {
|
|
31
|
-
type: 'select',
|
|
32
|
-
options: ['SM', 'MD'],
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
} as Meta
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components'
|
|
2
|
-
import { COLORS } from '@/colors'
|
|
3
|
-
|
|
4
|
-
const LOADER_SIZES = {
|
|
5
|
-
SM: '14px',
|
|
6
|
-
MD: '20px',
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const LOADER_BORDER_WIDTH = {
|
|
10
|
-
SM: '2px',
|
|
11
|
-
MD: '3px',
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
type LoaderProps = {
|
|
15
|
-
size?: keyof typeof LOADER_SIZES
|
|
16
|
-
color?: keyof typeof COLORS
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const Loader = styled.span<LoaderProps>`
|
|
20
|
-
width: ${({ size }) => LOADER_SIZES[size || 'MD']};
|
|
21
|
-
height: ${({ size }) => LOADER_SIZES[size || 'MD']};
|
|
22
|
-
border: ${({ size }) => LOADER_BORDER_WIDTH[size || 'MD']} solid
|
|
23
|
-
${({ color }) => COLORS[color || 'NEUTRAL_HIGH']};
|
|
24
|
-
|
|
25
|
-
border-bottom-color: transparent;
|
|
26
|
-
border-radius: 50%;
|
|
27
|
-
|
|
28
|
-
display: inline-block;
|
|
29
|
-
box-sizing: border-box;
|
|
30
|
-
animation: rotation 1s linear infinite;
|
|
31
|
-
|
|
32
|
-
@keyframes rotation {
|
|
33
|
-
0% {
|
|
34
|
-
transform: rotate(0deg);
|
|
35
|
-
}
|
|
36
|
-
100% {
|
|
37
|
-
transform: rotate(360deg);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
`
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Loader'
|