Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improve accessibility #22

Merged
merged 4 commits into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion @content/components/navigation/footer.astro
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ const { className } = Astro.props
<footer class={cn(className)}>
<div class="flex flex-col items-center justify-between gap-4 py-10 md:h-24 md:flex-row md:py-0">
<div class="flex flex-col items-center gap-4 px-8 md:flex-row md:gap-2 md:px-0">
<a href="/" aria-label="Dinstack homepage"> <Logo size={36} /></a>
<a href="/">
<span class="sr-only">Home Page</span>
<Logo size={36} />
</a>

<p class="text-center text-sm leading-loose md:text-left balance-text">
Built by{' '}
Expand Down
1 change: 1 addition & 0 deletions @content/components/navigation/header.astro
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const { className } = Astro.props
<div class="flex items-center justify-between w-full">
<div class="flex items-center gap-6 md:gap-8 lg:gap-10">
<a href="/" class="hidden items-center space-x-2 md:flex">
<span class="sr-only">Home</span>
<Logo size={36} />
</a>

Expand Down
1 change: 1 addition & 0 deletions @content/components/navigation/nav-mobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export function NavMobile(props: {
<Sheet open={open} onOpenChange={setOpen}>
<SheetTrigger asChild>
<Button variant={'ghost'} size={'icon'}>
<span className="sr-only">Open Sidebar Menu</span>
<MenuIcon className="size-5" />
</Button>
</SheetTrigger>
Expand Down
1 change: 1 addition & 0 deletions @content/components/search-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export function SearchDialog() {
return (
<>
<Button type="button" variant={'ghost'} onClick={() => setOpen((v) => !v)} className="group">
<span className="sr-only">Search</span>
<SearchIcon className="size-5 text-muted-foreground group-hover:text-foreground" />
</Button>
<CommandDialog open={open} onOpenChange={setOpen} commandProps={{ shouldFilter: false }}>
Expand Down
11 changes: 6 additions & 5 deletions @content/layouts/base.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ScrollArea } from '@web/components/ui/scroll-area'
import { SEO } from 'astro-seo'
import { ViewTransitions } from 'astro:transitions'
import { getTwitterHandler } from '@content/lib/twitter'
import { env } from '@web/lib/env'
---

<!doctype html>
Expand Down Expand Up @@ -79,20 +80,20 @@ import { getTwitterHandler } from '@content/lib/twitter'

<slot name="seo">
<SEO
title={`Dinstack - content`}
description={'Dinstack website for SEO part'}
title={`${env.APP_NAME} Homepage`}
description={`${env.APP_NAME} website for SEO part`}
openGraph={{
basic: {
title: `Dinstack - content`,
title: `${env.APP_NAME} Homepage`,
type: 'website',
image: '/opengraph-image.jpg',
},
}}
twitter={{
creator: getTwitterHandler(),
card: 'summary_large_image',
title: `Dinstack - content`,
description: 'Dinstack website for SEO part',
title: `${env.APP_NAME} Homepage`,
description: `${env.APP_NAME} website for SEO part`,
}}
/>
</slot>
Expand Down
7 changes: 4 additions & 3 deletions @content/pages/blog/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Icon } from 'astro-icon/components'
import { buttonVariants } from '@web/components/ui/button'
import { format } from 'date-fns'
import { getTwitterHandler } from '@content/lib/twitter'
import { env } from '@web/lib/env'

export async function getStaticPaths() {
const posts = await getCollection('blog')
Expand All @@ -27,19 +28,19 @@ const { Content } = await post.render()
<BaseLayout>
<SEO
slot="seo"
title={`${post.data.title} | Dinstack`}
title={`${post.data.title} | ${env.APP_NAME}`}
description={post.data.description}
openGraph={{
basic: {
title: `${post.data.title} | Dinstack`,
title: `${post.data.title} | ${env.APP_NAME}`,
type: 'article',
image: post.data.coverImage,
},
}}
twitter={{
creator: getTwitterHandler(),
card: 'summary_large_image',
title: `${post.data.title} | Dinstack`,
title: `${post.data.title} | ${env.APP_NAME}`,
description: post.data.description,
}}
/>
Expand Down
11 changes: 6 additions & 5 deletions @content/pages/blog/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,28 @@ import { getPosts } from '@content/lib/blog'
import Header from '@content/components/navigation/header.astro'
import Footer from '@content/components/navigation/footer.astro'
import { getTwitterHandler } from '@content/lib/twitter'
import { env } from '@web/lib/env'

const posts = await getPosts()
---

<BaseLayout>
<SEO
slot="seo"
title={`Blog | Dinstack`}
description="Dinstack related posts"
title={`Blog | ${env.APP_NAME}`}
description=`${env.APP_NAME} related posts`
openGraph={{
basic: {
title: `Blog | Dinstack`,
title: `Blog | ${env.APP_NAME}`,
type: 'website',
image: '/opengraph-image.jpg',
},
}}
twitter={{
creator: getTwitterHandler(),
card: 'summary_large_image',
title: `Blog | Dinstack`,
description: 'Dinstack related posts',
title: `Blog | ${env.APP_NAME}`,
description: `${env.APP_NAME} related posts`,
}}
/>

Expand Down
7 changes: 4 additions & 3 deletions @content/pages/docs/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { ScrollArea } from '@web/components/ui/scroll-area'
import { TableOfContents } from '@content/components/content/toc'
import DocsPager from '@content/components/content/docs-pager.astro'
import { getTwitterHandler } from '@content/lib/twitter'
import { env } from '@web/lib/env'

export const getStaticPaths = (async () => {
const DEFAULT_DOC_SLUG = 'getting-started' satisfies CollectionEntry<'docs'>['slug']
Expand All @@ -35,19 +36,19 @@ const { Content } = await doc.render()
<BaseLayout>
<SEO
slot="seo"
title={`${doc.data.title} | Dinstack`}
title={`${doc.data.title} | ${env.APP_NAME}`}
description={doc.data.description}
openGraph={{
basic: {
title: `${doc.data.title} | Dinstack`,
title: `${doc.data.title} | ${env.APP_NAME}`,
type: 'website',
image: '/opengraph-image.jpg',
},
}}
twitter={{
creator: getTwitterHandler(),
card: 'summary_large_image',
title: `${doc.data.title} | Dinstack`,
title: `${doc.data.title} | ${env.APP_NAME}`,
description: doc.data.description,
}}
/>
Expand Down
4 changes: 2 additions & 2 deletions @content/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ import { Icon } from 'astro-icon/components'
</div>
<div class="mx-auto text-center md:max-w-[58rem]">
<p class="leading-normal text-muted-foreground sm:text-lg sm:leading-7 balance-text">
Dinstack also includes a blog and a full-featured documentation site built using Markdown
{env.APP_NAME} also includes a blog and a full-featured documentation site built using Markdown
and MDX from Astro.
</p>
</div>
Expand All @@ -327,7 +327,7 @@ import { Icon } from 'astro-icon/components'
Proudly Open Source
</h2>
<p class="max-w-[85%] leading-normal text-muted-foreground sm:text-lg sm:leading-7">
Dinstack is open source and powered by open source software. <br />{' '}
{env.APP_NAME} is open source and powered by open source software. <br />{' '}
The code is available on{' '}
<a
href={env.GITHUB_REPOSITORY_URL}
Expand Down
11 changes: 9 additions & 2 deletions @extension/layouts/auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,16 @@ export function AuthLayout() {
return (
<div className="fixed inset-0 flex items-center justify-center">
<div>
<div className="flex justify-center">
<button
type="button"
className="flex justify-center w-full"
onClick={() => {
chrome.tabs.create({ url: new URL(env.CONTENT_BASE_URL).toString() })
}}
>
<span className="sr-only">Go Home Page</span>
<Logo variant="icon" size={100} />
</div>
</button>
<div className="space-y-2 mt-4">
<h2 className="text-2xl font-bold">Welcome to Our App</h2>
<p className="text-muted-foreground text-center">Please login to continue</p>
Expand Down
13 changes: 11 additions & 2 deletions @extension/layouts/with-navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Logo } from '@web/components/logo'
import { Button } from '@web/components/ui/button'
import { env } from '@web/lib/env'
import { useAuthStore } from '@web/stores/auth'
import { LogOutIcon, SettingsIcon } from 'lucide-react'
import { Link, Outlet } from 'react-router-dom'
Expand All @@ -9,13 +10,20 @@ export function WithNavbarLayout() {
<div>
<nav className="p-3 border-b">
<div className="flex justify-between items-center">
<div>
<button
type="button"
onClick={() => {
chrome.tabs.create({ url: new URL(env.CONTENT_BASE_URL).toString() })
}}
>
<span className="sr-only">Go Home Page</span>
<Logo variant="icon" size={32} />
</div>
</button>

<div className="flex items-center">
<Button variant={'ghost'} size={'icon'} className="h-8 w-8" asChild>
<Link to="/settings">
<span className="sr-only">Settings</span>
<SettingsIcon className="h-4 w-4" />
</Link>
</Button>
Expand All @@ -28,6 +36,7 @@ export function WithNavbarLayout() {
useAuthStore.setState({ state: null })
}}
>
<span className="sr-only">Logout</span>
<LogOutIcon className="h-4 w-4" />
</Button>
</div>
Expand Down
2 changes: 2 additions & 0 deletions @web/.env.local
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
PUBLIC_APP_NAME="Dinstack"

PUBLIC_API_TRPC_BASE_URL="http://localhost:8000/trpc/"
PUBLIC_CONTENT_BASE_URL="http://localhost:3000/"
PUBLIC_EXTENSION_ID="ppjhcbkohidnocgihipnjdnilinmecni"
Expand Down
2 changes: 2 additions & 0 deletions @web/.env.preview
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
PUBLIC_APP_NAME="Dinstack"

PUBLIC_API_TRPC_BASE_URL="https://dinstack-api-preview.dinsterizer.com/trpc/"
PUBLIC_CONTENT_BASE_URL="https://dinstack-preview.dinsterizer.com/"
PUBLIC_EXTENSION_ID="ppjhcbkohidnocgihipnjdnilinmecni"
Expand Down
2 changes: 2 additions & 0 deletions @web/.env.production
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
PUBLIC_APP_NAME="Dinstack"

PUBLIC_API_TRPC_BASE_URL="https://dinstack-api.dinsterizer.com/trpc/"
PUBLIC_CONTENT_BASE_URL="https://dinstack.dinsterizer.com/"
PUBLIC_EXTENSION_ID="ppjhcbkohidnocgihipnjdnilinmecni" # TODO: public extension and paste id here
Expand Down
1 change: 1 addition & 0 deletions @web/components/navigation/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export function Navbar() {
<div className="flex flex-col h-full">
<LogoDropdownMenu>
<DropdownMenuTrigger>
<span className="sr-only">Open Main Menu</span>
<Logo size={36} />
</DropdownMenuTrigger>
</LogoDropdownMenu>
Expand Down
1 change: 1 addition & 0 deletions @web/layouts/auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export function AuthLayout() {
<div className="mx-auto w-full max-w-sm lg:w-96">
<div>
<a href={env.CONTENT_BASE_URL}>
<span className="sr-only">Home Page</span>
<Logo size={42} />
</a>
<h2 className="mt-8 text-2xl font-bold leading-9 tracking-tight text-foreground">
Expand Down
12 changes: 11 additions & 1 deletion @web/layouts/with-sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
'use client'

import { DropdownMenuTrigger } from '@radix-ui/react-dropdown-menu'
import { Logo } from '@web/components/logo'
import { LogoDropdownMenu } from '@web/components/navigation/logo-dropdown-menu'
import { Navbar } from '@web/components/navigation/sidebar'
import { Button } from '@web/components/ui/button'
import { ScrollArea } from '@web/components/ui/scroll-area'
Expand Down Expand Up @@ -38,6 +40,7 @@ function SmallScreenNavbar() {
<Sheet open={isMobileSidebarOpen} onOpenChange={setIsMobileSidebarOpen}>
<SheetTrigger asChild>
<Button type="button" variant={'outline'} size={'icon'}>
<span className="sr-only">Open Sidebar Menu</span>
<MenuIcon className="h-4 w-4" />
</Button>
</SheetTrigger>
Expand All @@ -47,7 +50,12 @@ function SmallScreenNavbar() {
</Sheet>

<div className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2">
<Logo variant="icon" size={36} />
<LogoDropdownMenu>
<DropdownMenuTrigger>
<span className="sr-only">Open Main Menu</span>
<Logo variant="icon" size={36} />
</DropdownMenuTrigger>
</LogoDropdownMenu>
</div>
<Skeleton className="h-9 w-9" />
</div>
Expand Down Expand Up @@ -77,6 +85,7 @@ function LargeScreenNavbar() {
className="h-5 w-5 bg-background"
onClick={() => useSystemStore.setState({ sidebarSize: 'icon' })}
>
<span className="sr-only">Collapse sidebar</span>
<ChevronLeft className="h-4 w-4" />
</Button>
))
Expand All @@ -88,6 +97,7 @@ function LargeScreenNavbar() {
className="h-5 w-5 bg-background"
onClick={() => useSystemStore.setState({ sidebarSize: 'default' })}
>
<span className="sr-only">Uncollapse sidebar</span>
<ChevronRight className="h-4 w-4" />
</Button>
))
Expand Down
4 changes: 4 additions & 0 deletions @web/lib/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { z } from 'zod'

export const env = z
.object({
APP_NAME: z.string(),

API_TRPC_BASE_URL: z.string().url(),
CONTENT_BASE_URL: z.string().url(),
EXTENSION_ID: z.string(),
Expand All @@ -19,6 +21,8 @@ export const env = z
LEMONSQUEEZY_LIFETIME_MEMBERSHIP_VARIANT_ID: z.coerce.number(),
})
.parse({
APP_NAME: import.meta.env.PUBLIC_APP_NAME,

API_TRPC_BASE_URL: import.meta.env.PUBLIC_API_TRPC_BASE_URL,
CONTENT_BASE_URL: import.meta.env.PUBLIC_CONTENT_BASE_URL,
WEB_BASE_URL: import.meta.env.PUBLIC_WEB_BASE_URL,
Expand Down
6 changes: 4 additions & 2 deletions @web/pages/organization-general.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,10 @@ export function Component() {
</div>

<div className="bg-destructive/10 p-6 rounded-md">
<h2 className="text-base font-semibold leading-7 text-destructive">Danger zone</h2>
<p className="mt-1 text-sm leading-6 text-destructive/80">
<h2 className="text-base font-semibold leading-7 text-destructive dark:text-foreground">
Danger zone
</h2>
<p className="mt-1 text-sm leading-6 text-destructive/80 dark:text-muted-foreground">
Be careful what you do here.
</p>

Expand Down
4 changes: 3 additions & 1 deletion @web/pages/organization-members.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ export function Component() {
<div className="flex flex-col items-start flex-1 overflow-hidden">
<div className="flex items-start gap-1.5">
<span className="truncate w-full font-medium">{member.user.name}</span>
<Badge variant={'secondary'}>{uppercaseFirstLetter(member.role)}</Badge>
<Badge variant={'secondary'} className="min-w-max">
{uppercaseFirstLetter(member.role)}
</Badge>
</div>
<span className="text-muted-foreground font-normal text-xs">
{member.user.email}
Expand Down
6 changes: 4 additions & 2 deletions @web/pages/profile-general.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ export function Component() {
</div>

<div className="bg-destructive/10 p-6 rounded-md">
<h2 className="text-base font-semibold leading-7 text-destructive">Danger zone</h2>
<p className="mt-1 text-sm leading-6 text-destructive/80">
<h2 className="text-base font-semibold leading-7 text-destructive dark:text-foreground">
Danger zone
</h2>
<p className="mt-1 text-sm leading-6 text-destructive/80 dark:text-muted-foreground">
Be careful what you do here.
</p>

Expand Down