Skip to content

Commit 52f84bf

Browse files
authored
UI refresh (#38)
* refactor: refresh wiki index page * refactor: further wiki index page improvements * fix: semantic markup of wiki article layout * add: better a11y for header icons
1 parent f8d76ed commit 52f84bf

File tree

6 files changed

+194
-77
lines changed

6 files changed

+194
-77
lines changed

src/components/common/Icon.astro

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
const { group, name, class: className, color } = Astro.props;
33
4-
const displayName = name.replaceAll("-", " ");
5-
64
const styles = color ? `color: ${color}` : null;
75
6+
const ariaLabel = Astro.props.ariaLabel ?? name.replaceAll("-", " ");
7+
88
export interface Props {
99
/** The group that the icon belongs to. */
1010
group: "brands" | "solid";
@@ -14,12 +14,13 @@ export interface Props {
1414
class?: string;
1515
/** The colour of the icon. */
1616
color?: string;
17+
ariaLabel?: string;
1718
}
1819
---
1920

2021
<i
2122
class:list={[`fa-${group}`, `fa-${name}`, className]}
22-
aria-label={displayName}
23+
aria-label={ariaLabel}
2324
style={styles}
2425
>
2526
</i>

src/components/layout/Header.astro

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ const { class: className } = Astro.props;
1414
<nav>
1515
<a href="/" class="home">
1616
<Tooltip content="Home">
17-
<Icon name="house" group="solid" />
17+
<Icon name="house" group="solid" ariaLabel="Home"/>
1818
</Tooltip>
1919
</a>
2020
<div>
2121
<a href="/wiki/">
2222
<Tooltip content="Wiki">
23-
<Icon name="book-open" group="solid" />
23+
<Icon name="book-open" group="solid" ariaLabel="Wiki"/>
2424
</Tooltip>
2525
</a>
2626
</div>
@@ -29,7 +29,7 @@ const { class: className } = Astro.props;
2929
allowHTML
3030
>
3131
<button class="site-search-icon" aria-keyshortcuts="/">
32-
<Icon name="search" group="solid" />
32+
<Icon name="search" group="solid" ariaLabel="Search"/>
3333
</button>
3434
</Tooltip>
3535
<span class="github">

src/content/wiki/faq.mdx

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
title: FAQ
33
description: Answers for frequently asked questions
4-
getting-started: true
54
---
65

76
import Accordion from "~/components/common/Accordion.astro";

src/layouts/WikiArticle.astro

+10-10
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ export interface Props {
3131

3232
<Layout title="Wiki" transition={true} displayFooter={false}>
3333
<div class="columns">
34-
<div id="article-browser" class="sidebar">
34+
<aside id="article-browser" class="sidebar">
3535
<button class="open"><Icon name="newspaper" group="solid" /></button>
3636
<button class="close"><Icon name="x" group="solid" /></button>
37-
<div class="title">Articles</div>
37+
<h2 class="title">Articles</h2>
3838
<div class="content">
3939
<nav>
4040
{
@@ -52,7 +52,7 @@ export interface Props {
5252
}
5353
</nav>
5454
</div>
55-
</div>
55+
</aside>
5656
<div class="center">
5757
<main>
5858
<article>
@@ -90,10 +90,10 @@ export interface Props {
9090
</main>
9191
<Footer />
9292
</div>
93-
<div id="outline" class="sidebar">
93+
<aside id="outline" class="sidebar">
9494
<button class="open"><Icon name="list" group="solid" /></button>
9595
<button class="close"><Icon name="x" group="solid" /></button>
96-
<div class="title">Outline</div>
96+
<h2 class="title">Outline</h2>
9797
<nav class="content">
9898
<ol>
9999
<li><a href={`#${titleSlug}`}>{article.data.title}</a></li>
@@ -106,14 +106,14 @@ export interface Props {
106106
}
107107
</ol>
108108
</nav>
109-
</div>
109+
</aside>
110110
</div>
111111
</Layout>
112112

113113
<script>
114114
import * as utils from "~/util/DOM";
115115

116-
const sidebars = utils.assertElements(".sidebar");
116+
const sidebars = utils.assertElements("aside.sidebar");
117117

118118
for (const sidebar of sidebars) {
119119
const openButton = utils.assertElement("button.open", sidebar);
@@ -238,7 +238,7 @@ export interface Props {
238238
}
239239
}
240240

241-
.sidebar {
241+
aside.sidebar {
242242
--sidebar-width: 20em;
243243
background-color: #081f34;
244244
height: 100%;
@@ -474,7 +474,7 @@ export interface Props {
474474
display: none;
475475
}
476476

477-
.sidebar {
477+
aside.sidebar {
478478
position: static;
479479
z-index: 0;
480480
width: 100%;
@@ -491,7 +491,7 @@ export interface Props {
491491
}
492492

493493
@media screen and (max-width: 800px) {
494-
.sidebar {
494+
aside.sidebar {
495495
--sidebar-width: 70%;
496496
}
497497

0 commit comments

Comments
 (0)