Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Darya Rednikina
elm_frontend
Commits
852c5a8b
Commit
852c5a8b
authored
Dec 18, 2019
by
Darya Rednikina
Browse files
(
#3
) Added some kind of nav bar (ctr+c from spa example)
Needs a lot of styling
parent
75e2e602
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Page.elm
View file @
852c5a8b
module
Page
exposing
(
Page
(
..
)
,
view
)
import
Browser
exposing
(
Document
)
import
Html
exposing
(
Html
)
import
Html
exposing
(
Html
,
a
,
div
,
li
,
nav
,
text
,
ul
)
import
Html
.
Attributes
exposing
(
class
,
classList
,
href
)
import
Route
exposing
(
Route
)
view
:
Page
->
{
title
:
String
,
content
:
Html
msg
}
->
Document
msg
view
_
{
title
,
content
}
=
view
page
{
title
,
content
}
=
{
title
=
title
,
body
=
[
content
]
,
body
=
viewHeader
page
::
[
content
]
}
viewHeader
:
Page
->
Html
msg
viewHeader
page
=
case
page
of
Register
->
div
[]
[]
Login
->
div
[]
[]
_
->
nav
[
class
"
navbar navbar-light"
]
[
div
[
class
"
container"
]
[
a
[
class
"
navbar-brand"
,
Route
.
href
Route
.
Projects
]
[
text
"
conduit"
]
,
ul
[
class
"
nav navbar-nav pull-xs-right"
]
<|
[
navbarLink
page
Route
.
Projects
[
text
"
Projects"
]
]
]
]
navbarLink
:
Page
->
Route
->
List
(
Html
msg
)
->
Html
msg
navbarLink
page
route
linkContent
=
li
[
classList
[
(
"
nav-item"
,
True
)
,
(
"
active"
,
isActive
page
route
)
]
]
[
a
[
class
"
nav-link"
,
Route
.
href
route
]
linkContent
]
isActive
:
Page
->
Route
->
Bool
isActive
page
route
=
case
(
page
,
route
)
of
(
Projects
,
Route
.
Projects
)
->
True
_
->
False
{-| PAGE type for future configurations of header/footer/...
-}
type
Page
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment