@sakura-ui/sakura-ui 0.1.16 → 0.1.17

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 (66) hide show
  1. package/package.json +1 -1
  2. package/packages/config/package.json +2 -1
  3. package/packages/config/src/index.ts +8 -0
  4. package/packages/core/package.json +2 -1
  5. package/packages/core/src/components/Button.tsx +23 -56
  6. package/packages/core/src/components/Card.tsx +14 -14
  7. package/packages/core/src/components/Code.tsx +1 -1
  8. package/packages/core/src/components/Faq.tsx +3 -5
  9. package/packages/core/src/components/Heading.tsx +1 -1
  10. package/packages/core/src/components/Icon.tsx +2 -6
  11. package/packages/core/src/components/IconButton.tsx +47 -76
  12. package/packages/core/src/components/InfoCard.tsx +1 -1
  13. package/packages/core/src/components/Link.tsx +53 -44
  14. package/packages/core/src/components/List.tsx +1 -1
  15. package/packages/core/src/components/Pre.tsx +1 -1
  16. package/packages/core/src/components/Table.tsx +1 -1
  17. package/packages/core/src/components/buttonStyle.ts +83 -0
  18. package/packages/core/src/components/index.ts +24 -7
  19. package/packages/core/src/index.ts +26 -0
  20. package/packages/core/src/libs/forward-ref.ts +41 -0
  21. package/packages/core/src/types/component.ts +82 -0
  22. package/packages/forms/dist/components/Checkbox.d.ts.map +1 -1
  23. package/packages/forms/dist/components/Checkbox.js +26 -23
  24. package/packages/forms/dist/components/Checkbox.js.map +1 -1
  25. package/packages/forms/dist/components/FileInput.d.ts +5 -0
  26. package/packages/forms/dist/components/FileInput.d.ts.map +1 -0
  27. package/packages/forms/dist/components/FileInput.js +51 -0
  28. package/packages/forms/dist/components/FileInput.js.map +1 -0
  29. package/packages/forms/dist/components/Input.d.ts.map +1 -1
  30. package/packages/forms/dist/components/Input.js +1 -0
  31. package/packages/forms/dist/components/Input.js.map +1 -1
  32. package/packages/forms/dist/components/LabelControl.d.ts.map +1 -1
  33. package/packages/forms/dist/components/LabelControl.js +7 -1
  34. package/packages/forms/dist/components/LabelControl.js.map +1 -1
  35. package/packages/forms/dist/components/Radio.d.ts.map +1 -1
  36. package/packages/forms/dist/components/Radio.js +25 -23
  37. package/packages/forms/dist/components/Radio.js.map +1 -1
  38. package/packages/forms/dist/components/Select.d.ts.map +1 -1
  39. package/packages/forms/dist/components/Select.js +1 -0
  40. package/packages/forms/dist/components/Select.js.map +1 -1
  41. package/packages/forms/dist/components/Textarea.d.ts.map +1 -1
  42. package/packages/forms/dist/components/Textarea.js +1 -0
  43. package/packages/forms/dist/components/Textarea.js.map +1 -1
  44. package/packages/forms/dist/components/index.d.ts +8 -7
  45. package/packages/forms/dist/components/index.d.ts.map +1 -1
  46. package/packages/forms/dist/components/index.js +1 -0
  47. package/packages/forms/dist/components/index.js.map +1 -1
  48. package/packages/forms/dist/index.cjs.js +103 -59
  49. package/packages/forms/dist/index.cjs.js.map +1 -1
  50. package/packages/forms/dist/index.d.ts +2 -1
  51. package/packages/forms/dist/index.d.ts.map +1 -1
  52. package/packages/forms/dist/index.es.js +383 -313
  53. package/packages/forms/dist/index.es.js.map +1 -1
  54. package/packages/forms/dist/index.js +1 -1
  55. package/packages/forms/dist/index.js.map +1 -1
  56. package/packages/forms/package.json +2 -1
  57. package/packages/forms/src/components/Checkbox.tsx +26 -23
  58. package/packages/forms/src/components/FileInput.tsx +77 -0
  59. package/packages/forms/src/components/Input.tsx +1 -0
  60. package/packages/forms/src/components/LabelControl.tsx +13 -6
  61. package/packages/forms/src/components/Radio.tsx +27 -23
  62. package/packages/forms/src/components/Select.tsx +1 -0
  63. package/packages/forms/src/components/Textarea.tsx +1 -0
  64. package/packages/forms/src/components/index.ts +8 -7
  65. package/packages/forms/src/index.ts +12 -0
  66. /package/packages/core/src/{utils/class.ts → libs/cx.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sakura-ui/sakura-ui",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "keywords": [],
5
5
  "author": "glassonion1",
6
6
  "homepage": "https://github.com/glassonion1/sakura-ui",
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@sakura-ui/config",
3
- "version": "0.1.5",
3
+ "version": "0.1.8",
4
4
  "main": "dist/index.cjs.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {
7
7
  ".": {
8
+ "types": "./dist/index.d.ts",
8
9
  "require": "./dist/index.cjs.js",
9
10
  "import": "./dist/index.es.js"
10
11
  }
@@ -155,6 +155,14 @@ const sakuraPlugin = plugin(
155
155
  fontWeight: '700'
156
156
  }
157
157
  ],
158
+ 'button-sm': [
159
+ '14px',
160
+ {
161
+ lineHeight: '14px',
162
+ letterSpacing: '0.04em',
163
+ fontWeight: '700'
164
+ }
165
+ ],
158
166
  label: [
159
167
  '14px',
160
168
  {
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@sakura-ui/core",
3
- "version": "0.1.16",
3
+ "version": "0.1.27",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
8
8
  ".": {
9
+ "types": "./dist/index.d.ts",
9
10
  "require": "./dist/index.cjs.js",
10
11
  "import": "./dist/index.es.js"
11
12
  }
@@ -1,70 +1,37 @@
1
- import React from 'react'
2
- import { cx } from '../utils/class'
1
+ import { cx } from '../libs/cx'
2
+ import { ComponentWithAs } from '../types/component'
3
+ import { forwardRef } from '../libs/forward-ref'
4
+ import { base, getVariantStyle, getSizeStyle } from './buttonStyle'
3
5
 
4
- export interface ButtonProps extends React.ComponentPropsWithRef<'button'> {
6
+ export interface ButtonProps {
5
7
  variant?: 'primary' | 'secondary'
6
- textAlign?: 'left' | 'right' | 'center'
8
+ size?: 'lg' | 'md' | 'sm' | 'xs'
7
9
  }
8
10
 
9
- export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
11
+ export const Button: ComponentWithAs<'button', ButtonProps> = forwardRef(
10
12
  (props, ref) => {
11
- // Make sure that there is no problem even if className is specified on the side that uses the component
12
- const { className, children, textAlign, variant, ...restProps } = props
13
-
14
- const align = textAlign ?? 'center'
15
-
16
- const style = `
17
- select-none
18
- inline-block
19
- p-4
20
- text-button
21
- text-${align}
22
- rounded-lg
23
- cursor-pointer
24
- whitespace-nowrap
25
- border
26
- border-solid
27
- border-sea-800
28
- active:enabled:border-sea-800/[.8]
29
- hover:enabled:border-sea-800/[.85]
30
- focus:outline
31
- focus:outline-2
32
- focus:outline-wood-600
33
- disabled:border-sumi-500
34
- disabled:cursor-not-allowed
35
- `
36
-
37
- const primary = `
38
- text-white-1000
39
- bg-sea-800
40
- active:enabled:bg-sea-800/[.8]
41
- hover:enabled:bg-sea-800/[.85]
42
- disabled:bg-sumi-500
43
- disabled:text-white-1000
44
- `
45
- const secondary = `
46
- text-sea-800
47
- bg-transparent
48
- active:enabled:bg-sea-50/[.60]
49
- hover:enabled:bg-sea-50
50
- active:enabled:text-sea-800/[.85]
51
- hover:enabled:text-sea-800/[.85]
52
- disabled:text-sumi-500
53
- `
54
-
55
- const styles = {
56
- primary: primary,
57
- secondary: secondary
58
- }
13
+ const {
14
+ as: Component = 'button',
15
+ variant = 'primary',
16
+ size = 'lg',
17
+ className,
18
+ children,
19
+ ...restProps
20
+ } = props
59
21
 
60
22
  return (
61
- <button
62
- className={cx(style, styles[variant ?? 'primary'], className)}
23
+ <Component
24
+ className={cx(
25
+ base,
26
+ getVariantStyle(variant),
27
+ getSizeStyle(size),
28
+ className
29
+ )}
63
30
  {...restProps}
64
31
  ref={ref}
65
32
  >
66
33
  {children}
67
- </button>
34
+ </Component>
68
35
  )
69
36
  }
70
37
  )
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { cx } from '../utils/class'
2
+ import { cx } from '../libs/cx'
3
3
 
4
4
  interface IdContextType {
5
5
  id: string
@@ -23,8 +23,6 @@ export const Card = (props: CardProps) => {
23
23
  sm:rounded-3xl
24
24
  text-sumi-900
25
25
  overflow-hidden
26
- flex
27
- flex-col
28
26
  `
29
27
 
30
28
  return (
@@ -48,21 +46,22 @@ export const CardHeader = (props: CardHeaderProps) => {
48
46
  const ctx = React.useContext(IdContext)
49
47
 
50
48
  const style = `
51
- py-6
52
49
  px-6
53
- text-h-xxs-m
54
- sm:text-h-xxs
55
- leading-none
50
+ first:pt-6
51
+ last:pb-6
52
+ py-3
53
+ text-base
54
+ font-medium
56
55
  `
57
56
 
58
57
  return (
59
- <h2 id={ctx.id} className={cx(style, className)} {...restProps}>
58
+ <div id={ctx.id} className={cx(style, className)} {...restProps}>
60
59
  {children}
61
- </h2>
60
+ </div>
62
61
  )
63
62
  }
64
63
 
65
- export interface CardBodyProps extends React.ComponentPropsWithoutRef<'p'> {}
64
+ export interface CardBodyProps extends React.ComponentPropsWithoutRef<'div'> {}
66
65
 
67
66
  export const CardBody = (props: CardBodyProps) => {
68
67
  const { className, children, ...restProps } = props
@@ -70,8 +69,9 @@ export const CardBody = (props: CardBodyProps) => {
70
69
  const style = `
71
70
  px-6
72
71
  first:pt-6
73
- pb-6
74
- text-base
72
+ last:pb-6
73
+ pb-3
74
+ text-base-sm
75
75
  `
76
76
 
77
77
  return (
@@ -88,10 +88,10 @@ export const CardFooter = (props: CardFooterProps) => {
88
88
  const { className, children, ...restProps } = props
89
89
 
90
90
  const style = `
91
- mt-auto
92
91
  px-6
93
92
  first:pt-6
94
- pb-6
93
+ last:pb-6
94
+ text-base-sm
95
95
  `
96
96
 
97
97
  return (
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { cx } from '../utils/class'
2
+ import { cx } from '../libs/cx'
3
3
 
4
4
  export interface CodeProps extends React.ComponentPropsWithoutRef<'code'> {}
5
5
 
@@ -1,12 +1,11 @@
1
1
  import React from 'react'
2
- import { cx } from '../utils/class'
2
+ import { cx } from '../libs/cx'
3
3
 
4
4
  export interface FaqProps extends React.ComponentPropsWithoutRef<'dl'> {}
5
5
 
6
6
  const headingStyle = `
7
7
  text-h-med-m
8
8
  sm:text-h-med
9
- !leading-none
10
9
  `
11
10
 
12
11
  export const Faq = (props: FaqProps) => {
@@ -41,8 +40,7 @@ export const Question = (props: QuestionProps) => {
41
40
  flex
42
41
  flex-row
43
42
  gap-8
44
- mt-10
45
- first:mt-0
43
+ mt-8
46
44
  `
47
45
  return (
48
46
  <dt
@@ -75,7 +73,7 @@ export const Answer = (props: AnswerProps) => {
75
73
  itemType="https://schema.org/Answer"
76
74
  {...restProps}
77
75
  >
78
- <span className={headingStyle} aria-hidden="true">
76
+ <span className={cx(headingStyle, '!leading-none')} aria-hidden="true">
79
77
  A
80
78
  </span>
81
79
  <span itemProp="text">{children}</span>
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { cx } from '../utils/class'
2
+ import { cx } from '../libs/cx'
3
3
 
4
4
  export interface HeadingProps extends React.ComponentPropsWithoutRef<'h1'> {}
5
5
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { cx } from '../utils/class'
2
+ import { cx } from '../libs/cx'
3
3
 
4
4
  export interface IconProps extends React.ComponentPropsWithRef<'span'> {
5
5
  icon: string
@@ -9,14 +9,10 @@ export const Icon = React.forwardRef<HTMLElement, IconProps>((props, ref) => {
9
9
  const { className, icon, ...restProps } = props
10
10
 
11
11
  const style = `
12
- inline-block
12
+ inline
13
13
  align-middle
14
14
  font-icon
15
- text-2xl
16
- font-light
17
- leading-none
18
15
  antialiased
19
- mb-1
20
16
  `
21
17
 
22
18
  return (
@@ -1,107 +1,78 @@
1
- import React from 'react'
2
- import { cx } from '../utils/class'
1
+ import { cx } from '../libs/cx'
2
+ import { ComponentWithAs } from '../types/component'
3
+ import { forwardRef } from '../libs/forward-ref'
4
+ import { base, getVariantStyle, getSizeStyle } from './buttonStyle'
3
5
 
4
- export interface IconButtonProps extends React.ComponentPropsWithRef<'button'> {
6
+ export interface IconButtonProps {
5
7
  variant?: 'primary' | 'secondary'
8
+ size?: 'lg' | 'md' | 'sm' | 'xs'
6
9
  iconLayout?: 'left' | 'right'
7
- rounded?: string
8
10
  icon: string
11
+ rounded?: string
9
12
  }
10
13
 
11
- export const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(
12
- (props, ref) => {
14
+ export const IconButton: ComponentWithAs<'button', IconButtonProps> =
15
+ forwardRef((props, ref) => {
13
16
  const {
14
- className,
15
- children,
16
- variant,
17
+ as: Component = 'button',
18
+ variant = 'primary',
19
+ size = 'lg',
20
+ iconLayout = 'left',
17
21
  icon,
18
- iconLayout,
19
22
  rounded,
23
+ className,
24
+ children,
20
25
  ...restProps
21
26
  } = props
22
27
 
23
- const layout = iconLayout ?? 'left'
24
-
25
- const align = 'center'
26
-
27
- const style = `
28
- ${rounded === 'full' ? 'aspect-square' : ''}
29
- inline-block
30
- p-4
31
- text-button
32
- text-${align}
33
- rounded-${rounded ? rounded : 'lg'}
34
- cursor-pointer
35
- whitespace-nowrap
36
- border
37
- border-solid
38
- border-sea-800
39
- active:enabled:border-sea-800/[.8]
40
- hover:enabled:border-sea-800/[.85]
41
- focus:outline
42
- focus:outline-2
43
- focus:outline-wood-600
44
- disabled:border-sumi-500
45
- disabled:cursor-not-allowed
46
- `
28
+ const styleFontSize = `${size === 'xs' ? `scale-105` : `scale-125`}`
47
29
 
48
- const primary = `
49
- text-white-1000
50
- bg-sea-800
51
- active:enabled:bg-sea-800/[.8]
52
- hover:enabled:bg-sea-800/[.85]
53
- disabled:bg-sumi-500
54
- disabled:text-white-1000
55
- `
56
- const secondary = `
57
- text-sea-800
58
- bg-transparent
59
- active:enabled:bg-sea-50/[.60]
60
- hover:enabled:bg-sea-50
61
- active:enabled:text-sea-800/[.85]
62
- hover:enabled:text-sea-800/[.85]
63
- disabled:text-sumi-500
64
- `
30
+ const styleIcon = `
31
+ inline-block
32
+ align-middle
33
+ mb-1
34
+ font-icon
35
+ font-light
36
+ leading-[0px]
37
+ antialiased
38
+ `
65
39
 
66
- const styles = {
67
- primary: primary,
68
- secondary: secondary
69
- }
70
-
71
- const iconStyle = `
72
- inline-block
73
- align-middle
74
- font-icon
75
- text-2xl
76
- font-light
77
- leading-4
78
- antialiased
79
- mb-1
80
- `
40
+ const styleRounded = `${rounded ? `aspect-square !rounded-full !py-0` : ''}`
81
41
 
82
42
  // When text is specified on a button, set the 'aria-hidden' attribute of the icon to true.
83
43
  const ariaHidden = children ? true : false
84
44
 
85
45
  return (
86
- <button
87
- className={cx(style, styles[variant ?? 'primary'], className)}
46
+ <Component
47
+ className={cx(
48
+ base,
49
+ getVariantStyle(variant),
50
+ getSizeStyle(size),
51
+ styleRounded,
52
+ className
53
+ )}
88
54
  {...restProps}
89
55
  ref={ref}
90
56
  >
91
- {layout == 'left' && (
92
- <span className={cx(iconStyle)} aria-hidden={ariaHidden}>
57
+ {iconLayout == 'left' && (
58
+ <span
59
+ className={cx(styleIcon, styleFontSize)}
60
+ aria-hidden={ariaHidden}
61
+ >
93
62
  {icon}
94
63
  </span>
95
64
  )}
96
- {children && <span className="mx-1 inline-block">{children}</span>}
97
- {layout == 'right' && (
98
- <span className={cx(iconStyle)} aria-hidden={ariaHidden}>
65
+ {children && <span className="mx-1">{children}</span>}
66
+ {iconLayout == 'right' && (
67
+ <span
68
+ className={cx(styleIcon, styleFontSize)}
69
+ aria-hidden={ariaHidden}
70
+ >
99
71
  {icon}
100
72
  </span>
101
73
  )}
102
- </button>
74
+ </Component>
103
75
  )
104
- }
105
- )
76
+ })
106
77
 
107
78
  IconButton.displayName = 'IconButton'
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { cx } from '../utils/class'
2
+ import { cx } from '../libs/cx'
3
3
 
4
4
  export interface InfoCardProps
5
5
  extends React.ComponentPropsWithoutRef<'section'> {
@@ -1,47 +1,29 @@
1
- import React from 'react'
2
- import { cx } from '../utils/class'
1
+ import { useState, useEffect } from 'react'
2
+ import { cx } from '../libs/cx'
3
+ import { ComponentWithAs } from '../types/component'
4
+ import { forwardRef } from '../libs/forward-ref'
3
5
 
4
- const getFileType = (url: string) => {
5
- const converted = url.toLowerCase()
6
+ export interface LinkProps {}
6
7
 
7
- if (converted.endsWith('.pdf')) {
8
- return 'PDF'
9
- }
10
- if (converted.endsWith('.doc') || converted.endsWith('.docx')) {
11
- return 'Word'
12
- }
13
- if (converted.endsWith('.xls') || converted.endsWith('.xlsx')) {
14
- return 'Excel'
15
- }
16
- if (converted.endsWith('.csv')) {
17
- return 'CSV'
18
- }
19
- if (converted.endsWith('.json')) {
20
- return 'JSON'
21
- }
22
- if (converted.endsWith('.ndjson')) {
23
- return 'NDJSON'
24
- }
25
- if (converted.includes('youtu.be')) {
26
- return 'YouTube'
27
- }
28
- return null
29
- }
30
-
31
- export interface LinkProps extends React.ComponentPropsWithRef<'a'> {}
32
-
33
- export const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(
8
+ export const Link: ComponentWithAs<'a', LinkProps> = forwardRef(
34
9
  (props, ref) => {
35
- const { className, children, ...restProps } = props
36
- const href = props.href ?? ''
37
- const fileType = getFileType(href)
10
+ const {
11
+ as: Component = 'a',
12
+ href,
13
+ className,
14
+ children,
15
+ ...restProps
16
+ } = props
17
+
18
+ const styleUnderLine = `
19
+ underline
20
+ underline-offset-[0.125em]
21
+ `
38
22
 
39
23
  const style = `
40
24
  rounded-sm
41
25
  cursor-pointer
42
26
  text-sea-600
43
- underline
44
- underline-offset-[0.125em]
45
27
  hover:text-sea-800
46
28
  active:text-sea-800
47
29
  visited:text-sea-900
@@ -51,9 +33,30 @@ export const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(
51
33
  disabled:border-sumi-500
52
34
  `
53
35
 
54
- if (href.startsWith('http')) {
36
+ const styleIcon = `
37
+ align-middle
38
+ ml-0.5
39
+ text-sumi-700
40
+ font-icon
41
+ font-light
42
+ leading-4
43
+ antialiased
44
+ `
45
+
46
+ const [iconLabel, setIconLabel] = useState('')
47
+ useEffect(() => {
48
+ const language =
49
+ (window.navigator.languages && window.navigator.languages[0]) ||
50
+ window.navigator.language
51
+ if (language === 'ja') {
52
+ setIconLabel('新規タブで開きます')
53
+ }
54
+ setIconLabel('Opens in new tab')
55
+ }, [])
56
+
57
+ if (href?.startsWith('http')) {
55
58
  return (
56
- <a
59
+ <Component
57
60
  className={cx(style, className)}
58
61
  href={href}
59
62
  target="_blank"
@@ -61,16 +64,22 @@ export const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(
61
64
  {...restProps}
62
65
  ref={ref}
63
66
  >
64
- {children}
65
- {fileType ? `(${fileType})` : null}
66
- </a>
67
+ <span className={styleUnderLine}>{children}</span>
68
+ <span className={cx(styleIcon)} aria-label={iconLabel}>
69
+ open_in_new
70
+ </span>
71
+ </Component>
67
72
  )
68
73
  }
69
74
  return (
70
- <a className={cx(style, className)} href={href} {...restProps} ref={ref}>
75
+ <Component
76
+ className={cx(style, styleUnderLine, className)}
77
+ href={href}
78
+ {...restProps}
79
+ ref={ref}
80
+ >
71
81
  {children}
72
- {fileType ? `(${fileType})` : null}
73
- </a>
82
+ </Component>
74
83
  )
75
84
  }
76
85
  )
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { cx } from '../utils/class'
2
+ import { cx } from '../libs/cx'
3
3
 
4
4
  export interface UlProps extends React.ComponentPropsWithoutRef<'ul'> {}
5
5
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { cx } from '../utils/class'
2
+ import { cx } from '../libs/cx'
3
3
 
4
4
  export interface PreProps extends React.ComponentPropsWithoutRef<'pre'> {}
5
5
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { cx } from '../utils/class'
2
+ import { cx } from '../libs/cx'
3
3
 
4
4
  export interface TableProps extends React.ComponentPropsWithoutRef<'table'> {}
5
5
 
@@ -0,0 +1,83 @@
1
+ // select-none
2
+ export const base = `
3
+ inline-block
4
+ text-button
5
+ text-center
6
+ cursor-pointer
7
+ whitespace-nowrap
8
+ outline-offset-2
9
+ border
10
+ border-solid
11
+ border-sea-800
12
+ active:border-sea-1200
13
+ hover:border-sea-900
14
+ focus:outline
15
+ focus:outline-2
16
+ focus:outline-wood-600
17
+ disabled:border-sumi-500
18
+ disabled:cursor-not-allowed
19
+ `
20
+
21
+ const primary = `
22
+ text-white-1000
23
+ bg-sea-800
24
+ active:bg-sea-1200
25
+ hover:bg-sea-900
26
+ disabled:bg-sumi-500
27
+ disabled:text-white-1000
28
+ `
29
+
30
+ const secondary = `
31
+ text-sea-800
32
+ bg-transparent
33
+ active:bg-sea-200
34
+ hover:bg-sea-100
35
+ active:text-sea-1200
36
+ hover:text-sea-900
37
+ disabled:text-sumi-500
38
+ disabled:bg-transparent
39
+ `
40
+
41
+ const styles: { [key: string]: string } = {
42
+ primary: primary,
43
+ secondary: secondary
44
+ }
45
+
46
+ export const getVariantStyle = (variant: 'primary' | 'secondary') => {
47
+ return styles[variant]
48
+ }
49
+
50
+ const params: {
51
+ [key: string]: string
52
+ } = {
53
+ lg: `
54
+ p-4
55
+ text-button
56
+ rounded-lg
57
+ `,
58
+ md: `
59
+ px-4
60
+ py-3
61
+ text-button
62
+ rounded-lg
63
+ `,
64
+ sm: `
65
+ px-3
66
+ py-1.5
67
+ my-1
68
+ text-button
69
+ rounded-md
70
+ `,
71
+ xs: `
72
+ px-2
73
+ py-[7px]
74
+ my-2
75
+ text-button-sm
76
+ !leading-[14px]
77
+ rounded
78
+ `
79
+ }
80
+
81
+ export const getSizeStyle = (size: 'lg' | 'md' | 'sm' | 'xs') => {
82
+ return params[size]
83
+ }