@@ -65,15 +65,16 @@ instance showGroup :: Show Group where
6565type HTML m = H.ComponentHTML Action Slots m
6666
6767type Slots =
68- ( child :: H.Slot (Const Void ) Void String )
68+ (child :: H.Slot (Const Void ) Void String )
69+
6970_child = Proxy :: Proxy " child"
7071
7172-- | Takes stories config and mount element, and renders the storybook.
72- runStorybook
73- :: Stories Aff
74- -> Array Group
75- -> HTMLElement
76- -> Aff Unit
73+ runStorybook ::
74+ Stories Aff ->
75+ Array Group ->
76+ HTMLElement ->
77+ Aff Unit
7778runStorybook stories groups body = do
7879 app' <- runUI app { stories, groups } body
7980 void $ H .liftEffect $ hashes $ \_ next ->
@@ -84,7 +85,7 @@ type Input m =
8485 , groups :: Array Group
8586 }
8687
87- app :: ∀ m . H.Component Query (Input m ) Void m
88+ app :: forall m . H.Component Query (Input m ) Void m
8889app =
8990 H .mkComponent
9091 { initialState
@@ -99,31 +100,32 @@ app =
99100 render :: State m -> HTML m
100101 render state =
101102 HH .body_
102- [ HH .div
103- [ HP .class_ $ HH.ClassName " min-h-screen" ]
104- [ renderSidebar state
105- , renderContainer state
103+ [ HH .div
104+ [ HP .class_ $ HH.ClassName " min-h-screen" ]
105+ [ renderSidebar state
106+ , renderContainer state
107+ ]
106108 ]
107- ]
108109
109110 renderContainer :: State m -> HTML m
110111 renderContainer state =
111112 HH .div
112- [ HP .class_ $ HH.ClassName " md:ml-80" ]
113- [ HH .div
114- [ HP .class_ $ HH.ClassName " fixed w-full" ]
113+ [ HP .class_ $ HH.ClassName " md:ml-80" ]
115114 [ HH .div
116- [ HP .class_ $ HH.ClassName " pin-t bg-white md:hidden relative border-b border-grey-light h-12 py-8 flex items-center" ]
117- [ HH .a
118- [ HP .class_ $ HH.ClassName " mx-auto inline-flex items-center"
119- , HP .href " " ]
120- [ HH .text " CitizenNet UI Guide" ]
121- ]
115+ [ HP .class_ $ HH.ClassName " fixed w-full" ]
116+ [ HH .div
117+ [ HP .class_ $ HH.ClassName " pin-t bg-white md:hidden relative border-b border-grey-light h-12 py-8 flex items-center" ]
118+ [ HH .a
119+ [ HP .class_ $ HH.ClassName " mx-auto inline-flex items-center"
120+ , HP .href " "
121+ ]
122+ [ HH .text " CitizenNet UI Guide" ]
123+ ]
124+ ]
125+ , HH .div
126+ [ HP .class_ $ HH.ClassName " p-12 w-full container mx-auto" ]
127+ [ renderSlot state ]
122128 ]
123- , HH .div
124- [ HP .class_ $ HH.ClassName " p-12 w-full container mx-auto" ]
125- [ renderSlot state ]
126- ]
127129
128130 renderSlot :: State m -> HTML m
129131 renderSlot state =
@@ -135,71 +137,71 @@ app =
135137 renderSidebar :: State m -> HTML m
136138 renderSidebar state =
137139 Backdrop .backdrop
138- [ HP .id " sidebar"
139- , HP .classes
140- ( HH.ClassName <$>
141- [ " hidden"
142- , " fixed"
143- , " pin-y"
144- , " pin-l"
145- , " overflow-y-auto"
146- , " md:overflow-visible"
147- , " scrolling-touch"
148- , " md:scrolling-auto"
149- , " w-4/5"
150- , " md:w-full"
151- , " md:max-w-xs"
152- , " flex-none"
153- -- , "border-r-2"
154- -- , "border-grey-light"
155- , " md:flex"
156- , " flex-col"
157- ]
158- )
159- ]
160- [ HH .div
161- [ HP .class_ $ HH.ClassName " flex-1 p-6 overflow-y-auto" ]
162- [ HH .header_
163- [ Format .heading
164- [ HP .class_ $ HH.ClassName " flex" ]
165- [ HH .img
166- [ HP .class_ $ HH.ClassName " mr-2"
167- , HP .src " https://citizennet.com/manager/images/logo.svg"
168- ]
169- , HH .text " Ocelot"
140+ [ HP .id " sidebar"
141+ , HP .classes
142+ ( HH.ClassName <$>
143+ [ " hidden"
144+ , " fixed"
145+ , " pin-y"
146+ , " pin-l"
147+ , " overflow-y-auto"
148+ , " md:overflow-visible"
149+ , " scrolling-touch"
150+ , " md:scrolling-auto"
151+ , " w-4/5"
152+ , " md:w-full"
153+ , " md:max-w-xs"
154+ , " flex-none"
155+ -- , "border-r-2"
156+ -- , "border-grey-light"
157+ , " md:flex"
158+ , " flex-col"
159+ ]
160+ )
161+ ]
162+ [ HH .div
163+ [ HP .class_ $ HH.ClassName " flex-1 p-6 overflow-y-auto" ]
164+ [ HH .header_
165+ [ Format .heading
166+ [ HP .class_ $ HH.ClassName " flex" ]
167+ [ HH .img
168+ [ HP .class_ $ HH.ClassName " mr-2"
169+ , HP .src " https://citizennet.com/manager/images/logo.svg"
170+ ]
171+ , HH .text " Ocelot"
172+ ]
173+ ]
174+ , HH .nav
175+ [ HP .class_ $ HH.ClassName " text-base overflow-y-auto" ]
176+ (renderGroups state)
170177 ]
171- ]
172- , HH .nav
173- [ HP .class_ $ HH.ClassName " text-base overflow-y-auto" ]
174- (renderGroups state)
175178 ]
176- ]
177179
178180 renderGroups :: State m -> Array (HTML m )
179181 renderGroups state =
180182 mapFlipped (M .toUnfoldable state.partitions) $ \(Tuple group stories) ->
181183 HH .div
182- [ HP .class_ $ HH.ClassName " mb-6" ]
183- [ Format .caption_
184- [ HH .text $ show group ]
185- , renderGroup state.route stories
186- ]
184+ [ HP .class_ $ HH.ClassName " mb-6" ]
185+ [ Format .caption_
186+ [ HH .text $ show group ]
187+ , renderGroup state.route stories
188+ ]
187189
188190 renderGroup :: String -> Stories m -> HTML m
189191 renderGroup route stories =
190- HH .ul [ HP .class_ $ HH.ClassName " list-reset" ] $
191- mapFlipped (M .toUnfoldable stories) $ \( Tuple href { anchor }) ->
192- HH .li
193- [ HP .class_ $ HH.ClassName " mb-3 " ]
194- [ HH .a
195- [ HP .classes $
196- Format .linkClasses <>
197- ( if href == route then [ HH.ClassName " font-medium " ] else [] )
198- , HP . href $ " # " <> unsafeEncodeURI href
199- ]
200- [ HH .text anchor ]
201- ]
202-
192+ HH .ul [ HP .class_ $ HH.ClassName " list-reset" ]
193+ $ mapFlipped (M .toUnfoldable stories)
194+ $ \( Tuple href { anchor }) ->
195+ HH .li
196+ [ HP .class_ $ HH.ClassName " mb-3 " ]
197+ [ HH .a
198+ [ HP .classes $
199+ Format .linkClasses <>
200+ ( if href == route then [ HH.ClassName " font-medium " ] else [] )
201+ , HP .href $ " # " <> unsafeEncodeURI href
202+ ]
203+ [ HH .text anchor ]
204+ ]
203205
204206 eval :: forall a . Query a -> H.HalogenM (State m ) Action Slots Void m (Maybe a )
205207 eval (RouteChange route next) = do
@@ -209,7 +211,7 @@ app =
209211-- --------
210212-- Helpers
211213
212- partitionByGroup :: ∀ m . Group -> Stories m -> Tuple Group (Stories m )
214+ partitionByGroup :: forall m . Group -> Stories m -> Tuple Group (Stories m )
213215partitionByGroup g = Tuple g <<< M .filter (\{ group } -> group == g)
214216
215217unsafeEncodeURI :: String -> String
0 commit comments