Skip to content

Commit

Permalink
fix assets, fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
sechmann committed Jul 2, 2024
1 parent 156fdad commit 5adc935
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 91 deletions.
61 changes: 23 additions & 38 deletions dist/index.html
Original file line number Diff line number Diff line change
@@ -1,40 +1,25 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Go og Varm</title>
<style>body { padding: 0; margin: 0; }</style>
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,500;1,500&display=swap" rel="stylesheet">
</head>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="theme-color" content="#000000" />
<title>Go' og varm</title>
<!-- <link rel="preconnect" href="https://fonts.googleapis.com" /> -->
<!-- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> -->
<link rel="icon" href="/assets/logo-ZFEO32Er.svg" sizes="any" type="image/svg+xml" />
<link
href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro&display=swap"
rel="stylesheet"
/>
<script type="module" crossorigin src="/assets/index-Dg1g5NIh.js"></script>
</head>

<body>

<pre id="elm"></pre>

<script src="app.js"></script>
<script>
const storageKey = "store";
const flags = localStorage.getItem(storageKey);
const app = Elm.Main.init({flags: flags});

app.ports.storeCache.subscribe(function(val) {
if (val === null) {
localStorage.removeItem(storageKey);
} else {
localStorage.setItem(storageKey, JSON.stringify(val));
}

// Report that the new session was stored successfully.
setTimeout(function() { app.ports.onStoreChange.send(val); }, 0);
});

// Whenever localStorage changes in another tab, report it if necessary.
window.addEventListener("storage", function(event) {
if (event.storageArea === localStorage && event.key === storageKey) {
app.ports.onStoreChange.send(event.newValue);
}
}, false);
</script>

</body>
<body>
<noscript> You need to enable JavaScript to run this app. </noscript>
</body>
</html>
51 changes: 25 additions & 26 deletions elm.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
{
"type": "application",
"source-directories": [
"src"
],
"elm-version": "0.19.1",
"dependencies": {
"direct": {
"NoRedInk/elm-json-decode-pipeline": "1.0.1",
"elm/browser": "1.0.0",
"elm/core": "1.0.0",
"elm/html": "1.0.0",
"elm/json": "1.1.2",
"elm/url": "1.0.0",
"mdgriffith/elm-ui": "1.1.8"
},
"indirect": {
"elm/time": "1.0.0",
"elm/virtual-dom": "1.0.2"
}
"type": "application",
"source-directories": ["src"],
"elm-version": "0.19.1",
"dependencies": {
"direct": {
"NoRedInk/elm-json-decode-pipeline": "1.0.1",
"elm/browser": "1.0.2",
"elm/core": "1.0.5",
"elm/html": "1.0.0",
"elm/json": "1.1.3",
"elm/url": "1.0.0",
"hmsk/elm-vite-plugin-helper": "1.0.1",
"mdgriffith/elm-ui": "1.1.8"
},
"test-dependencies": {
"direct": {
"elm-explorations/test": "1.2.2"
},
"indirect": {
"elm/random": "1.0.0"
}
"indirect": {
"elm/time": "1.0.0",
"elm/virtual-dom": "1.0.3"
}
},
"test-dependencies": {
"direct": {
"elm-explorations/test": "1.2.2"
},
"indirect": {
"elm/random": "1.0.0"
}
}
}
1 change: 0 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

outputs = inputs @ {
flake-parts,
dream2nix,
...
}:
flake-parts.lib.mkFlake {inherit inputs;} {
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
3 changes: 0 additions & 3 deletions src/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ type Msg
changeRouteTo : Maybe Route -> Model -> ( Model, Cmd Msg )
changeRouteTo maybeRoute model =
let
_ =
Debug.log "hei" maybeRoute

session =
toSession model

Expand Down
41 changes: 20 additions & 21 deletions src/Page/Home.elm
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
module Page.Home exposing (Model, Msg, init, update, view)

import Element exposing (Element, centerX, el, fill, image, link, padding, paragraph, row, spacing, text, textColumn, width)
import Element exposing (Element, centerX, column, el, fill, image, padding, paragraph, row, spacing, text, textColumn, width)
import Element.Border exposing (shadow)
import Element.Font as Font
import Session exposing (Session)
import Stylesheet exposing (Color(..), color)
import VitePluginHelper


type Msg
Expand All @@ -13,24 +14,26 @@ type Msg

type alias Model =
{ images : List { src : String, caption : String }
, post : String
, post : Element.Element Msg
, session : Session
}


init : Session -> ( Model, Cmd Msg )
init session =
( { images =
[ { src = "front1.jpg", caption = "" }
, { src = "front2.jpg", caption = "" }
, { src = "front3.jpg", caption = "" }
, { src = "front4.jpg", caption = "" }
[ { src = VitePluginHelper.asset "/assets/thumb.front1.jpg", caption = "" }
, { src = VitePluginHelper.asset "/assets/thumb.front2.jpg", caption = "" }
, { src = VitePluginHelper.asset "/assets/thumb.front3.jpg", caption = "" }
, { src = VitePluginHelper.asset "/assets/thumb.front4.jpg", caption = "" }
]
, post = """Velkommen til gårdsbutikken Go’ og varm på Søndre Holm.
Her selges norske saueskinn og skinnfeller, ull og silke til toving, filting og spinning, alpakkagarn fra Du Store Alpakka, ullgarn fra bl.a. Leine Merino, Askeladden og Hillesvåg, mønster, knapper, ulltøy, ullsåler og mye annet rart!
På hjemmesiden vises bare et lite utvalg. Skinnfeller sys på bestilling. Åpent tirsdag og torsdag kl. 10.00-20.00."""
, post =
column [ spacing 20 ]
[ paragraph [ Font.bold ] [ text "Velkommen til gårdsbutikken Go’ og varm på Søndre Holm." ]
, paragraph [] [ text "Her selges norske saueskinn og skinnfeller, ull og silke til toving, filting og spinning, alpakkagarn fra Du Store Alpakka, ullgarn fra bl.a. Leine Merino, Askeladden og Hillesvåg, mønster, knapper, ulltøy, ullsåler og mye annet rart!" ]
, paragraph [] [ text "På hjemmesiden vises bare et lite utvalg. Skinnfeller sys på bestilling." ]
, paragraph [] [ text "Åpent tirsdag og torsdag kl. 10.00-20.00." ]
]
, session = session
}
, Cmd.none
Expand All @@ -46,18 +49,14 @@ update msg model =

img : { src : String, caption : String } -> Element msg
img i =
link [ centerX, shadow { offset = ( 2.0, 2.0 ), size = 1, blur = 15.0, color = color Gray } ]
{ url = "/assets/" ++ i.src
, label =
image
[]
{ src = "/assets/thumb." ++ i.src
, description = i.caption
}
image
[ centerX, shadow { offset = ( 2.0, 2.0 ), size = 1, blur = 15.0, color = color Gray } ]
{ src = i.src
, description = i.caption
}


view : Model -> { title : String, content : List (Element msg) }
view : Model -> { title : String, content : List (Element Msg) }
view model =
{ title = "Hjem"
, content =
Expand All @@ -66,7 +65,7 @@ view model =
[ textColumn [ centerX, Font.size 16, Font.center ]
[ paragraph []
[ el [ padding 5 ]
(text model.post)
model.post
]
]
]
Expand Down
3 changes: 2 additions & 1 deletion src/Views/Page.elm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Element.Region as Region
import Stylesheet exposing (Color(..), color)
import Viewer exposing (Viewer)
import Views.Navigation exposing (navigation)
import VitePluginHelper


view : Maybe Viewer -> { title : String, content : List (Element msg) } -> Document msg
Expand All @@ -32,7 +33,7 @@ view _ { title, content } =
, link [ alignRight ] { url = "https://goo.gl/maps/g26t1xp4ph33bN4G7", label = text "Ulvedalsveien 150, 2020 Skedsmokorset" }
]
, row [ width fill, padding 30 ]
[ image [ centerX ] { src = "assets/logo.svg", description = "Go og varm" }
[ image [ centerX ] { src = VitePluginHelper.asset "/assets/logo.svg", description = "Go og varm" }
]
]

Expand Down

0 comments on commit 5adc935

Please sign in to comment.