w-design-system 0.0.18 → 0.0.19

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.
Files changed (85) hide show
  1. package/.babelrc +8 -0
  2. package/.storybook/main.ts +19 -0
  3. package/.storybook/preview.ts +14 -0
  4. package/dist/components/index.d.ts +0 -1
  5. package/dist/components/index.d.ts.map +1 -1
  6. package/dist/components/index.js +0 -1
  7. package/dist/components/index.js.map +1 -1
  8. package/package.json +2 -6
  9. package/public/favicon.ico +0 -0
  10. package/public/index.html +43 -0
  11. package/public/logo192.png +0 -0
  12. package/public/logo512.png +0 -0
  13. package/public/manifest.json +25 -0
  14. package/public/robots.txt +3 -0
  15. package/src/assets/icon/index.ts +6 -0
  16. package/src/components/Banner/index.tsx +47 -0
  17. package/src/components/Banner/stories.tsx +31 -0
  18. package/src/components/Banner/styles.ts +59 -0
  19. package/src/components/Button/index.tsx +31 -0
  20. package/src/components/Button/stories.tsx +98 -0
  21. package/src/components/Button/styles.ts +198 -0
  22. package/src/components/Button/test.tsx +44 -0
  23. package/src/components/ButtonRadiusIcon/index.tsx +22 -0
  24. package/src/components/ButtonRadiusIcon/stories.tsx +47 -0
  25. package/src/components/ButtonRadiusIcon/styles.ts +139 -0
  26. package/src/components/ButtonRound/index.tsx +25 -0
  27. package/src/components/ButtonRound/stories.tsx +50 -0
  28. package/src/components/ButtonRound/styles.ts +136 -0
  29. package/src/components/IconWrapper/index.tsx +43 -0
  30. package/src/components/Modal/index.tsx +30 -0
  31. package/src/components/Modal/stories.tsx +53 -0
  32. package/src/components/Modal/styles.ts +51 -0
  33. package/src/components/Paragraph/index.tsx +42 -0
  34. package/src/components/Paragraph/stories.tsx +107 -0
  35. package/src/components/Tabs/index.tsx +24 -0
  36. package/src/components/Tabs/stories.tsx +74 -0
  37. package/src/components/Tabs/styles.ts +23 -0
  38. package/src/components/Themes/index.ts +99 -0
  39. package/src/components/Title/index.tsx +33 -0
  40. package/src/components/Title/stories.tsx +68 -0
  41. package/src/components/Types/index.ts +45 -0
  42. package/src/components/index.tsx +10 -0
  43. package/src/index.tsx +11 -0
  44. package/src/prettier.config.js +11 -0
  45. package/src/react-app-env.d.ts +1 -0
  46. package/src/reportWebVitals.ts +16 -0
  47. package/src/setupTests.ts +5 -0
  48. package/src/src/globalStyles.ts +11 -0
  49. package/src/stories/Button.stories.ts +52 -0
  50. package/src/stories/Button.tsx +42 -0
  51. package/src/stories/Configure.mdx +364 -0
  52. package/src/stories/Header.stories.ts +33 -0
  53. package/src/stories/Header.tsx +56 -0
  54. package/src/stories/Page.stories.ts +32 -0
  55. package/src/stories/Page.tsx +73 -0
  56. package/src/stories/assets/accessibility.png +0 -0
  57. package/src/stories/assets/accessibility.svg +1 -0
  58. package/src/stories/assets/addon-library.png +0 -0
  59. package/src/stories/assets/assets.png +0 -0
  60. package/src/stories/assets/avif-test-image.avif +0 -0
  61. package/src/stories/assets/context.png +0 -0
  62. package/src/stories/assets/discord.svg +1 -0
  63. package/src/stories/assets/docs.png +0 -0
  64. package/src/stories/assets/figma-plugin.png +0 -0
  65. package/src/stories/assets/github.svg +1 -0
  66. package/src/stories/assets/share.png +0 -0
  67. package/src/stories/assets/styling.png +0 -0
  68. package/src/stories/assets/testing.png +0 -0
  69. package/src/stories/assets/theming.png +0 -0
  70. package/src/stories/assets/tutorials.svg +1 -0
  71. package/src/stories/assets/youtube.svg +1 -0
  72. package/src/stories/button.css +30 -0
  73. package/src/stories/header.css +32 -0
  74. package/src/stories/page.css +69 -0
  75. package/src/utils/constanst.ts +2 -0
  76. package/tsconfig.json +38 -0
  77. package/webpack.config.js +56 -0
  78. package/dist/assets/icon/svg.d.ts +0 -7
  79. package/dist/bundle.js +0 -549
  80. package/dist/bundle.js.LICENSE.txt +0 -35
  81. /package/{dist/assets/icons → src/assets/icon}/alert.svg +0 -0
  82. /package/{dist/assets/icons → src/assets/icon}/close.svg +0 -0
  83. /package/{dist/assets/icons → src/assets/icon}/comment.svg +0 -0
  84. /package/{dist/assets/icons → src/assets/icon}/doc-check.svg +0 -0
  85. /package/{dist/assets/icons → src/assets/icon}/image.svg +0 -0
package/.babelrc ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "presets": ["@babel/preset-env", "@babel/preset-react", "@babel/preset-typescript"],
3
+ "plugins": [
4
+ "@babel/plugin-proposal-class-properties",
5
+ "@babel/plugin-transform-runtime",
6
+ "@babel/plugin-proposal-optional-chaining"
7
+ ]
8
+ }
@@ -0,0 +1,19 @@
1
+ import type { StorybookConfig } from "@storybook/react-webpack5";
2
+
3
+ const config: StorybookConfig = {
4
+ stories: ['../src/components/**/stories.tsx', '../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
5
+ addons: [
6
+ "@storybook/preset-create-react-app",
7
+ "@storybook/addon-onboarding",
8
+ "@storybook/addon-links",
9
+ "@storybook/addon-essentials",
10
+ "@chromatic-com/storybook",
11
+ "@storybook/addon-interactions",
12
+ ],
13
+ framework: {
14
+ name: "@storybook/react-webpack5",
15
+ options: {},
16
+ },
17
+ staticDirs: ["../public"],
18
+ };
19
+ export default config;
@@ -0,0 +1,14 @@
1
+ import type { Preview } from "@storybook/react";
2
+
3
+ const preview: Preview = {
4
+ parameters: {
5
+ controls: {
6
+ matchers: {
7
+ color: /(background|color)$/i,
8
+ date: /Date$/i,
9
+ },
10
+ },
11
+ },
12
+ };
13
+
14
+ export default preview;
@@ -8,5 +8,4 @@ export { Paragraph } from './Paragraph/index';
8
8
  export { Tabs } from './Tabs/index';
9
9
  export { theme } from './Themes/index';
10
10
  export { Title } from './Title/index';
11
- export { docCheckSVG, alertSVG, commentSVG, imageSVG, closeSVG } from '../assets/icon/index';
12
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA"}
@@ -8,5 +8,4 @@ export { Paragraph } from './Paragraph/index';
8
8
  export { Tabs } from './Tabs/index';
9
9
  export { theme } from './Themes/index';
10
10
  export { Title } from './Title/index';
11
- export { docCheckSVG, alertSVG, commentSVG, imageSVG, closeSVG } from '../assets/icon/index';
12
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA"}
package/package.json CHANGED
@@ -1,11 +1,7 @@
1
1
  {
2
2
  "name": "w-design-system",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "main": "dist/index.js",
5
- "files": [
6
- "dist",
7
- "README.md"
8
- ],
9
5
  "dependencies": {
10
6
  "@svgr/webpack": "^8.1.0",
11
7
  "@testing-library/jest-dom": "^5.17.0",
@@ -28,7 +24,7 @@
28
24
  "scripts": {
29
25
  "start": "react-scripts start",
30
26
  "copy-assets": "cpx 'src/assets/icon/**/*' dist/assets/icon",
31
- "build": "webpack --config webpack.config.js && yarn copy-assets",
27
+ "build": "tsc -p . && yarn copy-assets",
32
28
  "test": "react-scripts test",
33
29
  "eject": "react-scripts eject",
34
30
  "storybook": "storybook dev -p 6006",
Binary file
@@ -0,0 +1,43 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ <meta name="theme-color" content="#000000" />
8
+ <meta
9
+ name="description"
10
+ content="Web site created using create-react-app"
11
+ />
12
+ <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13
+ <!--
14
+ manifest.json provides metadata used when your web app is installed on a
15
+ user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16
+ -->
17
+ <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18
+ <!--
19
+ Notice the use of %PUBLIC_URL% in the tags above.
20
+ It will be replaced with the URL of the `public` folder during the build.
21
+ Only files inside the `public` folder can be referenced from the HTML.
22
+
23
+ Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24
+ work correctly both with client-side routing and a non-root public URL.
25
+ Learn how to configure a non-root public URL by running `npm run build`.
26
+ -->
27
+ <title>React App</title>
28
+ </head>
29
+ <body>
30
+ <noscript>You need to enable JavaScript to run this app.</noscript>
31
+ <div id="root"></div>
32
+ <!--
33
+ This HTML file is a template.
34
+ If you open it directly in the browser, you will see an empty page.
35
+
36
+ You can add webfonts, meta tags, or analytics to this file.
37
+ The build step will place the bundled scripts into the <body> tag.
38
+
39
+ To begin the development, run `npm start` or `yarn start`.
40
+ To create a production bundle, use `npm run build` or `yarn build`.
41
+ -->
42
+ </body>
43
+ </html>
Binary file
Binary file
@@ -0,0 +1,25 @@
1
+ {
2
+ "short_name": "React App",
3
+ "name": "Create React App Sample",
4
+ "icons": [
5
+ {
6
+ "src": "favicon.ico",
7
+ "sizes": "64x64 32x32 24x24 16x16",
8
+ "type": "image/x-icon"
9
+ },
10
+ {
11
+ "src": "logo192.png",
12
+ "type": "image/png",
13
+ "sizes": "192x192"
14
+ },
15
+ {
16
+ "src": "logo512.png",
17
+ "type": "image/png",
18
+ "sizes": "512x512"
19
+ }
20
+ ],
21
+ "start_url": ".",
22
+ "display": "standalone",
23
+ "theme_color": "#000000",
24
+ "background_color": "#ffffff"
25
+ }
@@ -0,0 +1,3 @@
1
+ # https://www.robotstxt.org/robotstxt.html
2
+ User-agent: *
3
+ Disallow:
@@ -0,0 +1,6 @@
1
+ import { default as docCheckSVG } from './doc-check.svg'
2
+ import { default as alertSVG } from './alert.svg'
3
+ import { default as commentSVG } from './comment.svg'
4
+ import { default as imageSVG } from './image.svg'
5
+ import { default as closeSVG } from './close.svg'
6
+ export { docCheckSVG, alertSVG, commentSVG, imageSVG, closeSVG }
@@ -0,0 +1,47 @@
1
+ import React from 'react'
2
+ import { BannerStyled } from './styles'
3
+ import { BannerTypes } from '../Types'
4
+ import { docCheckSVG, alertSVG, commentSVG, closeSVG } from '../../assets/icon'
5
+ import { IconWrapper } from '../IconWrapper'
6
+ import { Paragraph } from '../Paragraph'
7
+ import { theme } from '../Themes'
8
+ const {
9
+ colors: { cyan40, mint40, honey40, red40, shade40, shade30 },
10
+ } = theme
11
+ export const Banner: React.FC<BannerTypes> = ({ title, onClick, variant, subTitle }) => {
12
+ const searchIcon = () => {
13
+ switch (variant) {
14
+ case 'notice':
15
+ return { icon: commentSVG, color: cyan40 }
16
+ case 'success':
17
+ return { icon: docCheckSVG, color: mint40 }
18
+ case 'warning':
19
+ return { icon: alertSVG, color: honey40 }
20
+ case 'danger':
21
+ return { icon: alertSVG, color: red40 }
22
+ default:
23
+ return { icon: commentSVG, color: cyan40 }
24
+ }
25
+ }
26
+
27
+ const { icon, color } = searchIcon()
28
+
29
+ return (
30
+ <BannerStyled variant={variant}>
31
+ <div className={'bannerWrapper'}>
32
+ <IconWrapper src={icon} className={'buttonRadiusWrapperIcon'} />
33
+ <span>
34
+ <Paragraph size={'medium'} color={color}>
35
+ {title}
36
+ </Paragraph>
37
+ {subTitle && (
38
+ <Paragraph size={'small'} color={shade40}>
39
+ {subTitle}
40
+ </Paragraph>
41
+ )}
42
+ </span>
43
+ </div>
44
+ <IconWrapper src={closeSVG} width={'14px'} height={'14px'} color={shade30} onClick={onClick} />
45
+ </BannerStyled>
46
+ )
47
+ }
@@ -0,0 +1,31 @@
1
+ import { Meta, StoryObj } from '@storybook/react'
2
+ import { VARIANTS_TYPES_BANNER } from '../../utils/constanst'
3
+
4
+ import { Banner } from './index'
5
+
6
+ const meta: Meta<typeof Banner> = {
7
+ title: 'Components/Banner',
8
+ component: Banner,
9
+ tags: ['autodocs'],
10
+ argTypes: {
11
+ variant: {
12
+ control: {
13
+ type: 'select',
14
+ options: VARIANTS_TYPES_BANNER,
15
+ },
16
+ },
17
+
18
+ onClick: { action: 'clicked' },
19
+ },
20
+ } satisfies Meta<typeof Banner>
21
+
22
+ export default meta
23
+ type Story = StoryObj<typeof Banner>
24
+
25
+ export const Playground: Story = {
26
+ args: {
27
+ variant: 'success',
28
+ title: 'Sucesso!',
29
+ subTitle: 'Mensagem de sucesso.',
30
+ },
31
+ }
@@ -0,0 +1,59 @@
1
+ import styled, { css } from 'styled-components'
2
+ import { theme } from '../Themes'
3
+
4
+ import { BannerTypes } from '../Types'
5
+
6
+ const { colors } = theme
7
+ const buttonRadiusWrapperIconStyles = (color: string) => css`
8
+ .buttonRadiusWrapperIcon {
9
+ svg {
10
+ fill: ${color};
11
+ path {
12
+ fill: ${color};
13
+ }
14
+ }
15
+ }
16
+ `
17
+ const colorScheme = {
18
+ notice: css`
19
+ background: ${colors.cyan10};
20
+ border-color: ${colors.cyan40};
21
+ ${buttonRadiusWrapperIconStyles(colors.cyan40)};
22
+ `,
23
+ danger: css`
24
+ background: ${colors.red10};
25
+ border-color: ${colors.red40};
26
+ ${buttonRadiusWrapperIconStyles(colors.red40)};
27
+ `,
28
+ warning: css`
29
+ background: ${colors.honey10};
30
+ border-color: ${colors.honey40};
31
+ ${buttonRadiusWrapperIconStyles(colors.honey40)};
32
+ `,
33
+ success: css`
34
+ background: ${colors.mint10};
35
+ border-color: ${colors.mint40};
36
+ ${buttonRadiusWrapperIconStyles(colors.mint40)};
37
+ `,
38
+ } as const
39
+
40
+ export const BannerStyled = styled.div<BannerTypes>`
41
+ display: flex;
42
+ box-sizing: border-box;
43
+ justify-content: space-between;
44
+ align-items: center;
45
+ width: 100%;
46
+ height: 100%;
47
+ max-height: 100px;
48
+ min-height: 56px;
49
+ padding: 12px 24px;
50
+ border-radius: 16px;
51
+ border: 1px dashed;
52
+ ${({ variant = 'notice' }) => colorScheme[variant]};
53
+
54
+ .bannerWrapper {
55
+ display: flex;
56
+ align-items: center;
57
+ gap: 12px;
58
+ }
59
+ `
@@ -0,0 +1,31 @@
1
+ import React from 'react'
2
+ import { IconWrapper } from '../IconWrapper'
3
+ import { ButtonStyled } from './styles'
4
+ import { ButtonTypes } from '../Types'
5
+
6
+ export const Button: React.FC<ButtonTypes> = ({
7
+ variant = 'primary',
8
+ children,
9
+ disabled = false,
10
+ icon,
11
+ radius,
12
+ outline,
13
+ halfLeft,
14
+ halfRight,
15
+ fullWidth,
16
+ ...props
17
+ }) => (
18
+ <ButtonStyled
19
+ variant={variant}
20
+ disabled={disabled}
21
+ radius={radius}
22
+ outline={outline}
23
+ halfLeft={halfLeft}
24
+ halfRight={halfRight}
25
+ fullWidth={fullWidth}
26
+ {...props}
27
+ >
28
+ {icon && <IconWrapper src={icon} color={'white'} className={'buttonRadiusWrapperIcon'} />}
29
+ {children}
30
+ </ButtonStyled>
31
+ )
@@ -0,0 +1,98 @@
1
+ import { Meta, StoryObj } from '@storybook/react'
2
+ import exampleIcon from '../../assets/icon/image.svg'
3
+ import { Button } from './index'
4
+ import { VARIANTS_TYPES } from '../../utils/constanst'
5
+
6
+ const meta: Meta<typeof Button> = {
7
+ title: 'Components/Button',
8
+ component: Button,
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: 'object',
22
+ options: [exampleIcon],
23
+ description: exampleIcon,
24
+ },
25
+
26
+ onClick: { action: 'clicked' },
27
+ },
28
+ } satisfies Meta<typeof Button>
29
+
30
+ export default meta
31
+ type Story = StoryObj<typeof Button>
32
+
33
+ export const Playground: Story = {
34
+ args: {
35
+ variant: 'primary',
36
+ children: 'ButtonPlayground',
37
+ disabled: false,
38
+ },
39
+ }
40
+
41
+ export const ButtonDefault: Story = {
42
+ args: {
43
+ variant: 'secondary',
44
+ children: 'ButtonPlayground',
45
+ disabled: false,
46
+ },
47
+ }
48
+
49
+ export const ButtonOutilne: Story = {
50
+ args: {
51
+ variant: 'secondary',
52
+ children: 'ButtonPlayground',
53
+ disabled: false,
54
+ outline: true,
55
+ },
56
+ }
57
+ export const ButtonRadius: Story = {
58
+ args: {
59
+ variant: 'success',
60
+ children: 'ButtonPlayground',
61
+ disabled: false,
62
+ radius: true,
63
+ },
64
+ }
65
+
66
+ export const ButtonDisabled: Story = {
67
+ args: {
68
+ variant: 'danger',
69
+ children: 'ButtonPlayground',
70
+ disabled: true,
71
+ },
72
+ }
73
+
74
+ export const ButtonIcon: Story = {
75
+ args: {
76
+ variant: 'primary',
77
+ children: 'ButtonPlayground',
78
+ icon: exampleIcon,
79
+ },
80
+ }
81
+
82
+ export const ButtonIconHalfRightOutiline: Story = {
83
+ args: {
84
+ variant: 'success',
85
+ children: 'ButtonPlayground',
86
+ icon: exampleIcon,
87
+ halfRight: true,
88
+ outline: true,
89
+ },
90
+ }
91
+ export const ButtonIconHalfLeft: Story = {
92
+ args: {
93
+ variant: 'success',
94
+ children: 'ButtonPlayground',
95
+ icon: exampleIcon,
96
+ halfLeft: true,
97
+ },
98
+ }
@@ -0,0 +1,198 @@
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
+ `