This commit is contained in:
Alex Huddleston 2020-05-16 15:25:01 -05:00
commit 720464a3d7
3 changed files with 81 additions and 62 deletions

1
.gitignore vendored
View file

@ -5,3 +5,4 @@ assets/images/420/
assets/images/full/ assets/images/full/
assets/other/ assets/other/
assets/javascripts/main.js assets/javascripts/main.js
.vscode/

View file

@ -3,7 +3,7 @@
"source-directories": [ "source-directories": [
"src" "src"
], ],
"elm-version": "0.19.0", "elm-version": "0.19.1",
"dependencies": { "dependencies": {
"direct": { "direct": {
"elm/browser": "1.0.1", "elm/browser": "1.0.1",

View file

@ -9,17 +9,18 @@ module Main exposing (main)
-} -}
import Array exposing (Array)
import Browser exposing (document)
import Browser.Dom exposing (getViewport)
import Browser.Events exposing (onResize)
import Dropdown exposing (ToggleEvent(..), drawer, dropdown, toggle)
import Html exposing (Attribute, Html, a, article, button, div, footer, h1, h2, h3, h4, header, img, li, nav, p, section, span, text, ul) import Html exposing (Attribute, Html, a, article, button, div, footer, h1, h2, h3, h4, header, img, li, nav, p, section, span, text, ul)
import Html.Attributes exposing (class, href, rel, src, title) import Html.Attributes exposing (class, href, rel, src, title)
import Html.Events exposing (onClick) import Html.Events exposing (onClick)
import Array exposing (Array)
import Dropdown exposing (ToggleEvent(..), drawer, dropdown, toggle)
import Browser.Events exposing (onResize)
import Browser.Dom exposing (getViewport)
import Browser exposing (document)
import Task exposing (perform) import Task exposing (perform)
-- MAIN -- MAIN
@ -29,7 +30,11 @@ main : Program Flags Model Msg
main = main =
document document
{ init = init { init = init
<<<<<<< HEAD
, view = (\model -> { title = "Werefox Software", body = view model }) , view = (\model -> { title = "Werefox Software", body = view model })
=======
, view = \model -> { title = "Your Mom", body = view model }
>>>>>>> f6d93413dd1d2522bcad922341680ebeb1a268fa
, update = update , update = update
, subscriptions = subscriptions , subscriptions = subscriptions
} }
@ -373,8 +378,10 @@ init flags =
"/" "/"
] ]
} }
, Task.perform WindowWidth (getViewport , Task.perform WindowWidth
|> Task.map (\viewport -> floor viewport.scene.width)) (getViewport
|> Task.map (\viewport -> floor viewport.scene.width)
)
) )
@ -405,7 +412,7 @@ initDropdown index item =
Dropdown Dropdown
name name
{ config { config
| name = "dropdown" ++ (String.fromInt index) | name = "dropdown" ++ String.fromInt index
, message = ToggleDropdown index , message = ToggleDropdown index
} }
items items
@ -414,7 +421,7 @@ initDropdown index item =
Dropdown Dropdown
name name
{ defaultDropdownConfig { defaultDropdownConfig
| name = "dropdown" ++ (String.fromInt index) | name = "dropdown" ++ String.fromInt index
, message = ToggleDropdown index , message = ToggleDropdown index
} }
items items
@ -491,6 +498,7 @@ headerBar : Model -> Html Msg
headerBar model = headerBar model =
if model.flags.mobile || model.nav.smallNav then if model.flags.mobile || model.nav.smallNav then
mobileHeaderbar model mobileHeaderbar model
else else
desktopHeaderBar model desktopHeaderBar model
@ -511,11 +519,13 @@ mobileHeaderbar model =
header [ class "mobile-header" ] header [ class "mobile-header" ]
[ div [ div
([ class "show-nav", onClick (ToggleNav (not model.nav.showNav)) ] ([ class "show-nav", onClick (ToggleNav (not model.nav.showNav)) ]
++ if model.nav.showNav then ++ (if model.nav.showNav then
[ class "active" ] [ class "active" ]
else else
[] []
) )
)
[ p [] [ p []
[ text model.nav.navText [ text model.nav.navText
, span [ class "carat" ] [] , span [ class "carat" ] []
@ -523,11 +533,13 @@ mobileHeaderbar model =
] ]
, nav , nav
([ class "mobile-nav" ] ([ class "mobile-nav" ]
++ if model.nav.showNav then ++ (if model.nav.showNav then
[] []
else else
[ class "hidden" ] [ class "hidden" ]
) )
)
[ div [ class "mobile-nav-wrapper", class "nav-wrapper" ] [ div [ class "mobile-nav-wrapper", class "nav-wrapper" ]
[ ul [] (Array.map navItem model.nav.items |> Array.toList) [ ul [] (Array.map navItem model.nav.items |> Array.toList)
] ]
@ -580,22 +592,23 @@ navLink name url =
navDropdown : String -> DropdownConfig -> Array NavItem -> Html Msg navDropdown : String -> DropdownConfig -> Array NavItem -> Html Msg
navDropdown name config items = navDropdown name config items =
li [ class "nav-item" ] li [ class "nav-item" ]
[ dropdown div [] [ dropdown div
[ []
(toggle div [ toggle div
([ class "button-wrapper" ] ([ class "button-wrapper" ]
++ if config.state then ++ (if config.state then
[ class "dropdown-active" ] [ class "dropdown-active" ]
else else
[] []
) )
)
[ p [] [ p []
[ text name [ text name
, span [ class "carat" ] [] , span [ class "carat" ] []
] ]
] ]
) , drawer ul [ class "dropdown" ] (Array.map subItem items |> Array.toList)
, (drawer ul [ class "dropdown" ] (Array.map subItem items |> Array.toList))
] ]
config.state config.state
(dropdownConfig config) (dropdownConfig config)
@ -634,7 +647,7 @@ viewGallery gallery =
|> List.indexedMap (\index item -> ( index, item )) |> List.indexedMap (\index item -> ( index, item ))
|> List.foldl |> List.foldl
(\( index, item ) acc -> (\( index, item ) acc ->
if (remainderBy gallery.columns index) < Array.length acc then if remainderBy gallery.columns index < Array.length acc then
case case
acc acc
|> Array.get (remainderBy gallery.columns index) |> Array.get (remainderBy gallery.columns index)
@ -645,6 +658,7 @@ viewGallery gallery =
Nothing -> Nothing ->
acc acc
else else
Array.push [ item ] acc Array.push [ item ] acc
) )
@ -771,10 +785,13 @@ updateGalleryWidth : Bool -> Int -> Gallery -> Gallery
updateGalleryWidth mobile width gallery = updateGalleryWidth mobile width gallery =
if mobile then if mobile then
gallery gallery
else if width < 632 then else if width < 632 then
{ gallery | columns = 1 } { gallery | columns = 1 }
else if width < 932 then else if width < 932 then
{ gallery | columns = 2 } { gallery | columns = 2 }
else else
{ gallery | columns = 3 } { gallery | columns = 3 }
@ -783,6 +800,7 @@ updateNavWidth : Int -> Navigation -> Navigation
updateNavWidth width nav = updateNavWidth width nav =
if width < 700 then if width < 700 then
{ nav | smallNav = True } { nav | smallNav = True }
else else
{ nav | smallNav = False, showNav = False } { nav | smallNav = False, showNav = False }