Skip to content

Commit b7b7d1b

Browse files
committed
Improve concepts, accessibility first
1 parent 6b326f5 commit b7b7d1b

File tree

8 files changed

+45
-30
lines changed

8 files changed

+45
-30
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ topics = [
4242
</ul>
4343
<p>Define what your elements are using a clear standard. Let your users quickly jump around the key parts of your page (better UX), and leverage those in your tests (better DX).</p>
4444
<% end %>
45-
<%= topic_article(title: "Widgets, Attributes & States") do %>
45+
<%= topic_article(title: "Widgets, Attributes & States", link: Routes.accessibility_first_path(@conn, :show, "properties-cheatsheet")) do %>
4646
<p>Learn the standards for interactive widgets usable by touch, mouse, and keyboard. Let users know which page is current or which sub-control is selected.</p>
4747
<% end %>
4848
<%= topic_article(title: "BDD with Jest & React Testing Library") do %>

apps/components_guide_web/lib/components_guide_web/templates/accessibility_first/properties-cheatsheet.html.eex

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,30 @@
55
<header class="text-white" style="background: <%= header_background %>;">
66
<section class="container px-6 pt-6 pb-6">
77
<h1 class="mx-auto max-w-4xl text-4xl text-center font-bold leading-tight text-shadow">
8-
<%= "Properties Cheatsheet" %>
8+
<%= "Accessible Properties Cheatsheet" %>
99
</h1>
10-
<p class="mt-4 mx-auto max-w-3xl text-3xl text-center leading-snug italic text-yellow-100 text-shadow">
11-
<%= "UI roles and their pre-written tests." %>
10+
<p class="mt-4 mx-auto max-w-3xl text-3xl text-center leading-snug italic text-gray-100 text-shadow">
11+
<%= "Learn properties." %>
1212
</p>
1313
</section>
1414
</header>
1515

1616
<div class="text-base lg:text-lg flex items-stretch bg-gray-900">
1717
<nav class="w-48 lg:w-64 bg-gray-100 border-r border-gray-200">
18-
<ul class="sticky top-0 p-4 pl-6 list-none leading-loose">
18+
<h2 class="pt-4 pl-4">I want to:</h2>
19+
<ul class="sticky top-0 p-2 pl-8 list-none leading-loose">
1920
<li><%= link "Hide", to: "#hide" %>
21+
<li><%= link "Current", to: "#current" %>
22+
<li><%= link "Selected", to: "#selected" %>
23+
<li><%= link "Invalid", to: "#invalid" %>
24+
<li><%= link "Required", to: "#required" %>
25+
<li><%= link "Readonly", to: "#readonly" %>
2026
<li><%= link("Queries 🔗", to: "https://testing-library.com/docs/dom-testing-library/api-queries") %>
2127
<li><%= link("Matchers 🔗", to: "https://github.com/testing-library/jest-dom") %>
2228
</ul>
2329
</nav>
2430
<div class="mx-auto flex-shrink">
25-
<section aria-label="Roles Cheatsheet" class="max-w-xl lg:max-w-3xl px-4 pt-8 pb-16 text-white">
31+
<section aria-label="Roles Cheatsheet" class="max-w-xl lg:max-w-4xl px-6 pt-8 pb-16 text-white">
2632
<article>
2733
<%= h2.("I want to hide an element", id: "hidden") %>
2834

@@ -39,7 +45,7 @@
3945
<%=
4046
"""
4147
it("is hidden", () => {
42-
expect(queryByRole('link', { name: 'Sign In' })).toBeNull();
48+
expect(screen.queryByRole('link', { name: 'Sign In' })).toBeNull();
4349
})
4450
""" |> code_block(:js)
4551
%>
@@ -58,7 +64,7 @@
5864
"""
5965
it("is shown to non-visual users", () => {
6066
expect(
61-
getByRole('link', { name: 'Sign In' })
67+
screen.getByRole('link', { name: 'Sign In' })
6268
).toBeInTheDocument();
6369
})
6470
""" |> code_block(:js)
@@ -87,7 +93,7 @@
8793
"""
8894
it("ignores emoji in accessible name", () => {
8995
expect(
90-
getByRole('link', { name: 'Sign In' })
96+
screen.getByRole('link', { name: 'Sign In' })
9197
).toBeInTheDocument();
9298
})
9399
""" |> code_block(:js)

apps/components_guide_web/lib/components_guide_web/templates/accessibility_first/roles-cheatsheet.html.eex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<li><%= link "Checkbox", to: "#checkbox" %>
2222
<li><%= link "Textbox", to: "#textbox" %>
2323
<li><%= link "Radio", to: "#radio" %>
24+
<li><%= link "Range", to: "#range" %>
2425
<li><%= link "Tabs", to: "#tabs" %>
2526
<li><%= link("List of roles 🔗", to: "https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques") %>
2627
<li><%= link("Queries 🔗", to: "https://testing-library.com/docs/dom-testing-library/api-queries") %>

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,34 +11,34 @@
1111

1212
<div class="bg-white">
1313
<section aria-label="Concepts" class="container pt-8 pb-16 text-2xl">
14-
<%= topic_article title: "Naming" do %>
15-
<ul class="list-disc nums-tabular">
14+
<%= topic_article title: "Naming", link: "/naming" do %>
15+
<ul class="list-none">
1616
<li>Semantics vs presentation
1717
<li>Sharing a design language
1818
<li>Structuring modules and files
1919
<li>Better documentation with clearer concepts
2020
</ul>
2121
<% end %>
2222

23-
<%= topic_article title: "Testing" do %>
24-
<ul class="list-disc nums-tabular">
23+
<%= topic_article title: "Testing", link: "/testing" do %>
24+
<ul class="list-none">
2525
<li>Isolated unit tests
2626
<li>Integration tests
2727
<li>Acceptance tests
28-
<li><%= link 'Accessibility-first tests', to: Routes.accessibility_first_path(@conn, :index) %>
28+
<li>Accessibility-first tests
2929
</ul>
3030
<% end %>
3131

32-
<%= topic_article title: "Accessibility" do %>
33-
<ul class="list-disc nums-tabular">
32+
<%= topic_article title: "Accessibility-First", link: Routes.accessibility_first_path(@conn, :index) do %>
33+
<ul class="list-none">
3434
<li>In the browser
3535
<li>On iOS & Mac
3636
<li>HTML semantics
3737
</ul>
3838
<% end %>
39-
40-
<%= topic_article title: "Performance" do %>
41-
<ul class="list-disc nums-tabular">
39+
40+
<%= topic_article title: "Performance", link: "/performance" do %>
41+
<ul class="list-none">
4242
<li>Inform first by measuring data
4343
<li>Fast loading as a priority
4444
<li>Using assets and performance budgets
@@ -55,4 +55,4 @@
5555
<%= "Suggest Link" %>
5656
</button>
5757
</div>
58-
</section>
58+
</section>

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,11 @@ subhead = "Guides to accessibility, TDD, BDD, naming, performance, and the lates
8080
</h2>
8181
</header>
8282
<%= stack_list([
83-
%{ title: "Landmarks", description: "Ensure your web pages have these familiar regions.", to: "#", color: "indigo" },
84-
%{ title: "Widgets", description: "Buttons, links, tabs, comboboxes, and more.", to: "#", color: "orange" },
83+
%{ title: "Landmarks", description: "Ensure your web pages have these familiar regions.", to: "/accessibility-first/landmarks", color: "purple" },
84+
%{ title: "Labels and Descriptions", description: "Make sure every region of interest is labelled.", to: "/accessibility-first/properties-cheatsheet", color: "indigo" },
85+
%{ title: "Properties", description: "Selected state, current page, hidden, and more.", to: "/accessibility-first/properties-cheatsheet", color: "teal" },
86+
%{ title: "Form controls", description: "Inputs, checkboxes, radio buttons, comboboxes, and more.", to: "/accessibility-first/properties-cheatsheet", color: "red" },
87+
%{ title: "Widgets", description: "Buttons, links, tabs, comboboxes, and more.", to: "/accessibility-first/roles-cheatsheet", color: "orange" },
8588
%{ title: "Accessibility-First TDD", description: "Use accessibility affordances to write robust tests.", to: "/accessibility-first/roles-cheatsheet", color: "green" },
8689
%{ title: "Keyboard Navigation Acceptance Tests", description: "Ensure your forms are keyboard accessibility.", to: "/accessibility-first", color: "blue" },
8790
]) %>

apps/components_guide_web/lib/components_guide_web/templates/layout/app.html.eex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="utf-8"/>
55
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
66
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
7-
<title>Components.Guide — Web tutorials on React, Accessibility, Modern CSS, TypeScript</title>
7+
<title>Components.Guide — Guides to React, Accessibility, Modern CSS, TypeScript</title>
88
<link rel="stylesheet" href="<%= Routes.static_path(@conn, "/css/app.css") %>"/>
99
</head>
1010
<body>

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@
3636

3737
<h3 class="mt-6 mb-2 text-2xl leading-normal italic">Handy references</h3>
3838
<ul class="list-disc">
39-
<li><%= link "Thinking in SwiftUI by Chris Eidhof & Florian Kugler", to: "https://www.objc.io/books/thinking-in-swiftui/" %></li>
4039
<li><%= link "Gosh Darn SwiftUI: a curated list of questions and answers about SwiftUI", to: "https://goshdarnswiftui.com/" %></li>
40+
<li><%= link "When Should I Use @State, @Binding, @ObservedObject, @EnvironmentObject, or @Environment?", to: "https://jaredsinclair.com/2020/05/07/swiftui-cheat-sheet.html" %></li>
41+
<li><%= link "Thinking in SwiftUI by Chris Eidhof & Florian Kugler", to: "https://www.objc.io/books/thinking-in-swiftui/" %></li>
4142
<li><%= link "About SwiftUI: Gathering all info published, both by Apple and by others, about new framework SwiftUI", to: "https://github.com/Juanpe/About-SwiftUI" %></li>
4243
<li><%= link "SwiftUI by Example: free quick start tutorials for Swift developers", to: "https://www.hackingwithswift.com/quick-start/swiftui" %></li>
4344
<li><%= link "SwiftUI Hub", to: "https://swiftuihub.com/" %></li>
@@ -46,7 +47,7 @@
4647

4748
<%= article class: "text-red-700" do %>
4849
<h2 class="text-4xl leading-normal font-bold text-red-800 border-b-4 border-red-200">Combine</h2>
49-
50+
5051
<h3 class="mt-4 mb-2 text-2xl leading-normal italic">WWDC 2019</h3>
5152
<%= list [
5253
link(span("415: Modern Swift API Design", [:nums_tabular]), to: "https://developer.apple.com/videos/play/wwdc2019/415/"),
@@ -79,7 +80,7 @@
7980

8081
<%= article class: "text-blue-700" do %>
8182
<h2 class="text-4xl leading-normal font-bold text-blue-800 border-b-4 border-blue-200">React</h2>
82-
83+
8384
<h3 class="mt-4 mb-2 text-2xl leading-normal italic">Overreacted by Dan Abramov</h3>
8485
<ul class="list-disc">
8586
<li><%= link "The Elements of UI Engineering", to: "https://overreacted.io/the-elements-of-ui-engineering/" %></li>

apps/components_guide_web/lib/components_guide_web/views/concepts_view.ex

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@ defmodule ComponentsGuideWeb.ConceptsView do
1717

1818
def topic_article(assigns, block) do
1919
~E"""
20-
<article class="mb-8">
21-
<h2 class="mb-2 text-4xl leading-normal font-bold text-red-700"><%= @title %></h2>
22-
<%= block[:do] %>
23-
</article>
20+
<%= link to: @link do %>
21+
<article class="pl-8 py-4 mb-8 text-red-700 bg-red-100 border-l-4 border-current rounded hover:text-red-800 hover:bg-red-200 shadow-lg hover:shadow-xl">
22+
<h2 class="mb-2 text-4xl leading-normal font-bold">
23+
<%= @title %>
24+
</h2>
25+
<%= block[:do] %>
26+
</article>
27+
<%= end %>
2428
"""
2529
end
2630
end

0 commit comments

Comments
 (0)