Skip to content

Commit

Permalink
UI refresh (#38)
Browse files Browse the repository at this point in the history
* refactor: refresh wiki index page

* refactor: further wiki index page improvements

* fix: semantic markup of wiki article layout

* add: better a11y for header icons
  • Loading branch information
carsakiller authored Jul 15, 2024
1 parent f8d76ed commit 52f84bf
Show file tree
Hide file tree
Showing 6 changed files with 194 additions and 77 deletions.
7 changes: 4 additions & 3 deletions src/components/common/Icon.astro
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
const { group, name, class: className, color } = Astro.props;
const displayName = name.replaceAll("-", " ");
const styles = color ? `color: ${color}` : null;
const ariaLabel = Astro.props.ariaLabel ?? name.replaceAll("-", " ");
export interface Props {
/** The group that the icon belongs to. */
group: "brands" | "solid";
Expand All @@ -14,12 +14,13 @@ export interface Props {
class?: string;
/** The colour of the icon. */
color?: string;
ariaLabel?: string;
}
---

<i
class:list={[`fa-${group}`, `fa-${name}`, className]}
aria-label={displayName}
aria-label={ariaLabel}
style={styles}
>
</i>
6 changes: 3 additions & 3 deletions src/components/layout/Header.astro
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ const { class: className } = Astro.props;
<nav>
<a href="/" class="home">
<Tooltip content="Home">
<Icon name="house" group="solid" />
<Icon name="house" group="solid" ariaLabel="Home"/>
</Tooltip>
</a>
<div>
<a href="/wiki/">
<Tooltip content="Wiki">
<Icon name="book-open" group="solid" />
<Icon name="book-open" group="solid" ariaLabel="Wiki"/>
</Tooltip>
</a>
</div>
Expand All @@ -29,7 +29,7 @@ const { class: className } = Astro.props;
allowHTML
>
<button class="site-search-icon" aria-keyshortcuts="/">
<Icon name="search" group="solid" />
<Icon name="search" group="solid" ariaLabel="Search"/>
</button>
</Tooltip>
<span class="github">
Expand Down
1 change: 0 additions & 1 deletion src/content/wiki/faq.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
title: FAQ
description: Answers for frequently asked questions
getting-started: true
---

import Accordion from "~/components/common/Accordion.astro";
Expand Down
20 changes: 10 additions & 10 deletions src/layouts/WikiArticle.astro
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ export interface Props {

<Layout title="Wiki" transition={true} displayFooter={false}>
<div class="columns">
<div id="article-browser" class="sidebar">
<aside id="article-browser" class="sidebar">
<button class="open"><Icon name="newspaper" group="solid" /></button>
<button class="close"><Icon name="x" group="solid" /></button>
<div class="title">Articles</div>
<h2 class="title">Articles</h2>
<div class="content">
<nav>
{
Expand All @@ -52,7 +52,7 @@ export interface Props {
}
</nav>
</div>
</div>
</aside>
<div class="center">
<main>
<article>
Expand Down Expand Up @@ -90,10 +90,10 @@ export interface Props {
</main>
<Footer />
</div>
<div id="outline" class="sidebar">
<aside id="outline" class="sidebar">
<button class="open"><Icon name="list" group="solid" /></button>
<button class="close"><Icon name="x" group="solid" /></button>
<div class="title">Outline</div>
<h2 class="title">Outline</h2>
<nav class="content">
<ol>
<li><a href={`#${titleSlug}`}>{article.data.title}</a></li>
Expand All @@ -106,14 +106,14 @@ export interface Props {
}
</ol>
</nav>
</div>
</aside>
</div>
</Layout>

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

const sidebars = utils.assertElements(".sidebar");
const sidebars = utils.assertElements("aside.sidebar");

for (const sidebar of sidebars) {
const openButton = utils.assertElement("button.open", sidebar);
Expand Down Expand Up @@ -238,7 +238,7 @@ export interface Props {
}
}

.sidebar {
aside.sidebar {
--sidebar-width: 20em;
background-color: #081f34;
height: 100%;
Expand Down Expand Up @@ -474,7 +474,7 @@ export interface Props {
display: none;
}

.sidebar {
aside.sidebar {
position: static;
z-index: 0;
width: 100%;
Expand All @@ -491,7 +491,7 @@ export interface Props {
}

@media screen and (max-width: 800px) {
.sidebar {
aside.sidebar {
--sidebar-width: 70%;
}

Expand Down
Loading

0 comments on commit 52f84bf

Please sign in to comment.