Update gitignore, update code.
This commit is contained in:
parent
21dbefab2d
commit
f6d93413dd
3 changed files with 78 additions and 63 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -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/
|
||||||
|
|
2
elm.json
2
elm.json
|
@ -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",
|
||||||
|
|
52
src/Main.elm
52
src/Main.elm
|
@ -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,7 @@ main : Program Flags Model Msg
|
||||||
main =
|
main =
|
||||||
document
|
document
|
||||||
{ init = init
|
{ init = init
|
||||||
, view = (\model -> { title = "Your Mom", body = view model })
|
, view = \model -> { title = "Your Mom", body = view model }
|
||||||
, update = update
|
, update = update
|
||||||
, subscriptions = subscriptions
|
, subscriptions = subscriptions
|
||||||
}
|
}
|
||||||
|
@ -370,8 +371,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)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -402,7 +405,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
|
||||||
|
@ -411,7 +414,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
|
||||||
|
@ -488,6 +491,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
|
||||||
|
|
||||||
|
@ -508,11 +512,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" ] []
|
||||||
|
@ -520,11 +526,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)
|
||||||
]
|
]
|
||||||
|
@ -577,22 +585,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)
|
||||||
|
@ -631,7 +640,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)
|
||||||
|
@ -642,6 +651,7 @@ viewGallery gallery =
|
||||||
|
|
||||||
Nothing ->
|
Nothing ->
|
||||||
acc
|
acc
|
||||||
|
|
||||||
else
|
else
|
||||||
Array.push [ item ] acc
|
Array.push [ item ] acc
|
||||||
)
|
)
|
||||||
|
@ -765,10 +775,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 }
|
||||||
|
|
||||||
|
@ -777,6 +790,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 }
|
||||||
|
|
||||||
|
|
Reference in a new issue