mirror of
https://gitlab.com/upRootNutrition/website.git
synced 2025-06-16 04:25:11 -05:00
124 lines
2.4 KiB
Elm
Executable file
124 lines
2.4 KiB
Elm
Executable file
module Pages.Home_ exposing (Model, Msg, page)
|
|
|
|
import Blog.Helpers exposing (..)
|
|
import Config.Colour as T exposing (..)
|
|
import Config.Format as O exposing (..)
|
|
import Config.Identity as I exposing (..)
|
|
import Config.Response exposing (..)
|
|
import Config.Viewport exposing (..)
|
|
import Effect exposing (Effect)
|
|
import Element as E exposing (..)
|
|
import Element.Background as B exposing (..)
|
|
import Element.Border as D exposing (..)
|
|
import Element.Font as F
|
|
import Home.Helpers exposing (..)
|
|
import Html.Attributes as H exposing (style)
|
|
import Layouts
|
|
import Page exposing (Page)
|
|
import Route exposing (Route)
|
|
import Shared exposing (..)
|
|
import View exposing (View)
|
|
|
|
|
|
page : Shared.Model -> Route () -> Page Model Msg
|
|
page shared route =
|
|
Page.new
|
|
{ init = init
|
|
, update = update
|
|
, subscriptions = subscriptions
|
|
, view = view shared
|
|
}
|
|
|> Page.withLayout toLayout
|
|
|
|
|
|
toLayout : Model -> Layouts.Layout Msg
|
|
toLayout model =
|
|
Layouts.Navbar {}
|
|
|
|
|
|
|
|
-- INIT
|
|
|
|
|
|
type alias Model =
|
|
{}
|
|
|
|
|
|
init : () -> ( Model, Effect Msg )
|
|
init () =
|
|
( {}
|
|
, Effect.map
|
|
(\_ -> NoOp)
|
|
(Effect.sendCmd resetViewport)
|
|
)
|
|
|
|
|
|
|
|
-- UPDATE
|
|
|
|
|
|
type Msg
|
|
= NoOp
|
|
|
|
|
|
update : Msg -> Model -> ( Model, Effect Msg )
|
|
update msg model =
|
|
case msg of
|
|
NoOp ->
|
|
( model
|
|
, Effect.none
|
|
)
|
|
|
|
|
|
|
|
-- SUBSCRIPTIONS
|
|
|
|
|
|
subscriptions : Model -> Sub Msg
|
|
subscriptions model =
|
|
Sub.none
|
|
|
|
|
|
|
|
-- VIEW
|
|
|
|
|
|
view : Shared.Model -> Model -> View Msg
|
|
view shared model =
|
|
{ title = pageNames.pageHome
|
|
, attributes = []
|
|
, element = homeContainer shared.device
|
|
}
|
|
|
|
|
|
homeContainer : Device -> Element msg
|
|
homeContainer device =
|
|
topLevelContainer (homeList device)
|
|
|
|
|
|
homeList : Device -> Element msg
|
|
homeList device =
|
|
column pageListDesktop
|
|
[ case device.class of
|
|
Desktop ->
|
|
desktopHomePage
|
|
|
|
BigDesktop ->
|
|
desktopHomePage
|
|
|
|
Tablet ->
|
|
case device.orientation of
|
|
Portrait ->
|
|
mobileLargeHomePage
|
|
|
|
Landscape ->
|
|
mobileLargeHomePage
|
|
|
|
Phone ->
|
|
case device.orientation of
|
|
Portrait ->
|
|
mobileSmallHomePage
|
|
|
|
Landscape ->
|
|
mobileSmallHomePage
|
|
]
|