git.iko.soy/rowtype-yoga/purescript-next-website
on main help sign in
Minir navbar improvement
commitdca75e6e6184a046082c6850b3d8e9f2c82859fc authorsigma-andex <77549848+sigma-andex@users.noreply.github.com> dateSun 28 Aug 2022, 13:50 (4 years ago) parentd423a1a
1 file changed+12−19
src/Components/Navigation.purs+12−19
src/Components/Navigation.purs+12−19
@@ -2,33 +2,29 @@ module Components.Navigation (navigation) where
22
33import Prelude
44
5−import Data.Maybe (Maybe(..), maybe)
5+import Data.Maybe (Maybe(..))
66import Data.Traversable (traverse_)
77import Data.Tuple.Nested ((/\))
88import Debug (spy)
9−import Effect.Class.Console (log)
109import Next.Router (useRouter)
1110import Next.Router as Router
1211import NextUI.NextUI (switch, useTheme)
1312import NextUI.NextUI as NextUI
1413import React.Basic.DOM (css)
1514import React.Basic.DOM.Events (targetChecked)
16−import React.Basic.DOM.Simplified.Generated as RS
1715import React.Basic.Events (handler)
1816import React.Basic.Hooks (Component, component, useEffect, useState')
1917import React.Basic.Hooks as React
20−import React.Icons (icon, icon_)
18+import React.Icons (icon)
2119import React.Icons.Si (siDiscord, siDiscourse, siGithub, siPurescript)
2220import React.Util (el)
2321import Themes (getColorValue)
2422import Web.DOM.Document (documentElement)
2523import Web.DOM.Element as DOMEL
26−import Web.DOM.ParentNode (QuerySelector(..), querySelector)
2724import Web.HTML (window)
2825import Web.HTML.HTMLDocument (toDocument)
2926import Web.HTML.Window (document)
3027
31−
3228navigation :: Component Unit
3329navigation = component "Navbar" \_props -> React.do
3430
@@ -51,19 +47,10 @@ navigation = component "Navbar" \_props -> React.do
5147 { onClick: dispatchRoute $ "/"
5248 }
5349 $ icon siPurescript { style: css { color: getColorValue theme "neutral" }, size: "3rem" }
54− , el NextUI.navbarContent { hideIn: "xs" }
55− [ el NextUI.navbarLink
56− { onClick: dispatchRoute $ "/pursuit"
57− }
58− $ el NextUI.text { size: "$xl", color: getColorValue theme "neutral" } "Getting started"
59− , el NextUI.navbarLink
60− { onClick: dispatchRoute $ "/pursuit"
61− }
62− $ el NextUI.text { size: "$xl", color: getColorValue theme "neutral"} "Try Purescript"
63− , el NextUI.navbarLink
64− { onClick: dispatchRoute $ "/pursuit"
65− }
66− $ el NextUI.text { size: "$xl", color: getColorValue theme "neutral" } "Pursuit"
50+ , el NextUI.navbarContent { hideIn: "xs" } $ map (mkLink theme)
51+ [ { onClick: dispatchRoute "/pursuit", title: "Getting started" }
52+ , { onClick: dispatchRoute "/pursuit", title: "Try Purescript" }
53+ , { onClick: dispatchRoute "/pursuit", title: "Pursuit" }
6754 ]
6855 , el NextUI.navbarContent {}
6956 [ el NextUI.navbarLink
@@ -83,3 +70,9 @@ navigation = component "Navbar" \_props -> React.do
8370 , el switch { checked: isDark, onChange: handler targetChecked $ traverse_ setDark } ""
8471 ]
8572 ]
73+ where
74+ mkLink theme { onClick, title } =
75+ el NextUI.navbarLink
76+ { onClick
77+ }
78+ $ el NextUI.text { size: "$xl", color: getColorValue theme "neutral" } title