1module Button.Component where
5import Data.Foldable (intercalate)
6import Data.Monoid (guard)
8import Prim.Row (class Lacks, class Union)
9import React.Basic (JSX)
10import React.Basic.DOM (Props_button, css, unsafeCreateDOMComponent)
11import React.Basic.Hooks (ReactComponent, component, element)
12import React.Basic.Hooks as React
14import Theme.Styles (classNames, makeStyles)
15import Theme.Types (CSSTheme)
22derive instance eqButtonType ∷ Eq ButtonType
26 Union attrs attrs_ Props_button =>
27 Lacks "children" attrs =>
28 Lacks "className" attrs =>
33 { children ∷ Array JSX
34 , buttonType ∷ ButtonType
35 , buttonProps ∷ Record attrs
40 makeStyles \(theme ∷ CSSTheme) ->
41 { "@keyframes gradientBG":
43 { "0%": css { backgroundPosition: "0% 50%" }
44 , "50%": css { backgroundPosition: "100% 50%" }
45 , "100%": css { backgroundPosition: "0% 50%" }
52 theme.interfaceColourLightest
55 [ theme.interfaceColourLightest
56 , theme.interfaceColourLighter
58 , color: theme.textColour
63 "1px 1px 10px rgba(0,0,0,0.66)"
66 then "1px solid " <> theme.interfaceColourLighter
69 , borderRadius: "20px"
70 , padding: "0px 18px 0px 18px"
75 , fontFamily: theme.textFontFamily
76 , letterSpacing: "0.2em"
77 , textTransform: "uppercase"
84 , theme.interfaceColourDarker
85 , theme.highlightColourDark
86 , theme.highlightColour
88 , color: theme.interfaceColourLighter
89 , backgroundSize: "400% 400%, 100% 100%"
90 , animation: "$gradientBG 3s ease infinite"
97 , theme.interfaceColourLighter
98 , theme.interfaceColourLightest
100 , boxShadow: "inset 0 0 2px black"
104 { boxShadow: "0 0 0 black"
105 , background: theme.backgroundColour
106 , border: "1px dotted " <> theme.interfaceColourLightest
107 , textDecoration: "line-through"
108 , textDecorationColor: theme.red
116 theme.highlightColour
118 linearGradient [ theme.highlightColour, theme.highlightColourDark ]
122 linearGradient [ theme.highlightColourDark, theme.highlightColour ]
124 , color: theme.textColour
127 component "Button" \{ children, buttonType, buttonProps } -> React.do
128 rawClasses <- useStyles
130 classes = flip classNames rawClasses
131 -- [TODO]: How do you do this in a typesafe manner?
132 pure <<< (element $ unsafeCreateDOMComponent "button")
136 , guard (buttonType == HighlightedButton) _.highlightedButton
138 , disabled: buttonType == DisabledButton
144linearGradient ∷ Array String -> String
145linearGradient elems = "linear-gradient(" <> intercalate "," elems <> ")"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list