Format
This commit is contained in:
@@ -10,10 +10,7 @@ import { Button } from "./button"
|
||||
import { Margin } from "./icon_button"
|
||||
|
||||
interface TextButtonOptions {
|
||||
layer?:
|
||||
| Theme["lowest"]
|
||||
| Theme["middle"]
|
||||
| Theme["highest"]
|
||||
layer?: Theme["lowest"] | Theme["middle"] | Theme["highest"]
|
||||
variant?: Button.Variant
|
||||
color?: keyof Theme["lowest"]
|
||||
margin?: Partial<Margin>
|
||||
@@ -36,7 +33,10 @@ export function text_button({
|
||||
const theme = useTheme()
|
||||
if (!color) color = "base"
|
||||
|
||||
const background_color = variant === Button.variant.Ghost ? null : background(layer ?? theme.lowest, color)
|
||||
const background_color =
|
||||
variant === Button.variant.Ghost
|
||||
? null
|
||||
: background(layer ?? theme.lowest, color)
|
||||
|
||||
const text_options: TextProperties = {
|
||||
size: "xs",
|
||||
@@ -67,20 +67,38 @@ export function text_button({
|
||||
state: {
|
||||
default: {
|
||||
background: background_color,
|
||||
color:
|
||||
disabled
|
||||
? foreground(layer ?? theme.lowest, "disabled")
|
||||
: foreground(layer ?? theme.lowest, color),
|
||||
},
|
||||
hovered:
|
||||
disabled ? {} : {
|
||||
background: background(layer ?? theme.lowest, color, "hovered"),
|
||||
color: foreground(layer ?? theme.lowest, color, "hovered"),
|
||||
},
|
||||
clicked: disabled ? {} : {
|
||||
background: background(layer ?? theme.lowest, color, "pressed"),
|
||||
color: foreground(layer ?? theme.lowest, color, "pressed"),
|
||||
color: disabled
|
||||
? foreground(layer ?? theme.lowest, "disabled")
|
||||
: foreground(layer ?? theme.lowest, color),
|
||||
},
|
||||
hovered: disabled
|
||||
? {}
|
||||
: {
|
||||
background: background(
|
||||
layer ?? theme.lowest,
|
||||
color,
|
||||
"hovered"
|
||||
),
|
||||
color: foreground(
|
||||
layer ?? theme.lowest,
|
||||
color,
|
||||
"hovered"
|
||||
),
|
||||
},
|
||||
clicked: disabled
|
||||
? {}
|
||||
: {
|
||||
background: background(
|
||||
layer ?? theme.lowest,
|
||||
color,
|
||||
"pressed"
|
||||
),
|
||||
color: foreground(
|
||||
layer ?? theme.lowest,
|
||||
color,
|
||||
"pressed"
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user