etienne-moqueur/src/Routes.hs
etienne dffa10fd93 Fully functional nav' :: [(Route, Html)] -> Component Html
Responsive nav (molecule). On screen < M, it shows a hamburger in the
top right which displays a full screen modal nav, and on screen > M it
displays a one-line nav.
2023-07-07 22:38:25 +02:00

28 lines
734 B
Haskell

module Routes
( Route(..)
, path
) where
import GHC.Exts ( IsString(..) )
data Route = Home
| Blog
| Archive
| Post String
| Tag String
| Img String
| DefaultStylesheet
| ExternalRoute String
instance IsString Route where
fromString = ExternalRoute
path :: Route -> String
path Home = "/"
path Blog = "/posts"
path Archive = "/tags"
path (Post postId ) = "/posts/" <> postId
path (Tag tag ) = "/tags/#" <> tag
path (Img fileName) = "/assets/img/" <> fileName
path DefaultStylesheet = "/css/default.css"
path (ExternalRoute addr) = addr