Skip to content

Commit

Permalink
improve button styling
Browse files Browse the repository at this point in the history
  • Loading branch information
myrho committed Feb 29, 2024
1 parent cf3a130 commit fd52b0e
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 10 deletions.
5 changes: 5 additions & 0 deletions src/Css/Button.elm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ primary vc =
button vc ++ vc.theme.button.primary vc.lightmode


neutral : Config -> List Style
neutral vc =
button vc ++ vc.theme.button.neutral vc.lightmode


danger : Config -> List Style
danger vc =
button vc ++ vc.theme.button.danger vc.lightmode
Expand Down
2 changes: 1 addition & 1 deletion src/Css/Search.elm
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ resultLineIcon vc =

button : Config -> List Style
button vc =
vc.theme.search.button
vc.theme.search.button vc.lightmode
2 changes: 2 additions & 0 deletions src/Theme/Button.elm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Css exposing (Style)

type alias Button =
{ button : Bool -> List Style
, neutral : Bool -> List Style
, primary : Bool -> List Style
, danger : Bool -> List Style
, disabled : Bool -> List Style
Expand All @@ -14,6 +15,7 @@ type alias Button =
default : Button
default =
{ button = \_ -> []
, neutral = \_ -> []
, primary = \_ -> []
, danger = \_ -> []
, disabled = \_ -> []
Expand Down
4 changes: 2 additions & 2 deletions src/Theme/Search.elm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type alias Search =
, resultLine : Bool -> List Style
, resultLineHighlighted : Bool -> List Style
, resultLineIcon : List Style
, button : List Style
, button : Bool -> List Style
}


Expand All @@ -28,5 +28,5 @@ default =
, resultLine = \_ -> []
, resultLineHighlighted = \_ -> []
, resultLineIcon = []
, button = []
, button = \_ -> []
}
2 changes: 1 addition & 1 deletion src/View/Search.elm
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ search plugins vc sc model =
, if sc.showIcon then
button
[ [ Css.Button.button vc |> Css.batch
, Css.Button.primary vc |> Css.batch
, Css.Button.neutral vc |> Css.batch
, Css.button vc |> Css.batch
]
|> css
Expand Down
30 changes: 24 additions & 6 deletions themes/Iknaio.elm
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,13 @@ theme =
, scaled 1 |> rem |> paddingRight
]
|> s_button
[]
(\lightmode ->
[ color_backgroundColorWithLightmode lightmode colors.brandDark colors.greyLighter
, property "box-shadow" "none"
, scaled 1 |> rem |> paddingY
, scaled 2 |> rem |> paddingX
]
)
)
|> s_autocomplete
(Autocomplete.default
Expand Down Expand Up @@ -499,26 +505,38 @@ theme =
(Button.default
|> s_button
(\lightmode ->
[ fontWeight bold
[ fontWeight normal
, textDecoration none
, scaled 1 |> rem |> paddingY
, scaled 2 |> rem |> paddingX
, scaled 2 |> rem |> paddingY
, scaled 5 |> rem |> paddingX
, scaled 1 |> rem |> marginX
, shadowSm
, borderRadiusSm
, border zero
, hover
[ backgroundColorWithLightmode lightmode colors.brandLighter
]
]
)
|> s_primary
|> s_neutral
(\lightmode ->
[ color_backgroundColorWithLightmode lightmode colors.brandDark colors.greyLighter
[ color_backgroundColorWithLightmode lightmode colors.brandText colors.greyLighter
, disabled
[ colorWithLightmode lightmode colors.brandLight
]
]
)
|> s_primary
(\lightmode ->
[ color_backgroundColorWithLightmode lightmode colors.brandText colors.brandLight
, disabled
[ color_backgroundColorWithLightmode lightmode colors.grey colors.greyLight
]
, hover
[ backgroundColorWithLightmode lightmode colors.brandBase
]
]
)
|> s_danger
(\lightmode ->
[ color_backgroundColorWithLightmode lightmode colors.brandRed colors.brandWhite
Expand Down

0 comments on commit fd52b0e

Please sign in to comment.