Skip to content

Commit

Permalink
try to addrress a couple accessibility audit issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jzweifel committed Oct 8, 2023
1 parent 30be5a2 commit 8b1e230
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 29 deletions.
38 changes: 38 additions & 0 deletions src/components/header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import Html from "@kitajs/html";
import { Session } from "lucia";

export function Header({ session }: { session: Session }) {
return (
<div class="w-full mt-1">
{session ? (
<>
<p class="text-gray-800 float-left" safe>
We've been waiting for you, {session.user.name}.
</p>
<a
href="/api/auth/signout"
class="float-right i-octicon-sign-out text-white transition duration-200 hover:bg-black"
>
Log Out
</a>
{session.user.roles.includes("ADMIN") ? (
<a
href="/admin/new-post"
class="float-right i-octicon-diff-added text-white transition duration-200 hover:bg-black"
>
New Post
</a>
) : null}
</>
) : (
<a
href="/api/auth/#/github"
hx-boost="false"
class="float-right i-octicon-sign-in text-white transition duration-200 hover:bg-black"
>
Log In
</a>
)}
</div>
);
}
2 changes: 2 additions & 0 deletions src/pages/(admin)/new-post.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Elysia from "elysia";
import { BaseHtml } from "../../components/base";
import { Header } from "../../components/header";
import { ctx } from "../../context";

export const newPost = new Elysia()
Expand All @@ -13,6 +14,7 @@ export const newPost = new Elysia()

return html(
<BaseHtml>
<Header session={session} />
<script>{`
tinymce.init({
selector: '#new-post'
Expand Down
31 changes: 2 additions & 29 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Elysia } from "elysia";
import { BaseHtml } from "../components/base";
import { Header } from "../components/header";
import { PostsList } from "../components/posts";
import { ctx } from "../context";

Expand All @@ -8,35 +9,7 @@ export const index = new Elysia()
.get("/", async ({ html, session }) => {
return html(
<BaseHtml>
<div class="w-full mt-1">
{session ? (
<>
<p class="text-gray-800 float-left" safe>
We've been waiting for you, {session.user.name}.
</p>
<a
href="/api/auth/signout"
class="float-right i-octicon-sign-out text-white transition duration-200 hover:bg-black"
>
Log Out
</a>
{session.user.roles.includes("ADMIN") ? (
<a
href="/admin/new-post"
class="float-right i-octicon-diff-added text-white transition duration-200 hover:bg-black"
>
New Post
</a>
) : null}
</>
) : (
<a
href="/api/auth/#/github"
hx-boost="false"
class="float-right i-octicon-sign-in text-white transition duration-200 hover:bg-black"
></a>
)}
</div>
<Header session={session} />
<PostsList />
</BaseHtml>,
);
Expand Down

0 comments on commit 8b1e230

Please # to comment.