Skip to content

Commit

Permalink
ui: implement home page
Browse files Browse the repository at this point in the history
Signed-off-by: Guillaume Hivert <[email protected]>
  • Loading branch information
ghivert committed May 6, 2024
1 parent ed13379 commit e8bfadc
Show file tree
Hide file tree
Showing 16 changed files with 479 additions and 38 deletions.
8 changes: 4 additions & 4 deletions apps/frontend/gleam.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ typescript_declarations = true
[dependencies]
gleam_javascript = "~> 0.8"
gleam_stdlib = "~> 0.34 or ~> 1.0"
lustre = {path = "../../../lustre"}
lustre_http = "~> 0.5"
plinth = {path = "../../../plinth"}
sketch = {path = "../../../sketch"}
tardis = {path = "../../packages/tardis"}
plinth = ">= 0.2.0 and < 1.0.0"
sketch = ">= 2.2.0 and < 3.0.0"
tardis = ">= 0.1.0 and < 1.0.0"
lustre = ">= 4.2.0 and < 5.0.0"

[dev-dependencies]
gleeunit = "~> 1.0"
4 changes: 1 addition & 3 deletions apps/frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
<link rel="stylesheet" href="/main.css" />
<link rel="stylesheet" href="/normalize.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Obsidian Share</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<title>Gling</title>
</head>
<body>
<div id="app"></div>
Expand Down
22 changes: 11 additions & 11 deletions apps/frontend/manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ packages = [
{ name = "gleam_fetch", version = "0.4.0", build_tools = ["gleam"], requirements = ["gleam_http", "gleam_javascript", "gleam_stdlib"], otp_app = "gleam_fetch", source = "hex", outer_checksum = "7446410A44A1D1328F5BC1FF4FC9CBD1570479EA69349237B3F82E34521CCC10" },
{ name = "gleam_http", version = "3.6.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_http", source = "hex", outer_checksum = "8C07DF9DF8CC7F054C650839A51C30A7D3C26482AC241C899C1CEA86B22DBE51" },
{ name = "gleam_javascript", version = "0.8.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_javascript", source = "hex", outer_checksum = "14D5B7E1A70681E0776BF0A0357F575B822167960C844D3D3FA114D3A75F05A8" },
{ name = "gleam_json", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "thoas"], otp_app = "gleam_json", source = "hex", outer_checksum = "8B197DD5D578EA6AC2C0D4BDC634C71A5BCA8E7DB5F47091C263ECB411A60DF3" },
{ name = "gleam_json", version = "1.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib", "thoas"], otp_app = "gleam_json", source = "hex", outer_checksum = "9063D14D25406326C0255BDA0021541E797D8A7A12573D849462CAFED459F6EB" },
{ name = "gleam_otp", version = "0.10.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_stdlib"], otp_app = "gleam_otp", source = "hex", outer_checksum = "0B04FE915ACECE539B317F9652CAADBBC0F000184D586AAAF2D94C100945D72B" },
{ name = "gleam_stdlib", version = "0.36.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "C0D14D807FEC6F8A08A7C9EF8DFDE6AE5C10E40E21325B2B29365965D82EB3D4" },
{ name = "gleam_stdlib", version = "0.37.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "5398BD6C2ABA17338F676F42F404B9B7BABE1C8DC7380031ACB05BBE1BCF3742" },
{ name = "gleeunit", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "72CDC3D3F719478F26C4E2C5FED3E657AC81EC14A47D2D2DEBB8693CA3220C3B" },
{ name = "lustre", version = "4.1.6", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_json", "gleam_otp", "gleam_stdlib"], source = "local", path = "../../../lustre" },
{ name = "lustre", version = "4.2.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_json", "gleam_otp", "gleam_stdlib"], otp_app = "lustre", source = "hex", outer_checksum = "258F876CD7AB12C2C773F1A30F76DFC0A0ED989B720070DF32FC0717A6A0E60C" },
{ name = "lustre_http", version = "0.5.2", build_tools = ["gleam"], requirements = ["gleam_fetch", "gleam_http", "gleam_javascript", "gleam_json", "gleam_stdlib", "lustre"], otp_app = "lustre_http", source = "hex", outer_checksum = "FB0478CBFA6B16DBE8ECA326DAE2EC15645E04900595EF2C4F039ABFA0512ABA" },
{ name = "plinth", version = "0.1.13", build_tools = ["gleam"], requirements = ["gleam_javascript", "gleam_json", "gleam_stdlib"], source = "local", path = "../../../plinth" },
{ name = "sketch", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "lustre", "plinth"], source = "local", path = "../../../sketch" },
{ name = "tardis", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "lustre", "plinth", "sketch"], source = "local", path = "../../packages/tardis" },
{ name = "thoas", version = "0.4.1", build_tools = ["rebar3"], requirements = [], otp_app = "thoas", source = "hex", outer_checksum = "4918D50026C073C4AB1388437132C77A6F6F7C8AC43C60C13758CC0ADCE2134E" },
{ name = "plinth", version = "0.2.0", build_tools = ["gleam"], requirements = ["gleam_javascript", "gleam_json", "gleam_stdlib"], otp_app = "plinth", source = "hex", outer_checksum = "83211E672D83F3CE14681D0ECD3AD883EE7588E423E7C9DDDB460014AD60AC24" },
{ name = "sketch", version = "2.2.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_otp", "gleam_stdlib", "lustre", "plinth"], otp_app = "sketch", source = "hex", outer_checksum = "8860E68627E33E4B63379050C1699546828CBF02364F26E191B95EA080AE483A" },
{ name = "tardis", version = "0.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "lustre", "plinth", "sketch"], otp_app = "tardis", source = "hex", outer_checksum = "C8E7BAB95C59EF50332905A06B82BB35526B7BE2F191580F3CD8790903AA49F7" },
{ name = "thoas", version = "1.2.0", build_tools = ["rebar3"], requirements = [], otp_app = "thoas", source = "hex", outer_checksum = "540C8CB7D9257F2AD0A14145DC23560F91ACDCA995F0CCBA779EB33AF5D859D1" },
]

[requirements]
gleam_javascript = { version = "~> 0.8" }
gleam_stdlib = { version = "~> 0.34 or ~> 1.0" }
gleeunit = { version = "~> 1.0" }
lustre = { path = "../../../lustre" }
lustre = { version = ">= 4.2.0 and < 5.0.0"}
lustre_http = { version = "~> 0.5" }
plinth = { path = "../../../plinth" }
sketch = { path = "../../../sketch" }
tardis = { path = "../../packages/tardis" }
plinth = { version = ">= 0.2.0 and < 1.0.0" }
sketch = { version = ">= 2.2.0 and < 3.0.0" }
tardis = { version = ">= 0.1.0 and < 1.0.0" }
Binary file not shown.
7 changes: 7 additions & 0 deletions apps/frontend/public/images/lucy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion apps/frontend/public/images/sign-in.svg

This file was deleted.

20 changes: 13 additions & 7 deletions apps/frontend/public/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ body {
min-height: 100vh;
background: var(--background);
color: var(--text-color);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
font-family: Lexend, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

:root {
Expand All @@ -16,7 +16,7 @@ body {
--green: #01FF70;
--purple: #8C3A96;
--white: white;
--orange: #FF851B;
--orange: #FF851B;
--link: #0074D9;
--disabled: #ddd;
--text-disabled: #333;
Expand All @@ -36,15 +36,21 @@ body {
}
}

@keyframes progress_bar {
from { width: 100%; }
to { width: 0%; }
}

h1, h2, h3, h4, h5, h6 {
margin: 0;
}

* {
box-sizing: border-box;
}

@font-face {
font-family: Lexend;
src: url("/Lexend-VariableFont_wght.ttf") format("woff2-variations");
font-weight: 100 1000;
font-stretch: 25% 151%;
}

a {
color: var(--a-color);
}
8 changes: 6 additions & 2 deletions apps/frontend/src/data/model.gleam
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
pub type Model {
Model
Model(input: String)
}

pub fn init() {
Model
Model(input: "")
}

pub fn update_input(model: Model, content: String) {
Model(..model, input: content)
}
2 changes: 2 additions & 0 deletions apps/frontend/src/data/msg.gleam
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
pub type Msg {
None
SubmitSearch
UpdateInput(String)
}
24 changes: 14 additions & 10 deletions apps/frontend/src/frontend.gleam
Original file line number Diff line number Diff line change
@@ -1,35 +1,39 @@
import data/model.{type Model}
import data/msg.{type Msg}
import frontend/view
import gleam/io
import lustre
import lustre/effect
import lustre/element/html as h
import lustre/update
import sketch/lustre as sketch
import sketch/options as sketch_options
import tardis

pub fn main() {
let assert Ok(debugger_) = tardis.singleton("gling")
let init = fn(_) { #(model.init(), effect.none()) }

let assert Ok(debugger_) = tardis.single("gling")

let assert Ok(cache) =
sketch_options.document()
sketch_options.node()
|> sketch.setup()

let assert Ok(_) =
fn(_) { #(model.init(), effect.none()) }
|> lustre.application(update, view)
|> sketch.wrap(cache)
view.view
|> sketch.compose(cache)
|> lustre.application(init, update, _)
|> tardis.wrap(debugger_)
|> lustre.start("#app", Nil)
|> tardis.activate(debugger_)
}

fn update(model: Model, msg: Msg) {
case msg {
msg.UpdateInput(content) ->
model
|> model.update_input(content)
|> update.none()
msg.SubmitSearch -> update.none(model)
msg.None -> update.none(model)
}
}

fn view(_model: Model) {
h.div([], [])
}
29 changes: 29 additions & 0 deletions apps/frontend/src/frontend/colors/palette.gleam
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
pub type Palette {
Palette(
white: String,
dark_white: String,
unnamed_blue: String,
faff_pink: String,
dark_faff_pink: String,
aged_plastic_yellow: String,
unexpected_aubergine: String,
underwater_blue: String,
charcoal: String,
black: String,
blacker: String,
)
}

pub const dark = Palette(
white: "#fefefc",
dark_white: "#aeaeac",
unnamed_blue: "#a6f0fc",
faff_pink: "#ffaff3",
dark_faff_pink: "#eb94de",
aged_plastic_yellow: "#fffbe8",
unexpected_aubergine: "#584355",
underwater_blue: "#292d3e",
charcoal: "#2f2f2f",
black: "#1e1e1e",
blacker: "#151515",
)
Loading

0 comments on commit e8bfadc

Please sign in to comment.