Skip to content

Commit 2e7e0c4

Browse files
authored
feat(Button): Glass button & Neutral color button (#362)
* using dialog element * fix ModalLegacy story meta * add glass button & neutral color
1 parent 65550d9 commit 2e7e0c4

4 files changed

Lines changed: 32 additions & 2 deletions

File tree

generators/options/colorOptions.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const colorOptions = {
1818
'success',
1919
'warning',
2020
'error',
21+
'neutral',
2122
'primary',
2223
'secondary',
2324
'accent',

src/Button/Button.stories.tsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ export const Colors: Story<ButtonProps> = (args) => {
2929
<div>
3030
<div>
3131
<Button {...args}>Default</Button>
32+
<Button {...args} color="neutral">
33+
Neutral
34+
</Button>
3235
<Button {...args} color="primary">
3336
Primary
3437
</Button>
@@ -60,7 +63,7 @@ export const Colors: Story<ButtonProps> = (args) => {
6063
)
6164
}
6265
Colors.args = {
63-
className: "m-1"
66+
className: 'm-1',
6467
}
6568

6669
export const Variants: Story<ButtonProps> = (args) => {
@@ -120,3 +123,20 @@ export const AsHref: Story<ButtonProps> = (args) => {
120123
</div>
121124
)
122125
}
126+
127+
export const Glass: Story<ButtonProps> = (args) => {
128+
return (
129+
<div
130+
className="w-full flex justify-center py-8 rounded-md"
131+
style={{
132+
backgroundImage:
133+
'url(https://daisyui.com/images/stock/photo-1507358522600-9f71e620c44e.jpg)',
134+
}}
135+
>
136+
<Button {...args}>Glass button</Button>
137+
</div>
138+
)
139+
}
140+
Glass.args = {
141+
glass: true,
142+
}

src/Button/Button.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export type ButtonProps = Omit<
2020
size?: ComponentSize
2121
variant?: 'outline' | 'link'
2222
color?: ComponentColor
23+
glass?: boolean
2324
wide?: boolean
2425
fullWidth?: boolean
2526
responsive?: boolean
@@ -39,6 +40,7 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>(
3940
size,
4041
variant,
4142
color,
43+
glass,
4244
startIcon,
4345
endIcon,
4446
wide,
@@ -67,6 +69,7 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>(
6769
'btn-square': shape === 'square',
6870
'btn-outline': variant === 'outline',
6971
'btn-link': variant === 'link',
72+
'btn-neutral': color === 'neutral',
7073
'btn-primary': color === 'primary',
7174
'btn-secondary': color === 'secondary',
7275
'btn-accent': color === 'accent',
@@ -75,6 +78,7 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>(
7578
'btn-warning': color === 'warning',
7679
'btn-error': color === 'error',
7780
'btn-ghost': color === 'ghost',
81+
glass: glass,
7882
'btn-wide': wide,
7983
'btn-block': fullWidth,
8084
'btn-xs md:btn-sm lg:btn-md xl:btn-lg': responsive,

src/constants.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ export const componentStatuses = [
77
'warning',
88
'error',
99
] as const
10-
export const brandColors = ['primary', 'secondary', 'accent'] as const
10+
export const brandColors = [
11+
'neutral',
12+
'primary',
13+
'secondary',
14+
'accent',
15+
] as const
1116
export const componentColors = [
1217
...brandColors,
1318
'ghost',

0 commit comments

Comments
 (0)