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.
Files changed (77) hide show
  1. package/package.json +4 -1
  2. package/.storybook/main.ts +0 -19
  3. package/.storybook/preview.ts +0 -14
  4. package/public/favicon.ico +0 -0
  5. package/public/index.html +0 -43
  6. package/public/logo192.png +0 -0
  7. package/public/logo512.png +0 -0
  8. package/public/manifest.json +0 -25
  9. package/public/robots.txt +0 -3
  10. package/src/assets/icon/alert.svg +0 -3
  11. package/src/assets/icon/close.svg +0 -10
  12. package/src/assets/icon/comment.svg +0 -10
  13. package/src/assets/icon/doc-check.svg +0 -10
  14. package/src/assets/icon/image.svg +0 -3
  15. package/src/assets/icon/index.ts +0 -6
  16. package/src/assets/icon/svg.d.ts +0 -1
  17. package/src/components/Banner/index.tsx +0 -47
  18. package/src/components/Banner/stories.tsx +0 -31
  19. package/src/components/Banner/styles.ts +0 -58
  20. package/src/components/Button/index.tsx +0 -31
  21. package/src/components/Button/stories.tsx +0 -98
  22. package/src/components/Button/styles.ts +0 -198
  23. package/src/components/Button/test.tsx +0 -44
  24. package/src/components/ButtonRadiusIcon/index.tsx +0 -22
  25. package/src/components/ButtonRadiusIcon/stories.tsx +0 -47
  26. package/src/components/ButtonRadiusIcon/styles.ts +0 -139
  27. package/src/components/ButtonRound/index.tsx +0 -25
  28. package/src/components/ButtonRound/stories.tsx +0 -50
  29. package/src/components/ButtonRound/styles.ts +0 -136
  30. package/src/components/IconWrapper/index.tsx +0 -43
  31. package/src/components/Modal/index.tsx +0 -30
  32. package/src/components/Modal/stories.tsx +0 -53
  33. package/src/components/Modal/styles.ts +0 -51
  34. package/src/components/Paragraph/index.tsx +0 -42
  35. package/src/components/Paragraph/stories.tsx +0 -107
  36. package/src/components/Tabs/index.tsx +0 -24
  37. package/src/components/Tabs/stories.tsx +0 -74
  38. package/src/components/Tabs/styles.ts +0 -23
  39. package/src/components/Themes/index.ts +0 -99
  40. package/src/components/Title/index.tsx +0 -33
  41. package/src/components/Title/stories.tsx +0 -68
  42. package/src/components/Types/index.ts +0 -45
  43. package/src/index.ts +0 -10
  44. package/src/prettier.config.js +0 -11
  45. package/src/react-app-env.d.ts +0 -1
  46. package/src/reportWebVitals.ts +0 -16
  47. package/src/setupTests.ts +0 -5
  48. package/src/src/globalStyles.ts +0 -11
  49. package/src/stories/Button.stories.ts +0 -52
  50. package/src/stories/Button.tsx +0 -42
  51. package/src/stories/Configure.mdx +0 -364
  52. package/src/stories/Header.stories.ts +0 -33
  53. package/src/stories/Header.tsx +0 -56
  54. package/src/stories/Page.stories.ts +0 -32
  55. package/src/stories/Page.tsx +0 -73
  56. package/src/stories/assets/accessibility.png +0 -0
  57. package/src/stories/assets/accessibility.svg +0 -1
  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 +0 -1
  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 +0 -1
  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 +0 -1
  71. package/src/stories/assets/youtube.svg +0 -1
  72. package/src/stories/button.css +0 -30
  73. package/src/stories/header.css +0 -32
  74. package/src/stories/page.css +0 -69
  75. package/src/utils/constanst.ts +0 -2
  76. package/tsconfig.json +0 -38
  77. package/webpack.config.js +0 -12
package/package.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "w-design-system",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "main": "dist/index.js",
5
+ "files": [
6
+ "dist"
7
+ ],
5
8
  "types": "dist/types/index.d.ts",
6
9
  "dependencies": {
7
10
  "@svgr/webpack": "^8.1.0",
@@ -1,19 +0,0 @@
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;
@@ -1,14 +0,0 @@
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;
Binary file
package/public/index.html DELETED
@@ -1,43 +0,0 @@
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
@@ -1,25 +0,0 @@
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
- }
package/public/robots.txt DELETED
@@ -1,3 +0,0 @@
1
- # https://www.robotstxt.org/robotstxt.html
2
- User-agent: *
3
- Disallow:
@@ -1,3 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
2
- <path d="M11.6437 3.95156C11.7188 3.825 11.8547 3.75 12 3.75C12.1453 3.75 12.2812 3.825 12.3563 3.95156L21.6516 19.2188C21.7172 19.3266 21.75 19.4484 21.75 19.5703C21.75 19.9453 21.4453 20.25 21.0703 20.25H2.92969C2.55469 20.25 2.25 19.9453 2.25 19.5703C2.25 19.4438 2.28281 19.3219 2.34844 19.2188L11.6437 3.95156ZM9.72187 2.77969L0.426563 18.0469C0.145313 18.5063 0 19.0312 0 19.5703C0 21.1875 1.3125 22.5 2.92969 22.5H21.0703C22.6875 22.5 24 21.1875 24 19.5703C24 19.0312 23.85 18.5063 23.5734 18.0469L14.2781 2.77969C13.7953 1.9875 12.9328 1.5 12 1.5C11.0672 1.5 10.2047 1.9875 9.72187 2.77969ZM13.5 17.25C13.5 16.8522 13.342 16.4706 13.0607 16.1893C12.7794 15.908 12.3978 15.75 12 15.75C11.6022 15.75 11.2206 15.908 10.9393 16.1893C10.658 16.4706 10.5 16.8522 10.5 17.25C10.5 17.6478 10.658 18.0294 10.9393 18.3107C11.2206 18.592 11.6022 18.75 12 18.75C12.3978 18.75 12.7794 18.592 13.0607 18.3107C13.342 18.0294 13.5 17.6478 13.5 17.25ZM13.125 8.625C13.125 8.00156 12.6234 7.5 12 7.5C11.3766 7.5 10.875 8.00156 10.875 8.625V13.125C10.875 13.7484 11.3766 14.25 12 14.25C12.6234 14.25 13.125 13.7484 13.125 13.125V8.625Z" fill="black"/>
3
- </svg>
@@ -1,10 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
2
- <g clip-path="url(#clip0_125_9544)">
3
- <path d="M23.6483 23.6483C23.1793 24.1172 22.4206 24.1172 21.9511 23.6483L12.0011 13.6961L2.04892 23.6483C1.57996 24.1172 0.821207 24.1172 0.351721 23.6483C-0.11724 23.1793 -0.11724 22.4206 0.351721 21.9511L10.3062 12.0011L0.353221 2.04892C-0.11574 1.57996 -0.11574 0.821207 0.353221 0.351721C0.822182 -0.11724 1.58093 -0.11724 2.05042 0.351721L12.0011 10.3062L21.9533 0.353971C22.4223 -0.11499 23.181 -0.11499 23.6505 0.353971C24.1195 0.822932 24.1195 1.58168 23.6505 2.05117L13.6961 12.0011L23.6483 21.9533C24.1208 22.4183 24.1208 23.1833 23.6483 23.6483Z" fill="black"/>
4
- </g>
5
- <defs>
6
- <clipPath id="clip0_125_9544">
7
- <rect width="24" height="24" fill="white" transform="matrix(0 -1 1 0 0 24)"/>
8
- </clipPath>
9
- </defs>
10
- </svg>
@@ -1,10 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
2
- <g clip-path="url(#clip0_125_9497)">
3
- <path d="M9.75 19.5C9.75 18.2578 8.74219 17.25 7.5 17.25H3C2.5875 17.25 2.25 16.9125 2.25 16.5V3C2.25 2.5875 2.5875 2.25 3 2.25H21C21.4125 2.25 21.75 2.5875 21.75 3V16.5C21.75 16.9125 21.4125 17.25 21 17.25H14.4984C14.0109 17.25 13.5375 17.4094 13.1484 17.7L9.75 20.25V19.5ZM9.74063 23.0719L9.75 23.0625L14.4984 19.5H21C22.6547 19.5 24 18.1547 24 16.5V3C24 1.34531 22.6547 0 21 0H3C1.34531 0 0 1.34531 0 3V16.5C0 18.1547 1.34531 19.5 3 19.5H5.25H7.5V21.75V21.9375V21.9516V22.2516V23.25C7.5 23.5359 7.65938 23.7937 7.9125 23.9203C8.16563 24.0469 8.47031 24.0187 8.7 23.85L9.50156 23.25L9.74063 23.0719ZM5.625 9C5.00156 9 4.5 9.50156 4.5 10.125C4.5 10.7484 5.00156 11.25 5.625 11.25H12.375C12.9984 11.25 13.5 10.7484 13.5 10.125C13.5 9.50156 12.9984 9 12.375 9H5.625ZM16.125 9C15.5016 9 15 9.50156 15 10.125C15 10.7484 15.5016 11.25 16.125 11.25H18.375C18.9984 11.25 19.5 10.7484 19.5 10.125C19.5 9.50156 18.9984 9 18.375 9H16.125ZM5.625 12.75C5.00156 12.75 4.5 13.2516 4.5 13.875C4.5 14.4984 5.00156 15 5.625 15H7.875C8.49844 15 9 14.4984 9 13.875C9 13.2516 8.49844 12.75 7.875 12.75H5.625ZM11.625 12.75C11.0016 12.75 10.5 13.2516 10.5 13.875C10.5 14.4984 11.0016 15 11.625 15H18.375C18.9984 15 19.5 14.4984 19.5 13.875C19.5 13.2516 18.9984 12.75 18.375 12.75H11.625Z" fill="black"/>
4
- </g>
5
- <defs>
6
- <clipPath id="clip0_125_9497">
7
- <rect width="24" height="24" fill="white"/>
8
- </clipPath>
9
- </defs>
10
- </svg>
@@ -1,10 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="18" height="24" viewBox="0 0 18 24" fill="none">
2
- <g clip-path="url(#clip0_118_7931)">
3
- <path d="M3 21.75C2.5875 21.75 2.25 21.4125 2.25 21V3C2.25 2.5875 2.5875 2.25 3 2.25H10.5V6C10.5 6.82969 11.1703 7.5 12 7.5H15.75V21C15.75 21.4125 15.4125 21.75 15 21.75H3ZM3 0C1.34531 0 0 1.34531 0 3V21C0 22.6547 1.34531 24 3 24H15C16.6547 24 18 22.6547 18 21V7.24219C18 6.44531 17.6859 5.68125 17.1234 5.11875L12.8766 0.876563C12.3141 0.314063 11.5547 0 10.7578 0H3ZM13.5469 12.5438C13.9875 12.1031 13.9875 11.3906 13.5469 10.9547C13.1062 10.5188 12.3938 10.5141 11.9578 10.9547L7.75312 15.1594L6.04688 13.4531C5.60625 13.0125 4.89375 13.0125 4.45781 13.4531C4.02187 13.8938 4.01719 14.6062 4.45781 15.0422L6.95625 17.5406C7.16719 17.7516 7.45312 17.8688 7.75312 17.8688C8.05312 17.8688 8.33906 17.7516 8.55 17.5406L13.5469 12.5438Z" fill="black"/>
4
- </g>
5
- <defs>
6
- <clipPath id="clip0_118_7931">
7
- <rect width="18" height="24" fill="white"/>
8
- </clipPath>
9
- </defs>
10
- </svg>
@@ -1,3 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
2
- <path d="M21.4286 18V20.5714C21.4286 21.0429 21.0429 21.4286 20.5714 21.4286H3.42857C2.95714 21.4286 2.57143 21.0429 2.57143 20.5714V18H21.4286ZM4.03393 15.4286H2.57143V3.42857C2.57143 2.95714 2.95714 2.57143 3.42857 2.57143H20.5714C21.0429 2.57143 21.4286 2.95714 21.4286 3.42857V15.4286H20.1643L15.2196 7.86964C14.9839 7.50536 14.5768 7.28571 14.1429 7.28571C13.7089 7.28571 13.3018 7.50536 13.0661 7.86964L10.0661 12.4554L9.17679 11.2446C8.93571 10.9125 8.55 10.7196 8.1375 10.7196C7.725 10.7196 7.34464 10.9125 7.09821 11.2446L4.03393 15.4286ZM24 15.4286V3.42857C24 1.5375 22.4625 0 20.5714 0H3.42857C1.5375 0 0 1.5375 0 3.42857V15.4286V16.7143V18V20.5714C0 22.4625 1.5375 24 3.42857 24H20.5714C22.4625 24 24 22.4625 24 20.5714V18V16.7143V15.4286ZM7.71429 6C7.71429 5.54534 7.53367 5.10931 7.21218 4.78782C6.89069 4.46633 6.45466 4.28571 6 4.28571C5.54534 4.28571 5.10931 4.46633 4.78782 4.78782C4.46633 5.10931 4.28571 5.54534 4.28571 6C4.28571 6.45466 4.46633 6.89069 4.78782 7.21218C5.10931 7.53367 5.54534 7.71429 6 7.71429C6.45466 7.71429 6.89069 7.53367 7.21218 7.21218C7.53367 6.89069 7.71429 6.45466 7.71429 6Z" fill="black"/>
3
- </svg>
@@ -1,6 +0,0 @@
1
- import docCheckSVG from './doc-check.svg'
2
- import alertSVG from './alert.svg'
3
- import commentSVG from './comment.svg'
4
- import imageSVG from './image.svg'
5
- import closeSVG from './close.svg'
6
- export { docCheckSVG, alertSVG, commentSVG, imageSVG, closeSVG }
@@ -1 +0,0 @@
1
- declare module '*.svg'
@@ -1,47 +0,0 @@
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
- }
@@ -1,31 +0,0 @@
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
- }
@@ -1,58 +0,0 @@
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
- min-height: 56px;
48
- padding: 12px 24px;
49
- border-radius: 16px;
50
- border: 1px dashed;
51
- ${({ variant = 'notice' }) => colorScheme[variant]};
52
-
53
- .bannerWrapper {
54
- display: flex;
55
- align-items: center;
56
- gap: 12px;
57
- }
58
- `
@@ -1,31 +0,0 @@
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
- )
@@ -1,98 +0,0 @@
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
- }
@@ -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
- `