w-design-system 0.0.3 → 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/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/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.ts +0 -10
- 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,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
|
-
)
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import ReactDOM from 'react-dom'
|
|
3
|
-
import { closeSVG } from '../../assets/icon'
|
|
4
|
-
import { theme } from '../Themes'
|
|
5
|
-
import { Title } from '../Title'
|
|
6
|
-
import { IconWrapper } from '../IconWrapper'
|
|
7
|
-
import { ModalTypes } from '../Types'
|
|
8
|
-
import { ModalContainer, Overlay } from './styles'
|
|
9
|
-
const {
|
|
10
|
-
colors: { cyan50, shade30 },
|
|
11
|
-
} = theme
|
|
12
|
-
|
|
13
|
-
export const Modal: React.FC<ModalTypes> = ({ children, onClose, footer, ...props }) => {
|
|
14
|
-
return ReactDOM.createPortal(
|
|
15
|
-
<>
|
|
16
|
-
<Overlay onClick={onClose} />
|
|
17
|
-
<ModalContainer {...props}>
|
|
18
|
-
<div className={'modalHeader'}>
|
|
19
|
-
<Title size={'medium'} bold color={cyan50}>
|
|
20
|
-
Enviar
|
|
21
|
-
</Title>
|
|
22
|
-
<IconWrapper src={closeSVG} width={'14px'} height={'14px'} color={shade30} onClick={onClose} />
|
|
23
|
-
</div>
|
|
24
|
-
<div className={'modalContainer'}>{children}</div>
|
|
25
|
-
<div className={'modalFooter'}>{footer}</div>
|
|
26
|
-
</ModalContainer>
|
|
27
|
-
</>,
|
|
28
|
-
document.body,
|
|
29
|
-
)
|
|
30
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { Meta, StoryObj } from '@storybook/react'
|
|
3
|
-
import { useState } from 'react'
|
|
4
|
-
import { Modal } from './index'
|
|
5
|
-
import { Paragraph } from '../Paragraph'
|
|
6
|
-
import { Button } from '../Button'
|
|
7
|
-
|
|
8
|
-
const meta: Meta<typeof Modal> = {
|
|
9
|
-
title: 'Components/Modal',
|
|
10
|
-
component: Modal,
|
|
11
|
-
} satisfies Meta<typeof Modal>
|
|
12
|
-
|
|
13
|
-
export default meta
|
|
14
|
-
|
|
15
|
-
type Story = StoryObj<typeof Modal>
|
|
16
|
-
|
|
17
|
-
export const Playground: Story = {
|
|
18
|
-
render: () => {
|
|
19
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
20
|
-
const [isOpen, setIsOpen] = useState(false)
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<>
|
|
24
|
-
<Button onClick={() => setIsOpen(true)}>Open Modal</Button>
|
|
25
|
-
{isOpen && (
|
|
26
|
-
<Modal
|
|
27
|
-
onClose={() => setIsOpen(false)}
|
|
28
|
-
footer={
|
|
29
|
-
<>
|
|
30
|
-
<Button onClick={() => setIsOpen(true)} variant={'gray'}>
|
|
31
|
-
Cancelar
|
|
32
|
-
</Button>
|
|
33
|
-
<Button onClick={() => setIsOpen(true)}>Open Modal</Button>
|
|
34
|
-
</>
|
|
35
|
-
}
|
|
36
|
-
>
|
|
37
|
-
<Paragraph size={'medium'} weight={800}>
|
|
38
|
-
Modal Title
|
|
39
|
-
</Paragraph>
|
|
40
|
-
<Paragraph>
|
|
41
|
-
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the
|
|
42
|
-
industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and
|
|
43
|
-
scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into
|
|
44
|
-
electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release
|
|
45
|
-
of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software
|
|
46
|
-
like Aldus PageMaker including versions of Lorem Ipsum.
|
|
47
|
-
</Paragraph>
|
|
48
|
-
</Modal>
|
|
49
|
-
)}
|
|
50
|
-
</>
|
|
51
|
-
)
|
|
52
|
-
},
|
|
53
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components'
|
|
2
|
-
import { theme } from '../Themes'
|
|
3
|
-
const {
|
|
4
|
-
colors: { shade20 },
|
|
5
|
-
zIndex: { z8, z9 },
|
|
6
|
-
} = theme
|
|
7
|
-
|
|
8
|
-
export const Overlay = styled.div`
|
|
9
|
-
position: fixed;
|
|
10
|
-
top: 0;
|
|
11
|
-
left: 0;
|
|
12
|
-
width: 100%;
|
|
13
|
-
height: 100%;
|
|
14
|
-
background: rgba(0, 0, 0, 0.5);
|
|
15
|
-
z-index: ${z8};
|
|
16
|
-
`
|
|
17
|
-
export const ModalContainer = styled.div`
|
|
18
|
-
display: flex;
|
|
19
|
-
min-width: 360px;
|
|
20
|
-
width: auto;
|
|
21
|
-
height: auto;
|
|
22
|
-
padding: 30px;
|
|
23
|
-
flex-direction: column;
|
|
24
|
-
align-items: flex-start;
|
|
25
|
-
gap: 24px;
|
|
26
|
-
flex-shrink: 0;
|
|
27
|
-
border-radius: 24px;
|
|
28
|
-
border: 1px solid ${shade20};
|
|
29
|
-
background: white;
|
|
30
|
-
position: fixed;
|
|
31
|
-
top: 50%;
|
|
32
|
-
left: 50%;
|
|
33
|
-
transform: translate(-50%, -50%);
|
|
34
|
-
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
35
|
-
z-index: ${z9};
|
|
36
|
-
|
|
37
|
-
.modalContainer {
|
|
38
|
-
min-height: 100px;
|
|
39
|
-
}
|
|
40
|
-
.modalHeader {
|
|
41
|
-
display: inline-flex;
|
|
42
|
-
justify-content: space-between;
|
|
43
|
-
width: 100%;
|
|
44
|
-
}
|
|
45
|
-
.modalFooter {
|
|
46
|
-
display: inline-flex;
|
|
47
|
-
justify-content: flex-end;
|
|
48
|
-
width: 100%;
|
|
49
|
-
gap: 0 24px;
|
|
50
|
-
}
|
|
51
|
-
`
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import styled from 'styled-components'
|
|
3
|
-
|
|
4
|
-
interface ParagraphProps {
|
|
5
|
-
size?: 'x-small' | 'small' | 'medium' | 'large'
|
|
6
|
-
weight?: 400 | 600 | 700 | 800
|
|
7
|
-
as?: 'span' | 'div' | 'label' | 'p'
|
|
8
|
-
color?: string // Adicionando a propriedade color
|
|
9
|
-
children: React.ReactNode
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const sizes = {
|
|
13
|
-
'x-small': '12px',
|
|
14
|
-
small: '14px',
|
|
15
|
-
medium: '16px',
|
|
16
|
-
large: '18px',
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const weights = {
|
|
20
|
-
400: 400,
|
|
21
|
-
600: 600,
|
|
22
|
-
700: 700,
|
|
23
|
-
800: 800,
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const ParagraphStyled = styled.p<ParagraphProps>`
|
|
27
|
-
margin: 0;
|
|
28
|
-
padding: 0;
|
|
29
|
-
font-size: ${props => sizes[props.size || 'small']};
|
|
30
|
-
font-weight: ${props => (props.weight ? weights[props.weight] : 400)};
|
|
31
|
-
line-height: 140%;
|
|
32
|
-
font-family: 'Nunito Sans', sans-serif;
|
|
33
|
-
color: ${props => props.color || 'inherit'}; // Aplicando a cor
|
|
34
|
-
`
|
|
35
|
-
|
|
36
|
-
export const Paragraph: React.FC<ParagraphProps> = ({ size = 'small', weight, as = 'p', color, children }) => {
|
|
37
|
-
return (
|
|
38
|
-
<ParagraphStyled as={as} size={size} weight={weight} color={color}>
|
|
39
|
-
{children}
|
|
40
|
-
</ParagraphStyled>
|
|
41
|
-
)
|
|
42
|
-
}
|