|
1 |
| -import { ComponentMultiStyle, isDefaultColor, mode } from '@yamada-ui/core' |
2 |
| -import { shadeColor, toneColor, getColor } from '@yamada-ui/utils' |
| 1 | +import { ComponentMultiStyle } from '@yamada-ui/core' |
| 2 | +import { shadeColor } from '@yamada-ui/utils' |
3 | 3 |
|
4 | 4 | export const Alert: ComponentMultiStyle = {
|
5 | 5 | baseStyle: {
|
@@ -29,124 +29,65 @@ export const Alert: ComponentMultiStyle = {
|
29 | 29 | },
|
30 | 30 |
|
31 | 31 | variants: {
|
32 |
| - basic: ({ theme: t, colorMode: m, colorScheme: c = 'primary' }) => { |
33 |
| - const color = isDefaultColor( |
34 |
| - mode(toneColor(c, 500)(t, m), toneColor(c, 200)(t, m))(m), |
35 |
| - mode(getColor(`${c}.500`)(t, m), getColor(`${c}.200`)(t, m))(m), |
36 |
| - )(c) |
37 |
| - |
38 |
| - return { |
39 |
| - container: { |
40 |
| - bg: ['white', 'black'], |
41 |
| - borderWidth: '1px', |
42 |
| - }, |
43 |
| - icon: { color }, |
44 |
| - loading: { color }, |
45 |
| - } |
46 |
| - }, |
47 |
| - subtle: ({ theme: t, colorMode: m, colorScheme: c = 'primary' }) => { |
48 |
| - const color = isDefaultColor( |
49 |
| - [toneColor(c, 500)(t, m), toneColor(c, 200)(t, m)], |
50 |
| - [`${c}.500`, `${c}.200`], |
51 |
| - )(c) |
52 |
| - |
53 |
| - return { |
54 |
| - container: { |
55 |
| - bg: isDefaultColor( |
56 |
| - [ |
57 |
| - toneColor(c, 100)(t, m), |
58 |
| - shadeColor(toneColor(c, 200)(t, m), 56)(t, m), |
59 |
| - ], |
60 |
| - [`${c}.100`, shadeColor(`${c}.200`, 56)(t, m)], |
61 |
| - )(c), |
62 |
| - }, |
63 |
| - icon: { color }, |
64 |
| - loading: { color }, |
65 |
| - } |
66 |
| - }, |
67 |
| - solid: ({ theme: t, colorMode: m, colorScheme: c = 'primary' }) => ({ |
| 32 | + basic: ({ colorScheme: c = 'primary' }) => ({ |
| 33 | + container: { bg: ['white', 'black'], borderWidth: '1px' }, |
| 34 | + icon: { color: [`${c}.500`, `${c}.200`] }, |
| 35 | + loading: { color: [`${c}.500`, `${c}.200`] }, |
| 36 | + }), |
| 37 | + subtle: ({ theme: t, colorMode: m, colorScheme: c = 'primary' }) => ({ |
| 38 | + container: { bg: [`${c}.100`, shadeColor(`${c}.200`, 56)(t, m)] }, |
| 39 | + icon: { color: [`${c}.500`, `${c}.200`] }, |
| 40 | + loading: { color: [`${c}.500`, `${c}.200`] }, |
| 41 | + }), |
| 42 | + solid: ({ colorScheme: c = 'primary' }) => ({ |
68 | 43 | container: {
|
69 |
| - bg: isDefaultColor( |
70 |
| - [toneColor(c, 500)(t, m), toneColor(c, 200)(t, m)], |
71 |
| - [`${c}.500`, `${c}.200`], |
72 |
| - )(c), |
| 44 | + bg: [`${c}.500`, `${c}.200`], |
73 | 45 | color: ['white', 'gray.900'],
|
74 | 46 | },
|
75 | 47 | }),
|
76 |
| - 'island-accent': ({ |
| 48 | + 'island-accent': ({ colorScheme: c = 'primary' }) => ({ |
| 49 | + container: { |
| 50 | + bg: ['white', 'black'], |
| 51 | + borderWidth: '1px', |
| 52 | + pl: 7, |
| 53 | + _before: { |
| 54 | + content: '""', |
| 55 | + position: 'absolute', |
| 56 | + top: '50%', |
| 57 | + left: 3, |
| 58 | + transform: 'translateY(-50%)', |
| 59 | + w: 1, |
| 60 | + h: 'calc(100% - 1.5rem)', |
| 61 | + bg: [`${c}.500`, `${c}.200`], |
| 62 | + rounded: 'full', |
| 63 | + }, |
| 64 | + }, |
| 65 | + icon: { color: [`${c}.500`, `${c}.200`] }, |
| 66 | + }), |
| 67 | + 'left-accent': ({ |
77 | 68 | theme: t,
|
78 | 69 | colorMode: m,
|
79 | 70 | colorScheme: c = 'primary',
|
80 |
| - }) => { |
81 |
| - const color = isDefaultColor( |
82 |
| - mode(toneColor(c, 500)(t, m), toneColor(c, 200)(t, m))(m), |
83 |
| - mode(getColor(`${c}.500`)(t, m), getColor(`${c}.200`)(t, m))(m), |
84 |
| - )(c) |
85 |
| - |
86 |
| - return { |
87 |
| - container: { |
88 |
| - bg: ['white', 'black'], |
89 |
| - borderWidth: '1px', |
90 |
| - pl: 7, |
91 |
| - _before: { |
92 |
| - content: '""', |
93 |
| - position: 'absolute', |
94 |
| - top: '50%', |
95 |
| - left: 3, |
96 |
| - transform: 'translateY(-50%)', |
97 |
| - w: 1, |
98 |
| - h: 'calc(100% - 1.5rem)', |
99 |
| - bg: color, |
100 |
| - rounded: 'full', |
101 |
| - }, |
102 |
| - }, |
103 |
| - icon: { color }, |
104 |
| - } |
105 |
| - }, |
106 |
| - 'left-accent': ({ theme: t, colorMode: m, colorScheme: c = 'primary' }) => { |
107 |
| - const color = isDefaultColor( |
108 |
| - mode(toneColor(c, 500)(t, m), toneColor(c, 200)(t, m))(m), |
109 |
| - mode(getColor(`${c}.500`)(t, m), getColor(`${c}.200`)(t, m))(m), |
110 |
| - )(c) |
111 |
| - |
112 |
| - return { |
113 |
| - container: { |
114 |
| - bg: isDefaultColor( |
115 |
| - [ |
116 |
| - toneColor(c, 100)(t, m), |
117 |
| - shadeColor(toneColor(c, 200)(t, m), 56)(t, m), |
118 |
| - ], |
119 |
| - [`${c}.100`, shadeColor(`${c}.200`, 56)(t, m)], |
120 |
| - )(c), |
121 |
| - pl: 3, |
122 |
| - borderLeft: `0.25rem solid ${color}`, |
123 |
| - rounded: 4, |
124 |
| - }, |
125 |
| - icon: { color }, |
126 |
| - } |
127 |
| - }, |
128 |
| - 'top-accent': ({ theme: t, colorMode: m, colorScheme: c = 'primary' }) => { |
129 |
| - const color = isDefaultColor( |
130 |
| - mode(toneColor(c, 500)(t, m), toneColor(c, 200)(t, m))(m), |
131 |
| - mode(getColor(`${c}.500`)(t, m), getColor(`${c}.200`)(t, m))(m), |
132 |
| - )(c) |
133 |
| - |
134 |
| - return { |
135 |
| - container: { |
136 |
| - bg: isDefaultColor( |
137 |
| - [ |
138 |
| - toneColor(c, 100)(t, m), |
139 |
| - shadeColor(toneColor(c, 200)(t, m), 56)(t, m), |
140 |
| - ], |
141 |
| - [`${c}.100`, shadeColor(`${c}.200`, 56)(t, m)], |
142 |
| - )(c), |
143 |
| - pt: 3, |
144 |
| - borderTop: `0.25rem solid ${color}`, |
145 |
| - rounded: 4, |
146 |
| - }, |
147 |
| - icon: { color }, |
148 |
| - } |
149 |
| - }, |
| 71 | + }) => ({ |
| 72 | + container: { |
| 73 | + bg: [`${c}.100`, shadeColor(`${c}.200`, 56)(t, m)], |
| 74 | + pl: 3, |
| 75 | + borderLeft: '0.25rem solid', |
| 76 | + borderLeftColor: [`${c}.500`, `${c}.200`], |
| 77 | + rounded: 4, |
| 78 | + }, |
| 79 | + icon: { color: [`${c}.500`, `${c}.200`] }, |
| 80 | + }), |
| 81 | + 'top-accent': ({ theme: t, colorMode: m, colorScheme: c = 'primary' }) => ({ |
| 82 | + container: { |
| 83 | + bg: [`${c}.100`, shadeColor(`${c}.200`, 56)(t, m)], |
| 84 | + pt: 3, |
| 85 | + borderTop: '0.25rem solid', |
| 86 | + borderTopColor: [`${c}.500`, `${c}.200`], |
| 87 | + rounded: 4, |
| 88 | + }, |
| 89 | + icon: { color: [`${c}.500`, `${c}.200`] }, |
| 90 | + }), |
150 | 91 | },
|
151 | 92 |
|
152 | 93 | defaultProps: {
|
|
0 commit comments