Skip to content

Commit 980acbe

Browse files
committed
Add web standards page
1 parent 365800e commit 980acbe

File tree

11 files changed

+107
-0
lines changed

11 files changed

+107
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
defmodule ComponentsGuideWeb.WebController do
2+
use ComponentsGuideWeb, :controller
3+
require Logger
4+
5+
def index(conn, _params) do
6+
render(conn, "index.html", article: "intro")
7+
end
8+
9+
@articles ["url", "promise"]
10+
11+
def show(conn, %{"id" => article}) when article in @articles do
12+
render(conn, "index.html", article: article)
13+
end
14+
15+
def show(conn, _params) do
16+
raise Phoenix.Router.NoRouteError, conn: conn, router: ComponentsGuideWeb.Router
17+
end
18+
end
19+
20+
defmodule ComponentsGuideWeb.WebView do
21+
use ComponentsGuideWeb, :view
22+
23+
use ComponentsGuideWeb.Snippets
24+
25+
def header_styles() do
26+
color = {:lab, 47, 10, -44}
27+
28+
gradient = Styling.linear_gradient("150grad", [
29+
{:lab, 47, 5, -44},
30+
{:lab, 47, -24, -44},
31+
color,
32+
{:lab, 47, 53, -44}
33+
])
34+
35+
"background-color: #{color |> Styling.to_css()}; background-image: #{gradient};"
36+
end
37+
end

apps/components_guide_web/lib/components_guide_web/router.ex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ defmodule ComponentsGuideWeb.Router do
3333
ComposableSystemsController,
3434
only: [:index, :show]
3535

36+
resources "/web",
37+
WebController,
38+
only: [:index, :show]
39+
3640
live "/color", ColorLive, :index
3741
live "/color/:definition", ColorLive, :show
3842
live "/color/lab/:definition", ColorLive, :lab

apps/components_guide_web/lib/components_guide_web/templates/landing/index.html.eex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ subhead = "Learn via guides to accessibility, TDD, BDD, naming, performance, and
5454
<%= render ComponentsGuideWeb.AccessibilityFirstView, "_top.html" %>
5555
</article>
5656

57+
<article class="text-white text-shadow py-6" style="<%= sections_styles(:other) %>">
58+
<%= render ComponentsGuideWeb.WebView, "_top.html" %>
59+
</article>
60+
5761
<article class="text-white text-shadow py-6" style="<%= sections_styles(:orange) %>">
5862
<%= render ComponentsGuideWeb.ComposableSystemsView, "_top.html" %>
5963
</article>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<header style="<%= header_styles() %>">
2+
<%= render ComponentsGuideWeb.WebView, "_top.html" %>
3+
</header>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<nav class="pt-6 pb-4">
2+
<ul y-y x-x=md class="text-lg font-bold text-shadow" style="--link-padding: 0.75em">
3+
<li><%= link("Why?", to: '/web') %>
4+
<li><%= link("URL", to: '/web/url') %>
5+
<li><%= link("Promise", to: '/web/promise') %>
6+
</ul>
7+
</nav>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<div class="mx-auto max-w-4xl text-white">
2+
<h1 y-y x-x=md class="pt-8 row space-x-4 text-4xl text-center font-bold leading-tight text-shadow">
3+
<span class="mr-1 text-5xl">🧶💝</span>
4+
<span><%= "Web Standards" %></span>
5+
</h1>
6+
<%= render ComponentsGuideWeb.WebView, "_nav.html" %>
7+
</div>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<%= render @view_module, "_header.html" %>
2+
3+
<article>
4+
<div class="text-white bg-gray-900">
5+
<div class="content max-w-4xl mx-auto py-8 text-xl">
6+
<%= render(@view_module, @article <> ".html", conn: @conn) %>
7+
</div>
8+
</div>
9+
</article>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Why do we have the web?
2+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Promise
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# URL
2+
3+
## Anatomy of a URL
4+
5+
```
6+
https://example.org/songs?first=20&sortBy=releaseDate
7+
```
8+
9+
### Scheme
10+
### Host
11+
### Path
12+
### Query
13+
14+
## Relative URLs

0 commit comments

Comments
 (0)