website/frontend/src/Pages/Contact.elm

189 lines
4.2 KiB
Elm
Raw Normal View History

2024-11-28 19:49:28 -06:00
module Pages.Contact exposing (Model, Msg, page)
2024-12-09 19:53:09 -06:00
import Config.Data.Identity exposing (pageNames)
2024-12-28 18:42:47 -06:00
import Config.Helpers.Cards.Inner.Helpers
exposing
( detailBodyMaker
, detailFormat
, numberedListItem
)
2024-12-27 01:30:21 -06:00
import Config.Helpers.Cards.Outer.Helpers exposing (cardMaker)
import Config.Helpers.Cards.Outer.Types as C
2024-12-15 02:31:26 -06:00
import Config.Helpers.Format exposing (..)
2024-12-22 04:36:03 -06:00
import Config.Helpers.Headers.Helpers exposing (..)
2024-12-28 18:42:47 -06:00
import Config.Helpers.Headers.Records
exposing
( contactHeader
, nutriDexHeader
)
2024-12-22 19:42:23 -06:00
import Config.Helpers.Headers.Types as R exposing (..)
2024-12-28 18:42:47 -06:00
import Config.Helpers.ImageFolders as M exposing (..)
2024-12-11 03:48:49 -06:00
import Config.Helpers.Response
2024-12-09 19:53:09 -06:00
exposing
2024-12-09 20:30:04 -06:00
( pageList
2024-12-09 19:53:09 -06:00
, topLevelContainer
)
2024-12-18 20:11:04 -06:00
import Config.Helpers.ServiceFormat
2024-12-15 02:31:26 -06:00
exposing
2024-12-18 20:11:04 -06:00
( chunkMaker
2024-12-27 01:30:21 -06:00
, divider
2024-12-18 20:11:04 -06:00
, titleMaker
2024-12-15 02:31:26 -06:00
)
import Config.Helpers.ToolTip exposing (..)
2024-12-09 19:53:09 -06:00
import Config.Helpers.Viewport exposing (resetViewport)
2024-12-15 02:31:26 -06:00
import Config.Pages.Contact.Types exposing (..)
2024-12-27 23:24:35 -06:00
import Config.Style.Colour.Helpers exposing (ThemeColor(..), colourTheme)
2024-12-28 18:42:47 -06:00
import Config.Style.Images exposing (imageSquareMaker)
2024-12-15 02:31:26 -06:00
import Config.Style.Transitions
exposing
( hoverFontDarkOrange
, transitionStyleFast
, transitionStyleSlow
)
2024-11-28 19:49:28 -06:00
import Effect exposing (Effect)
2024-12-09 19:53:09 -06:00
import Element as E exposing (..)
2024-12-15 02:31:26 -06:00
import Element.Background as B
import Element.Border as D
import Element.Font as F
import Html.Attributes as H exposing (style)
2024-11-28 19:49:28 -06:00
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
2024-11-28 19:49:28 -06:00
}
|> Page.withLayout toLayout
toLayout : Model -> Layouts.Layout Msg
toLayout model =
2024-12-07 15:43:26 -06:00
Layouts.Navbar {}
2024-11-28 19:49:28 -06:00
-- INIT
type alias Model =
{}
init : () -> ( Model, Effect Msg )
init () =
( {}
2024-12-03 04:59:27 -06:00
, Effect.map
(\_ -> NoOp)
(Effect.sendCmd resetViewport)
2024-11-28 19:49:28 -06:00
)
-- 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 =
2024-12-14 23:59:50 -06:00
{ title = pageNames.pageContact
2024-11-28 19:49:28 -06:00
, attributes = []
, element = contactContainer shared.device
2024-11-28 19:49:28 -06:00
}
contactContainer : Device -> Element msg
contactContainer device =
topLevelContainer (contactList device)
2024-11-28 19:49:28 -06:00
contactList : Device -> Element msg
contactList device =
column
(case ( device.class, device.orientation ) of
_ ->
2024-12-22 19:42:23 -06:00
pageList device
)
<|
2024-12-03 04:59:27 -06:00
List.concat
2024-12-28 18:42:47 -06:00
[ [ headerMaker (R.Debate contactHeader) ]
2024-12-22 19:42:23 -06:00
, List.map
2024-12-21 23:23:59 -06:00
(\contact ->
2024-12-27 23:24:35 -06:00
cardMaker device (C.Contact contact) (contentList device contact)
2024-12-21 23:23:59 -06:00
)
2024-12-28 18:42:47 -06:00
[ contactInquiry
, contactCriticism
]
]
2024-12-15 02:31:26 -06:00
2024-12-27 23:24:35 -06:00
contentList : Device -> Contact -> List (Element msg)
contentList device contact =
2024-12-28 18:42:47 -06:00
[ descriptionMaker device contact ]
2024-12-15 02:31:26 -06:00
2024-12-28 18:42:47 -06:00
descriptionMaker : Device -> Contact -> Element msg
descriptionMaker device contact =
2024-12-27 23:24:35 -06:00
let
2024-12-28 18:42:47 -06:00
image : String -> Element msg
image size =
el
[ alignLeft
, paddingEach
{ top = 0
, right = 10
, bottom = 0
2024-12-15 02:31:26 -06:00
, left = 0
}
]
2024-12-28 18:42:47 -06:00
<|
imageSquareMaker device (imagePathMaker M.Contact contact.contactImage) True size
in
detailFormat row
[ case ( device.class, device.orientation ) of
( Phone, Portrait ) ->
none
( Tablet, Portrait ) ->
none
_ ->
image "Fatty"
, detailFormat column
[ detailBodyMaker TextLightGrey
(text contact.contactDescription)
2024-12-15 02:31:26 -06:00
]
2024-12-28 18:42:47 -06:00
]