2024-11-11 03:57:54 -06:00
|
|
|
module Layouts.Navbar exposing (Model, Msg, Props, layout)
|
|
|
|
|
2024-11-11 21:57:27 -06:00
|
|
|
import Config.Colour as T exposing (..)
|
|
|
|
import Config.Format as O exposing (..)
|
|
|
|
import Config.Identity as I exposing (..)
|
2024-11-11 03:57:54 -06:00
|
|
|
import Effect exposing (Effect)
|
2024-11-26 21:17:31 -06:00
|
|
|
import Element as E exposing (..)
|
|
|
|
import Element.Background as B exposing (..)
|
|
|
|
import Element.Border as D exposing (..)
|
2024-11-11 03:57:54 -06:00
|
|
|
import Element.Font as F
|
|
|
|
import Element.Region exposing (description)
|
|
|
|
import Html exposing (Html)
|
|
|
|
import Html.Attributes as H exposing (class, style)
|
|
|
|
import Layout exposing (Layout)
|
|
|
|
import Route exposing (Route)
|
|
|
|
import Shared
|
|
|
|
import View exposing (View)
|
|
|
|
|
|
|
|
|
|
|
|
type alias Props =
|
2024-12-03 21:17:17 -06:00
|
|
|
{ currentRoute : String }
|
2024-11-11 03:57:54 -06:00
|
|
|
|
|
|
|
|
|
|
|
layout : Props -> Shared.Model -> Route () -> Layout () Model Msg contentMsg
|
|
|
|
layout props shared route =
|
|
|
|
Layout.new
|
|
|
|
{ init = init
|
|
|
|
, update = update
|
2024-12-03 21:17:17 -06:00
|
|
|
, view = \layoutArgs -> view { props = props, content = layoutArgs.content, model = layoutArgs.model, toContentMsg = layoutArgs.toContentMsg }
|
2024-11-11 03:57:54 -06:00
|
|
|
, subscriptions = subscriptions
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- MODEL
|
|
|
|
|
|
|
|
|
|
|
|
type alias Model =
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
init : () -> ( Model, Effect Msg )
|
|
|
|
init _ =
|
|
|
|
( {}
|
|
|
|
, Effect.none
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- UPDATE
|
|
|
|
|
|
|
|
|
|
|
|
type Msg
|
|
|
|
= ReplaceMe
|
|
|
|
|
|
|
|
|
|
|
|
update : Msg -> Model -> ( Model, Effect Msg )
|
|
|
|
update msg model =
|
|
|
|
case msg of
|
|
|
|
ReplaceMe ->
|
|
|
|
( model
|
|
|
|
, Effect.none
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
subscriptions : Model -> Sub Msg
|
|
|
|
subscriptions model =
|
|
|
|
Sub.none
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-11 18:57:51 -06:00
|
|
|
-- image [spacing 30, width <| px 150] {src = "navbar/nutrivorelogo.png", description = ""}
|
2024-11-11 03:57:54 -06:00
|
|
|
-- VIEW
|
|
|
|
|
|
|
|
|
2024-12-03 21:17:17 -06:00
|
|
|
view :
|
|
|
|
{ content : View contentMsg
|
|
|
|
, model : Model
|
|
|
|
, toContentMsg : Msg -> contentMsg
|
|
|
|
, props : Props
|
|
|
|
}
|
|
|
|
-> View contentMsg
|
|
|
|
view { content, model, toContentMsg, props } =
|
2024-11-11 03:57:54 -06:00
|
|
|
{ title = content.title
|
|
|
|
, attributes = [ F.family [ spartanFont ] ]
|
2024-11-11 18:57:51 -06:00
|
|
|
, element =
|
2024-11-12 19:23:16 -06:00
|
|
|
row
|
2024-11-26 21:17:31 -06:00
|
|
|
[ E.width fill
|
2024-11-11 18:57:51 -06:00
|
|
|
, height fill
|
2024-11-28 00:58:24 -06:00
|
|
|
, B.color colourTheme.backgroundDarkGrey
|
2024-11-11 18:57:51 -06:00
|
|
|
]
|
|
|
|
[ column
|
2024-11-26 21:17:31 -06:00
|
|
|
[ htmlAttribute (H.style "position" "fixed")
|
2024-11-14 21:10:41 -06:00
|
|
|
, htmlAttribute (H.style "left" "0")
|
|
|
|
, htmlAttribute (H.style "top" "0")
|
|
|
|
, htmlAttribute (H.style "height" "100vh")
|
2024-12-03 21:17:17 -06:00
|
|
|
, htmlAttribute (H.style "z-index" "10")
|
2024-11-14 21:10:41 -06:00
|
|
|
, htmlAttribute (H.style "transform-style" "preserve-3d")
|
2024-11-26 21:17:31 -06:00
|
|
|
, D.widthEach { top = 0, bottom = 0, left = 0, right = 3 }
|
2024-11-28 00:58:24 -06:00
|
|
|
, D.color colourTheme.textDarkOrange
|
2024-11-11 18:57:51 -06:00
|
|
|
]
|
2024-11-12 19:23:16 -06:00
|
|
|
[ column
|
2024-11-26 21:17:31 -06:00
|
|
|
[ alignLeft
|
2024-11-16 00:44:39 -06:00
|
|
|
, height fill
|
2024-11-28 00:58:24 -06:00
|
|
|
, F.color colourTheme.textLightGrey
|
2024-11-11 18:57:51 -06:00
|
|
|
]
|
2024-11-26 21:17:31 -06:00
|
|
|
[ column
|
|
|
|
[ centerX
|
|
|
|
, E.width <| px 200
|
|
|
|
]
|
|
|
|
[ row
|
|
|
|
(nonHighlightedTitleFormat
|
|
|
|
++ [ centerX
|
|
|
|
]
|
|
|
|
)
|
|
|
|
[ E.image
|
|
|
|
[ spacing 2
|
2024-12-05 02:26:48 -06:00
|
|
|
, E.width <| px 180
|
2024-11-26 21:17:31 -06:00
|
|
|
, centerX
|
|
|
|
]
|
2024-12-05 02:26:48 -06:00
|
|
|
{ src = "navbar/uprootnutrition.png"
|
2024-11-26 21:17:31 -06:00
|
|
|
, description = ""
|
|
|
|
}
|
2024-12-05 02:26:48 -06:00
|
|
|
|
|
|
|
-- , column []
|
|
|
|
-- [ link [ centerX ]
|
|
|
|
-- { url = localhostUrl ++ pageNames.pageHome
|
|
|
|
-- , label = text "upRoot"
|
|
|
|
-- }
|
|
|
|
-- , link [ centerX ]
|
|
|
|
-- { url = localhostUrl ++ pageNames.pageHome
|
|
|
|
-- , label = text "Nutrition"
|
|
|
|
-- }
|
|
|
|
-- ]
|
2024-11-26 21:17:31 -06:00
|
|
|
]
|
|
|
|
, el
|
|
|
|
[ E.width <| px 140
|
|
|
|
, alignTop
|
|
|
|
, centerX
|
|
|
|
, D.widthEach
|
|
|
|
{ bottom = 1
|
|
|
|
, top = 0
|
|
|
|
, left = 0
|
|
|
|
, right = 0
|
|
|
|
}
|
2024-11-28 00:58:24 -06:00
|
|
|
, D.color colourTheme.textDarkGrey
|
2024-11-26 21:17:31 -06:00
|
|
|
]
|
|
|
|
none
|
|
|
|
]
|
|
|
|
, column
|
|
|
|
[ padding 20, alignTop, alignLeft ]
|
|
|
|
[ column
|
|
|
|
[ F.bold
|
2024-11-28 00:58:24 -06:00
|
|
|
, F.color colourTheme.textLightGrey
|
2024-11-26 21:17:31 -06:00
|
|
|
, F.size 17
|
|
|
|
, spacing 8
|
|
|
|
]
|
2024-11-27 15:11:21 -06:00
|
|
|
<|
|
2024-12-03 21:17:17 -06:00
|
|
|
List.map (buttonMaker props.currentRoute)
|
2024-11-27 18:53:53 -06:00
|
|
|
[ pageNames.pageRoot
|
2024-11-27 15:11:21 -06:00
|
|
|
, pageNames.pageServices
|
|
|
|
, pageNames.pageHyperBlog
|
|
|
|
, pageNames.pageDebate
|
2024-12-03 21:17:17 -06:00
|
|
|
, pageNames.pageGibberish
|
2024-11-27 15:11:21 -06:00
|
|
|
, pageNames.pageDodgers
|
|
|
|
, pageNames.pageNutriDex
|
|
|
|
, pageNames.pageInterviews
|
|
|
|
, pageNames.pageDonate
|
|
|
|
, pageNames.pageContact
|
|
|
|
]
|
2024-11-26 21:17:31 -06:00
|
|
|
]
|
|
|
|
]
|
2024-11-27 22:36:35 -06:00
|
|
|
, footerIcons
|
2024-11-11 18:57:51 -06:00
|
|
|
]
|
2024-11-14 21:10:41 -06:00
|
|
|
, el
|
2024-11-26 21:17:31 -06:00
|
|
|
[ E.width fill
|
2024-11-14 21:10:41 -06:00
|
|
|
, height fill
|
2024-11-26 21:17:31 -06:00
|
|
|
, paddingEach
|
|
|
|
{ top = 0
|
|
|
|
, right = 0
|
|
|
|
, bottom = 0
|
|
|
|
, left = 200
|
|
|
|
}
|
2024-11-14 21:10:41 -06:00
|
|
|
]
|
|
|
|
content.element
|
2024-11-11 18:57:51 -06:00
|
|
|
]
|
2024-11-11 03:57:54 -06:00
|
|
|
}
|
2024-11-26 21:17:31 -06:00
|
|
|
|
|
|
|
|
|
|
|
localhostUrl =
|
|
|
|
"http://localhost:1234/"
|
|
|
|
|
|
|
|
|
2024-11-27 22:36:35 -06:00
|
|
|
footerIcons : Element msg
|
|
|
|
footerIcons =
|
|
|
|
row
|
|
|
|
[ alignBottom
|
|
|
|
, E.width fill
|
|
|
|
, E.height <| px 100
|
|
|
|
]
|
|
|
|
[ row
|
|
|
|
[ centerX
|
|
|
|
, centerY
|
|
|
|
, E.width fill
|
|
|
|
, E.height fill
|
|
|
|
, spacing 20
|
2024-11-30 04:32:00 -06:00
|
|
|
, paddingEach
|
|
|
|
{ top = 40
|
|
|
|
, bottom = 20
|
|
|
|
, left = 20
|
|
|
|
, right = 20
|
|
|
|
}
|
2024-11-27 22:36:35 -06:00
|
|
|
]
|
|
|
|
<|
|
|
|
|
List.map
|
|
|
|
footerImageMaker
|
|
|
|
iconList
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
footerImageMaker : String -> Element msg
|
|
|
|
footerImageMaker name =
|
|
|
|
E.image
|
|
|
|
[ E.width <| px 20
|
|
|
|
, alignBottom
|
|
|
|
, centerX
|
|
|
|
]
|
|
|
|
{ src = "navbar/" ++ name ++ "-light.png"
|
|
|
|
, description = ""
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
iconList : List String
|
|
|
|
iconList =
|
|
|
|
[ "gitlab"
|
|
|
|
, "twitter"
|
|
|
|
, "mastodon"
|
|
|
|
, "discord"
|
|
|
|
]
|
|
|
|
|
|
|
|
|
2024-12-03 21:17:17 -06:00
|
|
|
buttonMaker : String -> String -> Element msg
|
|
|
|
buttonMaker currentRoute name =
|
2024-11-26 21:17:31 -06:00
|
|
|
row
|
|
|
|
[]
|
2024-11-27 15:11:21 -06:00
|
|
|
[ column [ E.width <| px 36 ]
|
2024-11-26 21:17:31 -06:00
|
|
|
[ E.image
|
|
|
|
[ alignLeft
|
|
|
|
, alignBottom
|
|
|
|
, E.width <| px 30
|
|
|
|
]
|
2024-11-27 15:11:21 -06:00
|
|
|
{ src = "navbar/" ++ String.toLower name ++ ".png"
|
2024-11-26 21:17:31 -06:00
|
|
|
, description = ""
|
|
|
|
}
|
|
|
|
]
|
|
|
|
, column
|
|
|
|
[ alignBottom ]
|
|
|
|
[ link
|
|
|
|
[]
|
2024-11-27 15:11:21 -06:00
|
|
|
{ url = localhostUrl ++ String.toLower name
|
|
|
|
, label =
|
|
|
|
el
|
2024-11-28 00:58:24 -06:00
|
|
|
[ mouseOver [ F.color colourTheme.textLightOrange ]
|
2024-12-03 21:17:17 -06:00
|
|
|
, F.color <|
|
|
|
|
if String.toLower name == currentRoute then
|
|
|
|
colourTheme.textLightOrange
|
|
|
|
|
|
|
|
else
|
|
|
|
colourTheme.textLightGrey
|
2024-11-27 15:11:21 -06:00
|
|
|
, htmlAttribute <| style "transition" "all 0.1s ease-in-out"
|
|
|
|
]
|
|
|
|
<|
|
|
|
|
text (String.toUpper name)
|
2024-11-26 21:17:31 -06:00
|
|
|
}
|
|
|
|
]
|
|
|
|
]
|