Add disabled as an option on text_button
This commit is contained in:
@@ -17,6 +17,7 @@ interface TextButtonOptions {
|
|||||||
variant?: Button.Variant
|
variant?: Button.Variant
|
||||||
color?: keyof Theme["lowest"]
|
color?: keyof Theme["lowest"]
|
||||||
margin?: Partial<Margin>
|
margin?: Partial<Margin>
|
||||||
|
disabled?: boolean
|
||||||
text_properties?: TextProperties
|
text_properties?: TextProperties
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,6 +30,7 @@ export function text_button({
|
|||||||
color,
|
color,
|
||||||
layer,
|
layer,
|
||||||
margin,
|
margin,
|
||||||
|
disabled,
|
||||||
text_properties,
|
text_properties,
|
||||||
}: TextButtonOptions = {}) {
|
}: TextButtonOptions = {}) {
|
||||||
const theme = useTheme()
|
const theme = useTheme()
|
||||||
@@ -65,13 +67,17 @@ export function text_button({
|
|||||||
state: {
|
state: {
|
||||||
default: {
|
default: {
|
||||||
background: background_color,
|
background: background_color,
|
||||||
color: foreground(layer ?? theme.lowest, color),
|
color:
|
||||||
|
disabled
|
||||||
|
? foreground(layer ?? theme.lowest, "disabled")
|
||||||
|
: foreground(layer ?? theme.lowest, color),
|
||||||
},
|
},
|
||||||
hovered: {
|
hovered:
|
||||||
background: background(layer ?? theme.lowest, color, "hovered"),
|
disabled ? {} : {
|
||||||
color: foreground(layer ?? theme.lowest, color, "hovered"),
|
background: background(layer ?? theme.lowest, color, "hovered"),
|
||||||
},
|
color: foreground(layer ?? theme.lowest, color, "hovered"),
|
||||||
clicked: {
|
},
|
||||||
|
clicked: disabled ? {} : {
|
||||||
background: background(layer ?? theme.lowest, color, "pressed"),
|
background: background(layer ?? theme.lowest, color, "pressed"),
|
||||||
color: foreground(layer ?? theme.lowest, color, "pressed"),
|
color: foreground(layer ?? theme.lowest, color, "pressed"),
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user