mirror of
https://gitlab.com/upRootNutrition/website.git
synced 2025-06-16 04:25:11 -05:00
167 lines
3.7 KiB
Elm
167 lines
3.7 KiB
Elm
![]() |
module Pages.Contact.Inquiry exposing (Model, Msg, page)
|
||
|
|
||
|
import Config.Data.Identity exposing (pageNames)
|
||
|
import Config.Helpers.Cards.Inner.Helpers exposing (detailBodyMaker, detailFormat, numberedListItem)
|
||
|
import Config.Helpers.Cards.Outer.Helpers exposing (cardMaker)
|
||
|
import Config.Helpers.Cards.Outer.Types as C
|
||
|
import Config.Helpers.Format exposing (..)
|
||
|
import Config.Helpers.Headers.Helpers exposing (..)
|
||
|
import Config.Helpers.Headers.Records exposing (contactHeader, nutriDexHeader)
|
||
|
import Config.Helpers.Headers.Types as R exposing (..)
|
||
|
import Config.Helpers.Response
|
||
|
exposing
|
||
|
( pageList
|
||
|
, topLevelContainer
|
||
|
)
|
||
|
import Config.Helpers.ServiceFormat
|
||
|
exposing
|
||
|
( divider
|
||
|
, titleMaker
|
||
|
)
|
||
|
import Config.Helpers.ToolTip exposing (..)
|
||
|
import Config.Helpers.Viewport exposing (resetViewport)
|
||
|
import Config.Pages.Contact.Types exposing (..)
|
||
|
import Config.Style.Colour.Helpers exposing (ThemeColor(..), colourTheme)
|
||
|
import Config.Style.Transitions
|
||
|
exposing
|
||
|
( hoverFontDarkOrange
|
||
|
, transitionStyleFast
|
||
|
, transitionStyleSlow
|
||
|
)
|
||
|
import Effect exposing (Effect)
|
||
|
import Element as E exposing (..)
|
||
|
import Element.Background as B
|
||
|
import Element.Border as D
|
||
|
import Element.Font as F
|
||
|
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.pageContact ++ " (inquiry)"
|
||
|
, attributes = []
|
||
|
, element = contactContainer shared.device
|
||
|
}
|
||
|
|
||
|
|
||
|
contactContainer : Device -> Element msg
|
||
|
contactContainer device =
|
||
|
topLevelContainer (contactList device)
|
||
|
|
||
|
|
||
|
contactList : Device -> Element msg
|
||
|
contactList device =
|
||
|
column
|
||
|
(case ( device.class, device.orientation ) of
|
||
|
_ ->
|
||
|
pageList device
|
||
|
)
|
||
|
<|
|
||
|
List.concat
|
||
|
[ case ( device.class, device.orientation ) of
|
||
|
( Phone, Portrait ) ->
|
||
|
[ headerMaker (R.Contact contactHeader) ]
|
||
|
|
||
|
( Tablet, Portrait ) ->
|
||
|
[ headerMaker (R.Contact contactHeader) ]
|
||
|
|
||
|
_ ->
|
||
|
[ none ]
|
||
|
, List.map
|
||
|
(\contact ->
|
||
|
cardMaker device (C.Contact contact) (contentList device contact)
|
||
|
)
|
||
|
[ contactInquiry ]
|
||
|
]
|
||
|
|
||
|
|
||
|
contentList : Device -> Contact -> List (Element msg)
|
||
|
contentList device contact =
|
||
|
[ instructionBody device ]
|
||
|
|
||
|
|
||
|
instructionBody : Device -> Element msg
|
||
|
instructionBody device =
|
||
|
column
|
||
|
[ spacing 20
|
||
|
, paddingEach
|
||
|
{ top = 10
|
||
|
, bottom = 0
|
||
|
, left = 0
|
||
|
, right = 0
|
||
|
}
|
||
|
]
|
||
|
[ detailFormat paragraph
|
||
|
[ detailBodyMaker TextLightGrey (text "") ]
|
||
|
, detailFormat paragraph
|
||
|
[ detailBodyMaker TextLightGrey (text "") ]
|
||
|
]
|