w-design-system 0.0.2 → 0.0.4
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/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
- package/.storybook/main.ts +0 -19
- package/.storybook/preview.ts +0 -14
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -43
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +0 -25
- package/public/robots.txt +0 -3
- package/src/App.css +0 -39
- package/src/App.test.tsx +0 -9
- package/src/App.tsx +0 -13
- package/src/assets/icon/alert.svg +0 -3
- package/src/assets/icon/close.svg +0 -10
- package/src/assets/icon/comment.svg +0 -10
- package/src/assets/icon/doc-check.svg +0 -10
- package/src/assets/icon/image.svg +0 -3
- package/src/assets/icon/index.ts +0 -6
- package/src/assets/icon/svg.d.ts +0 -1
- package/src/components/Banner/index.tsx +0 -47
- package/src/components/Banner/stories.tsx +0 -31
- package/src/components/Banner/styles.ts +0 -58
- package/src/components/Button/index.tsx +0 -31
- package/src/components/Button/stories.tsx +0 -98
- package/src/components/Button/styles.ts +0 -198
- package/src/components/Button/test.tsx +0 -44
- package/src/components/ButtonRadiusIcon/index.tsx +0 -22
- package/src/components/ButtonRadiusIcon/stories.tsx +0 -47
- package/src/components/ButtonRadiusIcon/styles.ts +0 -139
- package/src/components/ButtonRound/index.tsx +0 -25
- package/src/components/ButtonRound/stories.tsx +0 -50
- package/src/components/ButtonRound/styles.ts +0 -136
- package/src/components/IconWrapper/index.tsx +0 -43
- package/src/components/Modal/index.tsx +0 -30
- package/src/components/Modal/stories.tsx +0 -53
- package/src/components/Modal/styles.ts +0 -51
- package/src/components/Paragraph/index.tsx +0 -42
- package/src/components/Paragraph/stories.tsx +0 -107
- package/src/components/Tabs/index.tsx +0 -24
- package/src/components/Tabs/stories.tsx +0 -74
- package/src/components/Tabs/styles.ts +0 -23
- package/src/components/Themes/index.ts +0 -99
- package/src/components/Title/index.tsx +0 -33
- package/src/components/Title/stories.tsx +0 -68
- package/src/components/Types/index.ts +0 -45
- package/src/index.tsx +0 -10
- package/src/logo.svg +0 -1
- package/src/prettier.config.js +0 -11
- package/src/react-app-env.d.ts +0 -1
- package/src/reportWebVitals.ts +0 -16
- package/src/setupTests.ts +0 -5
- package/src/src/globalStyles.ts +0 -11
- package/src/stories/Button.stories.ts +0 -52
- package/src/stories/Button.tsx +0 -42
- package/src/stories/Configure.mdx +0 -364
- package/src/stories/Header.stories.ts +0 -33
- package/src/stories/Header.tsx +0 -56
- package/src/stories/Page.stories.ts +0 -32
- package/src/stories/Page.tsx +0 -73
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +0 -1
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +0 -1
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +0 -1
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +0 -1
- package/src/stories/assets/youtube.svg +0 -1
- package/src/stories/button.css +0 -30
- package/src/stories/header.css +0 -32
- package/src/stories/page.css +0 -69
- package/src/utils/constanst.ts +0 -2
- package/tsconfig.json +0 -38
- package/webpack.config.js +0 -12
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import styled, { css } from 'styled-components'
|
|
2
|
-
import { theme } from '../Themes'
|
|
3
|
-
import { ButtonTypes } from '../Types'
|
|
4
|
-
|
|
5
|
-
const { colors } = theme
|
|
6
|
-
const buttonRadiusWrapperIconStyles = (color: string) => css`
|
|
7
|
-
.buttonRadiusWrapperIcon {
|
|
8
|
-
margin-top: 4px;
|
|
9
|
-
svg {
|
|
10
|
-
fill: ${color};
|
|
11
|
-
path {
|
|
12
|
-
fill: ${color};
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
`
|
|
17
|
-
const colorScheme = {
|
|
18
|
-
primary: css`
|
|
19
|
-
background: ${colors.cyan50};
|
|
20
|
-
&:hover {
|
|
21
|
-
background-color: ${colors.cyan40};
|
|
22
|
-
}
|
|
23
|
-
&:active {
|
|
24
|
-
background-color: ${colors.cyan50};
|
|
25
|
-
}
|
|
26
|
-
`,
|
|
27
|
-
secondary: css`
|
|
28
|
-
background: ${colors.cyan30};
|
|
29
|
-
&:hover {
|
|
30
|
-
background-color: ${colors.cyan40};
|
|
31
|
-
}
|
|
32
|
-
&:active {
|
|
33
|
-
background-color: ${colors.cyan30};
|
|
34
|
-
}
|
|
35
|
-
`,
|
|
36
|
-
danger: css`
|
|
37
|
-
background: ${colors.red40};
|
|
38
|
-
&:hover {
|
|
39
|
-
background-color: ${colors.red30};
|
|
40
|
-
}
|
|
41
|
-
&:active {
|
|
42
|
-
background-color: ${colors.red40};
|
|
43
|
-
}
|
|
44
|
-
`,
|
|
45
|
-
warning: css`
|
|
46
|
-
background: ${colors.honey10};
|
|
47
|
-
color: ${colors.honey30};
|
|
48
|
-
&:hover {
|
|
49
|
-
background-color: ${colors.honey20};
|
|
50
|
-
}
|
|
51
|
-
&:active {
|
|
52
|
-
background-color: ${colors.honey10};
|
|
53
|
-
}
|
|
54
|
-
${buttonRadiusWrapperIconStyles(colors.honey30)};
|
|
55
|
-
`,
|
|
56
|
-
success: css`
|
|
57
|
-
background: ${colors.mint40};
|
|
58
|
-
&:hover {
|
|
59
|
-
background-color: ${colors.mint30};
|
|
60
|
-
}
|
|
61
|
-
&:active {
|
|
62
|
-
background-color: ${colors.mint40};
|
|
63
|
-
}
|
|
64
|
-
`,
|
|
65
|
-
gray: css`
|
|
66
|
-
background: ${colors.shade10};
|
|
67
|
-
color: ${colors.shade40};
|
|
68
|
-
&:hover {
|
|
69
|
-
background-color: ${colors.shade20};
|
|
70
|
-
}
|
|
71
|
-
&:active {
|
|
72
|
-
background-color: ${colors.shade10};
|
|
73
|
-
}
|
|
74
|
-
${buttonRadiusWrapperIconStyles(colors.shade40)};
|
|
75
|
-
`,
|
|
76
|
-
yellow: css`
|
|
77
|
-
background: ${colors.yellow10};
|
|
78
|
-
color: ${colors.yellow30};
|
|
79
|
-
&:hover {
|
|
80
|
-
background-color: ${colors.yellow20};
|
|
81
|
-
}
|
|
82
|
-
&:active {
|
|
83
|
-
background-color: ${colors.yellow10};
|
|
84
|
-
}
|
|
85
|
-
${buttonRadiusWrapperIconStyles(colors.yellow30)};
|
|
86
|
-
`,
|
|
87
|
-
} as const
|
|
88
|
-
|
|
89
|
-
const colorSchemeOutilne = {
|
|
90
|
-
primary: css`
|
|
91
|
-
color: ${colors.cyan50};
|
|
92
|
-
border: 2px solid ${colors.cyan50};
|
|
93
|
-
&:hover {
|
|
94
|
-
background-color: ${colors.cyan10};
|
|
95
|
-
}
|
|
96
|
-
&:active {
|
|
97
|
-
background-color: ${colors.cyan10};
|
|
98
|
-
}
|
|
99
|
-
${buttonRadiusWrapperIconStyles(colors.cyan50)};
|
|
100
|
-
`,
|
|
101
|
-
secondary: css`
|
|
102
|
-
color: ${colors.cyan40};
|
|
103
|
-
border: 2px solid ${colors.cyan40};
|
|
104
|
-
&:hover {
|
|
105
|
-
background-color: ${colors.cyan10};
|
|
106
|
-
}
|
|
107
|
-
&:active {
|
|
108
|
-
background-color: ${colors.cyan10};
|
|
109
|
-
}
|
|
110
|
-
${buttonRadiusWrapperIconStyles(colors.cyan40)};
|
|
111
|
-
`,
|
|
112
|
-
danger: css`
|
|
113
|
-
color: ${colors.red40};
|
|
114
|
-
border: 2px solid ${colors.red40};
|
|
115
|
-
&:hover {
|
|
116
|
-
background-color: ${colors.red10};
|
|
117
|
-
}
|
|
118
|
-
&:active {
|
|
119
|
-
background-color: ${colors.red10};
|
|
120
|
-
}
|
|
121
|
-
${buttonRadiusWrapperIconStyles(colors.red40)};
|
|
122
|
-
`,
|
|
123
|
-
warning: css`
|
|
124
|
-
color: ${colors.honey40};
|
|
125
|
-
border: 2px solid ${colors.honey40};
|
|
126
|
-
&:hover {
|
|
127
|
-
background-color: ${colors.honey10};
|
|
128
|
-
}
|
|
129
|
-
&:active {
|
|
130
|
-
background-color: ${colors.honey10};
|
|
131
|
-
}
|
|
132
|
-
${buttonRadiusWrapperIconStyles(colors.honey40)};
|
|
133
|
-
`,
|
|
134
|
-
success: css`
|
|
135
|
-
color: ${colors.mint40};
|
|
136
|
-
border: 2px solid ${colors.mint40};
|
|
137
|
-
&:hover {
|
|
138
|
-
background-color: ${colors.mint10};
|
|
139
|
-
}
|
|
140
|
-
&:active {
|
|
141
|
-
background-color: ${colors.mint10};
|
|
142
|
-
}
|
|
143
|
-
${buttonRadiusWrapperIconStyles(colors.mint40)};
|
|
144
|
-
`,
|
|
145
|
-
gray: css`
|
|
146
|
-
color: ${colors.shade40};
|
|
147
|
-
border: 2px solid ${colors.shade40};
|
|
148
|
-
&:hover {
|
|
149
|
-
background-color: ${colors.shade20};
|
|
150
|
-
}
|
|
151
|
-
&:active {
|
|
152
|
-
background-color: ${colors.shade10};
|
|
153
|
-
}
|
|
154
|
-
${buttonRadiusWrapperIconStyles(colors.shade40)};
|
|
155
|
-
`,
|
|
156
|
-
yellow: css`
|
|
157
|
-
color: ${colors.yellow30};
|
|
158
|
-
border: 2px solid ${colors.yellow30};
|
|
159
|
-
&:hover {
|
|
160
|
-
background-color: ${colors.yellow10};
|
|
161
|
-
}
|
|
162
|
-
&:active {
|
|
163
|
-
background-color: ${colors.yellow10};
|
|
164
|
-
}
|
|
165
|
-
${buttonRadiusWrapperIconStyles(colors.yellow30)};
|
|
166
|
-
`,
|
|
167
|
-
} as const
|
|
168
|
-
|
|
169
|
-
export const ButtonStyled = styled.button<ButtonTypes>`
|
|
170
|
-
display: inline-flex;
|
|
171
|
-
align-items: center;
|
|
172
|
-
justify-content: center;
|
|
173
|
-
box-sizing: border-box;
|
|
174
|
-
height: 48px;
|
|
175
|
-
width: ${({ fullWidth }) => (fullWidth ? '100%' : 'auto')};
|
|
176
|
-
padding: 12px 24px;
|
|
177
|
-
font-size: 16px;
|
|
178
|
-
font-weight: 600;
|
|
179
|
-
line-height: 140%;
|
|
180
|
-
border: none;
|
|
181
|
-
border-radius: ${({ radius }) => (radius ? '24px' : '5px')};
|
|
182
|
-
font-family: 'Nunito Sans', sans-serif;
|
|
183
|
-
transition:
|
|
184
|
-
background-color 0.3s,
|
|
185
|
-
opacity 0.3s;
|
|
186
|
-
color: white;
|
|
187
|
-
gap: 12px;
|
|
188
|
-
cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')};
|
|
189
|
-
opacity: ${({ disabled }) => (disabled ? 0.5 : 1)};
|
|
190
|
-
${({ variant = 'primary', outline }) => (!outline ? colorScheme[variant] : colorSchemeOutilne[variant])};
|
|
191
|
-
background: ${({ outline }) => outline && 'white'};
|
|
192
|
-
border-radius: ${({ halfLeft, halfRight, radius }) =>
|
|
193
|
-
!halfLeft && !halfRight ? (radius ? '24px' : '5px') : halfLeft ? '24px 0 0 24px' : '0 24px 24px 0'};
|
|
194
|
-
|
|
195
|
-
.buttonRadiusWrapperIcon {
|
|
196
|
-
margin-top: 4px;
|
|
197
|
-
}
|
|
198
|
-
`
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { render, screen, fireEvent } from '@testing-library/react'
|
|
3
|
-
import '@testing-library/jest-dom'
|
|
4
|
-
import { Button } from './index'
|
|
5
|
-
|
|
6
|
-
describe('Button Component', () => {
|
|
7
|
-
test('renders button with primary variant', () => {
|
|
8
|
-
render(<Button variant="primary">Primary Button</Button>)
|
|
9
|
-
const button = screen.getByText('Primary Button')
|
|
10
|
-
expect(button).toBeInTheDocument()
|
|
11
|
-
expect(button).toHaveStyle(`background-color: #1A3D7F`)
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
test('renders button with secondary variant', () => {
|
|
15
|
-
render(<Button variant="secondary">Secondary Button</Button>)
|
|
16
|
-
const button = screen.getByText('Secondary Button')
|
|
17
|
-
expect(button).toBeInTheDocument()
|
|
18
|
-
expect(button).toHaveStyle(`background-color: #217EFD`)
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
test('button responds to click event', () => {
|
|
22
|
-
const handleClick = jest.fn()
|
|
23
|
-
render(
|
|
24
|
-
<Button variant="primary" onClick={handleClick}>
|
|
25
|
-
Clickable Button
|
|
26
|
-
</Button>,
|
|
27
|
-
)
|
|
28
|
-
const button = screen.getByText('Clickable Button')
|
|
29
|
-
fireEvent.click(button)
|
|
30
|
-
expect(handleClick).toHaveBeenCalledTimes(1)
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
test('button is disabled when the disabled prop is true', () => {
|
|
34
|
-
render(
|
|
35
|
-
<Button variant="primary" disabled>
|
|
36
|
-
Disabled Button
|
|
37
|
-
</Button>,
|
|
38
|
-
)
|
|
39
|
-
const button = screen.getByText('Disabled Button')
|
|
40
|
-
expect(button).toBeInTheDocument()
|
|
41
|
-
expect(button).toHaveStyle(`opacity: 0.5`)
|
|
42
|
-
expect(button).toHaveStyle(`cursor: not-allowed`)
|
|
43
|
-
})
|
|
44
|
-
})
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { IconWrapper } from '../IconWrapper'
|
|
3
|
-
import { ButtonStyled } from './styles'
|
|
4
|
-
import { ButtonRadiusIconTypes } from '../Types'
|
|
5
|
-
|
|
6
|
-
export const ButtonRadiusIcon: React.FC<ButtonRadiusIconTypes> = ({
|
|
7
|
-
variant = 'primary',
|
|
8
|
-
children,
|
|
9
|
-
disabled = false,
|
|
10
|
-
icon,
|
|
11
|
-
subTitle,
|
|
12
|
-
...props
|
|
13
|
-
}) => (
|
|
14
|
-
<ButtonStyled variant={variant} disabled={disabled} subTitle={subTitle} {...props}>
|
|
15
|
-
<span className={'buttonRadiusIconContainer'}>
|
|
16
|
-
{children} {subTitle && <p className={'buttonRadiusIconTitle'}>{subTitle}</p>}
|
|
17
|
-
</span>
|
|
18
|
-
<span className={'buttonRadiusIconWrapperIcon'}>
|
|
19
|
-
<IconWrapper src={icon || ''} color={'white'} className={'buttonRadiusWrapperIcon'} />
|
|
20
|
-
</span>
|
|
21
|
-
</ButtonStyled>
|
|
22
|
-
)
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react'
|
|
2
|
-
import exampleIcon from '../../assets/icon/image.svg'
|
|
3
|
-
import { ButtonRadiusIcon } from './index'
|
|
4
|
-
import { VARIANTS_TYPES } from '../../utils/constanst' // Update this path to your actual icon
|
|
5
|
-
|
|
6
|
-
const meta: Meta<typeof ButtonRadiusIcon> = {
|
|
7
|
-
title: 'Components/ButtonRadiusIcon',
|
|
8
|
-
component: ButtonRadiusIcon,
|
|
9
|
-
tags: ['autodocs'],
|
|
10
|
-
argTypes: {
|
|
11
|
-
variant: {
|
|
12
|
-
control: {
|
|
13
|
-
type: 'select',
|
|
14
|
-
options: VARIANTS_TYPES,
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
disabled: {
|
|
18
|
-
control: 'boolean',
|
|
19
|
-
},
|
|
20
|
-
icon: {
|
|
21
|
-
control: 'text',
|
|
22
|
-
},
|
|
23
|
-
onClick: { action: 'clicked' },
|
|
24
|
-
},
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export default meta
|
|
28
|
-
type Story = StoryObj<typeof ButtonRadiusIcon>
|
|
29
|
-
|
|
30
|
-
export const Playground: Story = {
|
|
31
|
-
args: {
|
|
32
|
-
variant: 'primary',
|
|
33
|
-
children: 'Primary Button',
|
|
34
|
-
disabled: false,
|
|
35
|
-
icon: exampleIcon,
|
|
36
|
-
},
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export const PlaygroundTitlePrimary: Story = {
|
|
40
|
-
args: {
|
|
41
|
-
variant: 'secondary',
|
|
42
|
-
children: 'Button:',
|
|
43
|
-
disabled: false,
|
|
44
|
-
icon: exampleIcon,
|
|
45
|
-
subTitle: 'subTitle',
|
|
46
|
-
},
|
|
47
|
-
}
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import styled, { css } from 'styled-components'
|
|
2
|
-
import { theme } from '../Themes'
|
|
3
|
-
import { ButtonRadiusIconTypes } from '../Types'
|
|
4
|
-
|
|
5
|
-
const { colors } = theme
|
|
6
|
-
const buttonRadiusWrapperIconStyles = (color: string) => css`
|
|
7
|
-
.buttonRadiusIconWrapperIcon {
|
|
8
|
-
background: ${color};
|
|
9
|
-
width: 56px;
|
|
10
|
-
height: 100%;
|
|
11
|
-
overflow: hidden;
|
|
12
|
-
}
|
|
13
|
-
`
|
|
14
|
-
const colorScheme = {
|
|
15
|
-
primary: css`
|
|
16
|
-
background: ${colors.cyan10};
|
|
17
|
-
color: ${colors.cyan50};
|
|
18
|
-
&:hover {
|
|
19
|
-
background-color: ${colors.cyan10};
|
|
20
|
-
}
|
|
21
|
-
&:active {
|
|
22
|
-
background-color: ${colors.cyan10};
|
|
23
|
-
}
|
|
24
|
-
${buttonRadiusWrapperIconStyles(colors.cyan50)};
|
|
25
|
-
`,
|
|
26
|
-
secondary: css`
|
|
27
|
-
background: ${colors.cyan10};
|
|
28
|
-
color: ${colors.cyan30};
|
|
29
|
-
&:hover {
|
|
30
|
-
background-color: ${colors.cyan10};
|
|
31
|
-
opacity: 0.9;
|
|
32
|
-
}
|
|
33
|
-
&:active {
|
|
34
|
-
background-color: ${colors.cyan10};
|
|
35
|
-
opacity: 1;
|
|
36
|
-
}
|
|
37
|
-
${buttonRadiusWrapperIconStyles(colors.cyan30)};
|
|
38
|
-
`,
|
|
39
|
-
danger: css`
|
|
40
|
-
background: ${colors.red10};
|
|
41
|
-
color: ${colors.red40};
|
|
42
|
-
&:hover {
|
|
43
|
-
background-color: ${colors.red20};
|
|
44
|
-
}
|
|
45
|
-
&:active {
|
|
46
|
-
background-color: ${colors.red10};
|
|
47
|
-
}
|
|
48
|
-
${buttonRadiusWrapperIconStyles(colors.red40)};
|
|
49
|
-
`,
|
|
50
|
-
warning: css`
|
|
51
|
-
background: ${colors.honey10};
|
|
52
|
-
color: ${colors.honey30};
|
|
53
|
-
&:hover {
|
|
54
|
-
background-color: ${colors.honey20};
|
|
55
|
-
}
|
|
56
|
-
&:active {
|
|
57
|
-
background-color: ${colors.honey10};
|
|
58
|
-
}
|
|
59
|
-
${buttonRadiusWrapperIconStyles(colors.honey30)};
|
|
60
|
-
`,
|
|
61
|
-
success: css`
|
|
62
|
-
background: ${colors.mint10};
|
|
63
|
-
color: ${colors.mint40};
|
|
64
|
-
&:hover {
|
|
65
|
-
background-color: ${colors.mint20};
|
|
66
|
-
}
|
|
67
|
-
&:active {
|
|
68
|
-
background-color: ${colors.mint10};
|
|
69
|
-
}
|
|
70
|
-
${buttonRadiusWrapperIconStyles(colors.mint40)};
|
|
71
|
-
`,
|
|
72
|
-
gray: css`
|
|
73
|
-
background: ${colors.shade10};
|
|
74
|
-
color: ${colors.shade40};
|
|
75
|
-
&:hover {
|
|
76
|
-
background-color: ${colors.shade20};
|
|
77
|
-
}
|
|
78
|
-
&:active {
|
|
79
|
-
background-color: ${colors.shade10};
|
|
80
|
-
}
|
|
81
|
-
${buttonRadiusWrapperIconStyles(colors.shade40)};
|
|
82
|
-
`,
|
|
83
|
-
yellow: css`
|
|
84
|
-
background: ${colors.yellow10};
|
|
85
|
-
color: ${colors.yellow30};
|
|
86
|
-
&:hover {
|
|
87
|
-
background-color: ${colors.yellow20};
|
|
88
|
-
opacity: 0.9;
|
|
89
|
-
}
|
|
90
|
-
&:active {
|
|
91
|
-
background-color: ${colors.yellow10};
|
|
92
|
-
opacity: 1;
|
|
93
|
-
}
|
|
94
|
-
${buttonRadiusWrapperIconStyles(colors.yellow30)};
|
|
95
|
-
`,
|
|
96
|
-
} as const
|
|
97
|
-
|
|
98
|
-
export const ButtonStyled = styled.button<ButtonRadiusIconTypes>`
|
|
99
|
-
display: inline-flex;
|
|
100
|
-
box-sizing: border-box;
|
|
101
|
-
height: 48px;
|
|
102
|
-
padding: 0;
|
|
103
|
-
margin: 0;
|
|
104
|
-
justify-content: space-between;
|
|
105
|
-
min-width: 190px;
|
|
106
|
-
font-style: normal;
|
|
107
|
-
font-size: 16px;
|
|
108
|
-
font-weight: 600;
|
|
109
|
-
line-height: 140%;
|
|
110
|
-
border: none;
|
|
111
|
-
border-radius: 24px;
|
|
112
|
-
overflow: hidden;
|
|
113
|
-
font-family: 'Nunito Sans', sans-serif;
|
|
114
|
-
transition:
|
|
115
|
-
background-color 0.3s,
|
|
116
|
-
opacity 0.3s;
|
|
117
|
-
color: white;
|
|
118
|
-
|
|
119
|
-
cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')};
|
|
120
|
-
opacity: ${({ disabled }) => (disabled ? 0.5 : 1)};
|
|
121
|
-
${({ variant = 'primary' }) => colorScheme[variant]};
|
|
122
|
-
|
|
123
|
-
.buttonRadiusIconContainer {
|
|
124
|
-
display: flex;
|
|
125
|
-
justify-content: center;
|
|
126
|
-
align-items: center;
|
|
127
|
-
padding: 0 24px;
|
|
128
|
-
gap: 6px;
|
|
129
|
-
height: 48px;
|
|
130
|
-
}
|
|
131
|
-
.buttonRadiusIconTitle {
|
|
132
|
-
color: ${colors.shade40};
|
|
133
|
-
font-weight: 400;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
.buttonRadiusWrapperIcon {
|
|
137
|
-
margin-top: 2px;
|
|
138
|
-
}
|
|
139
|
-
`
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { IconWrapper } from '../IconWrapper'
|
|
3
|
-
import { ButtonStyled } from './styles'
|
|
4
|
-
import { ButtonRoundTypes } from '../Types'
|
|
5
|
-
|
|
6
|
-
export const ButtonRound: React.FC<ButtonRoundTypes> = ({
|
|
7
|
-
variant = 'primary',
|
|
8
|
-
children,
|
|
9
|
-
disabled = false,
|
|
10
|
-
icon,
|
|
11
|
-
outline,
|
|
12
|
-
badge,
|
|
13
|
-
...props
|
|
14
|
-
}) => (
|
|
15
|
-
<ButtonStyled variant={variant} disabled={disabled} outline={outline} badge={badge} {...props}>
|
|
16
|
-
{badge && <span className={'buttonRoundBadge'}>{badge}</span>}
|
|
17
|
-
<IconWrapper
|
|
18
|
-
src={icon || ''}
|
|
19
|
-
color={'white'}
|
|
20
|
-
width={'20px'}
|
|
21
|
-
height={'20px'}
|
|
22
|
-
className={'buttonRadiusWrapperIcon'}
|
|
23
|
-
/>
|
|
24
|
-
</ButtonStyled>
|
|
25
|
-
)
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react'
|
|
2
|
-
import exampleIcon from '../../assets/icon/image.svg'
|
|
3
|
-
|
|
4
|
-
import { VARIANTS_TYPES } from '../../utils/constanst'
|
|
5
|
-
import { ButtonRound } from './index'
|
|
6
|
-
|
|
7
|
-
const meta: Meta<typeof ButtonRound> = {
|
|
8
|
-
title: 'Components/ButtonRound',
|
|
9
|
-
component: ButtonRound,
|
|
10
|
-
tags: ['autodocs'],
|
|
11
|
-
argTypes: {
|
|
12
|
-
variant: {
|
|
13
|
-
control: {
|
|
14
|
-
type: 'select',
|
|
15
|
-
options: VARIANTS_TYPES,
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
disabled: {
|
|
19
|
-
control: 'boolean',
|
|
20
|
-
},
|
|
21
|
-
icon: {
|
|
22
|
-
control: 'object',
|
|
23
|
-
options: [exampleIcon],
|
|
24
|
-
description: exampleIcon,
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
onClick: { action: 'clicked' },
|
|
28
|
-
},
|
|
29
|
-
} satisfies Meta<typeof ButtonRound>
|
|
30
|
-
|
|
31
|
-
export default meta
|
|
32
|
-
type Story = StoryObj<typeof ButtonRound>
|
|
33
|
-
|
|
34
|
-
export const Playground: Story = {
|
|
35
|
-
args: {
|
|
36
|
-
variant: 'primary',
|
|
37
|
-
children: 'ButtonPlayground',
|
|
38
|
-
disabled: false,
|
|
39
|
-
icon: exampleIcon,
|
|
40
|
-
},
|
|
41
|
-
}
|
|
42
|
-
export const ButtonBadge: Story = {
|
|
43
|
-
args: {
|
|
44
|
-
variant: 'success',
|
|
45
|
-
children: 'ButtonPlayground',
|
|
46
|
-
disabled: false,
|
|
47
|
-
icon: exampleIcon,
|
|
48
|
-
badge: 10,
|
|
49
|
-
},
|
|
50
|
-
}
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import styled, { css } from 'styled-components'
|
|
2
|
-
import { theme } from '../Themes'
|
|
3
|
-
import { ButtonRoundTypes } from '../Types'
|
|
4
|
-
|
|
5
|
-
const { colors } = theme
|
|
6
|
-
const buttonRadiusWrapperIconStyles = (color: string) => css`
|
|
7
|
-
.buttonRadiusWrapperIcon {
|
|
8
|
-
svg {
|
|
9
|
-
fill: ${color};
|
|
10
|
-
path {
|
|
11
|
-
fill: ${color};
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
.buttonRoundBadge {
|
|
16
|
-
background: ${color};
|
|
17
|
-
}
|
|
18
|
-
`
|
|
19
|
-
const colorScheme = {
|
|
20
|
-
primary: css`
|
|
21
|
-
background: ${colors.shade10};
|
|
22
|
-
${buttonRadiusWrapperIconStyles(colors.shade30)}
|
|
23
|
-
&:hover {
|
|
24
|
-
background-color: ${colors.shade20};
|
|
25
|
-
${buttonRadiusWrapperIconStyles(colors.cyan40)};
|
|
26
|
-
}
|
|
27
|
-
&:active {
|
|
28
|
-
background-color: ${colors.shade10};
|
|
29
|
-
${buttonRadiusWrapperIconStyles(colors.shade30)};
|
|
30
|
-
}
|
|
31
|
-
`,
|
|
32
|
-
secondary: css`
|
|
33
|
-
background: ${colors.cyan10};
|
|
34
|
-
&:hover {
|
|
35
|
-
background-color: ${colors.cyan10};
|
|
36
|
-
${buttonRadiusWrapperIconStyles(colors.cyan30)}
|
|
37
|
-
}
|
|
38
|
-
&:active {
|
|
39
|
-
background-color: ${colors.cyan10};
|
|
40
|
-
}
|
|
41
|
-
${buttonRadiusWrapperIconStyles(colors.cyan40)};
|
|
42
|
-
`,
|
|
43
|
-
danger: css`
|
|
44
|
-
background: ${colors.red10};
|
|
45
|
-
&:hover {
|
|
46
|
-
background-color: ${colors.red20};
|
|
47
|
-
}
|
|
48
|
-
&:active {
|
|
49
|
-
background-color: ${colors.red10};
|
|
50
|
-
}
|
|
51
|
-
${buttonRadiusWrapperIconStyles(colors.red40)};
|
|
52
|
-
`,
|
|
53
|
-
warning: css`
|
|
54
|
-
background: ${colors.honey10};
|
|
55
|
-
color: ${colors.honey30};
|
|
56
|
-
&:hover {
|
|
57
|
-
background-color: ${colors.honey20};
|
|
58
|
-
}
|
|
59
|
-
&:active {
|
|
60
|
-
background-color: ${colors.honey10};
|
|
61
|
-
}
|
|
62
|
-
${buttonRadiusWrapperIconStyles(colors.honey30)};
|
|
63
|
-
`,
|
|
64
|
-
success: css`
|
|
65
|
-
background: ${colors.mint10};
|
|
66
|
-
&:hover {
|
|
67
|
-
background-color: ${colors.mint20};
|
|
68
|
-
}
|
|
69
|
-
&:active {
|
|
70
|
-
background-color: ${colors.mint10};
|
|
71
|
-
}
|
|
72
|
-
${buttonRadiusWrapperIconStyles(colors.mint40)};
|
|
73
|
-
`,
|
|
74
|
-
gray: css`
|
|
75
|
-
background: ${colors.shade10};
|
|
76
|
-
&:hover {
|
|
77
|
-
background-color: ${colors.shade20};
|
|
78
|
-
}
|
|
79
|
-
&:active {
|
|
80
|
-
background-color: ${colors.shade10};
|
|
81
|
-
}
|
|
82
|
-
${buttonRadiusWrapperIconStyles(colors.shade40)};
|
|
83
|
-
`,
|
|
84
|
-
yellow: css`
|
|
85
|
-
background: ${colors.yellow10};
|
|
86
|
-
&:hover {
|
|
87
|
-
background-color: ${colors.yellow20};
|
|
88
|
-
}
|
|
89
|
-
&:active {
|
|
90
|
-
background-color: ${colors.yellow10};
|
|
91
|
-
}
|
|
92
|
-
${buttonRadiusWrapperIconStyles(colors.yellow30)};
|
|
93
|
-
`,
|
|
94
|
-
} as const
|
|
95
|
-
|
|
96
|
-
export const ButtonStyled = styled.button<ButtonRoundTypes>`
|
|
97
|
-
display: inline-flex;
|
|
98
|
-
align-items: center;
|
|
99
|
-
justify-content: center;
|
|
100
|
-
box-sizing: border-box;
|
|
101
|
-
height: 48px;
|
|
102
|
-
width: 48px;
|
|
103
|
-
font-size: 16px;
|
|
104
|
-
font-weight: 600;
|
|
105
|
-
line-height: 140%;
|
|
106
|
-
border: none;
|
|
107
|
-
border-radius: 100%;
|
|
108
|
-
font-family: 'Nunito Sans', sans-serif;
|
|
109
|
-
transition:
|
|
110
|
-
color 0.3s,
|
|
111
|
-
background-color 0.3s,
|
|
112
|
-
opacity 0.3s;
|
|
113
|
-
color: white;
|
|
114
|
-
gap: 12px;
|
|
115
|
-
cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')};
|
|
116
|
-
opacity: ${({ disabled }) => (disabled ? 0.5 : 1)};
|
|
117
|
-
${({ variant = 'primary', outline }) => colorScheme[variant]};
|
|
118
|
-
|
|
119
|
-
.buttonRadiusWrapperIcon {
|
|
120
|
-
margin-top: 4px;
|
|
121
|
-
}
|
|
122
|
-
.buttonRoundBadge {
|
|
123
|
-
box-sizing: border-box;
|
|
124
|
-
margin-bottom: 24px;
|
|
125
|
-
margin-left: 54px;
|
|
126
|
-
position: absolute;
|
|
127
|
-
width: 26px;
|
|
128
|
-
height: 26px;
|
|
129
|
-
border-radius: 100%;
|
|
130
|
-
font-size: 12px;
|
|
131
|
-
display: flex;
|
|
132
|
-
justify-content: center;
|
|
133
|
-
align-items: center;
|
|
134
|
-
border: 2px solid;
|
|
135
|
-
}
|
|
136
|
-
`
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import styled from 'styled-components'
|
|
3
|
-
import { ReactSVG } from 'react-svg'
|
|
4
|
-
|
|
5
|
-
interface IconWrapperProps {
|
|
6
|
-
src: string
|
|
7
|
-
color?: string
|
|
8
|
-
width?: string
|
|
9
|
-
height?: string
|
|
10
|
-
className?: string
|
|
11
|
-
onClick?: () => void
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
interface IconWrappeProps {
|
|
15
|
-
color?: string
|
|
16
|
-
width?: string
|
|
17
|
-
height?: string
|
|
18
|
-
onClick?: () => void
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const StyledIconWrapper = styled.div<IconWrappeProps>`
|
|
22
|
-
height: 100%;
|
|
23
|
-
display: flex;
|
|
24
|
-
align-items: center;
|
|
25
|
-
justify-content: center;
|
|
26
|
-
flex-shrink: 0;
|
|
27
|
-
cursor: ${props => (props.onClick ? 'pointer' : 'default')};
|
|
28
|
-
svg {
|
|
29
|
-
width: ${props => props.width || '24px'};
|
|
30
|
-
height: ${props => props.height || '24px'};
|
|
31
|
-
fill: ${props => props.color || 'black'};
|
|
32
|
-
|
|
33
|
-
path {
|
|
34
|
-
fill: ${props => props.color || 'black'};
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
`
|
|
38
|
-
|
|
39
|
-
export const IconWrapper: React.FC<IconWrapperProps> = ({ src, color, width, height, className, onClick }) => (
|
|
40
|
-
<StyledIconWrapper color={color} width={width} height={height} className={className} onClick={onClick}>
|
|
41
|
-
<ReactSVG src={src} />
|
|
42
|
-
</StyledIconWrapper>
|
|
43
|
-
)
|