1module Container.Sidebar where
5import CSS.Safer (cssSafer)
6import Data.Monoid (guard)
8import React.Basic (JSX)
9import React.Basic.DOM as R
10import React.Basic.Events (handler_)
11import React.Basic.Hooks (ReactComponent, component, element)
12import React.Basic.Hooks as React
13import SVG.Icon (ActiveArrowDirection(..), mkMenu)
14import Theme.Styles (classNames, makeStyles)
15import Theme.Types (CSSTheme)
20 { children ∷ Array JSX
21 , modifyCollapsed ∷ (Boolean -> Boolean) -> Effect Unit
27 makeStyles \(theme ∷ CSSTheme) ->
30 { background: theme.interfaceColour
31 , fontFamily: theme.textFontFamily
32 , color: theme.textColour
35 , flexDirection: "column"
36 , minHeight: "calc(100vh, -80px)"
37 , transition: "0.2s ease-in-out"
40 , sidebarCollapsed: cssSafer { width: "70px" }
41 , sidebarExpanded: cssSafer { width: "250px" }
46 , padding: "0 5px 0 5px"
47 , transition: "0.2s ease-in-out"
48 , transitionDelay: "0.1s"
49 , alignSelf: "flex-end"
53 {} -- transform: "rotate(180deg)"}
56 component "Sidebar" \{ children, collapsed, modifyCollapsed } -> React.do
57 rawClasses <- useStyles
59 classes = flip classNames rawClasses
65 , if collapsed then _.sidebarCollapsed else _.sidebarExpanded
69 { className: classes [ _.logo, guard collapsed _.logoCollapsed ]
70 , onClick: handler_ $ (modifyCollapsed not)
73 { activeArrowDirection: if collapsed then ArrowPointsRight else ArrowPointsLeft }
80mkSidebarLink ∷ Effect (ReactComponent { name ∷ String, icon ∷ JSX, collapsed ∷ Boolean })
83 makeStyles \(theme ∷ CSSTheme) ->
86 { fontFamily: theme.headingFontFamily
87 , alignSelf: "flex-end"
88 , justifyContent: "space-between"
89 , alignContent: "stretch"
90 , color: theme.textColour
93 , flexDirection: "row"
97 , borderRadius: "5px 0 0 5px"
100 { background: theme.highlightColour
102 -- , "&:hover": cssSafer{ opacity: "1.0"}
106 { fontFamily: theme.textFontFamily
107 , color: theme.textColour
108 , paddingLeft: "20px"
109 , textTransform: "uppercase"
117 , padding: "5px 10px 5px 5px"
118 , transition: "0.2s ease-in-out"
119 , transitionDelay: "0.1s"
120 , alignSelf: "flex-end"
121 , fill: theme.textColour <> " !important"
124 component "SidebarLink" \{ name, icon, collapsed } -> React.do
125 rawClasses <- useStyles
127 classes = flip classNames rawClasses
130 { className: classes [ _.sidebarEntry ]
133 { className: classes [ _.label ]
134 , children: [ R.text name ]
137 { className: classes [ _.icon ]
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