fix: alignment and a11y issues for icons

This commit is contained in:
Stefan Imhoff
2024-03-14 17:25:07 +01:00
parent 6985dcce51
commit 6920007cbc
5 changed files with 9 additions and 11 deletions

View File

@@ -19,9 +19,8 @@ export const Backlink: FunctionalComponent<Props> = ({ backLink, class: classNam
return ( return (
<> <>
{backLink && ( {backLink && (
<Link class={classes} href={backLink} {...props}> <Link aria-label="Back to overview" class={classes} href={backLink} {...props}>
<button <button
aria-label="Back to overview"
class="flex h-clickarea w-clickarea cursor-pointer items-center justify-center border-none text-[0]" class="flex h-clickarea w-clickarea cursor-pointer items-center justify-center border-none text-[0]"
type="button" type="button"
tabIndex={-1} tabIndex={-1}

View File

@@ -11,7 +11,7 @@ interface Props extends JSX.HTMLAttributes<HTMLAnchorElement> {
export const DownloadLink: FunctionalComponent<Props> = ({ href, text, ...props }) => ( export const DownloadLink: FunctionalComponent<Props> = ({ href, text, ...props }) => (
<TextLink class="group" href={href} {...props}> <TextLink class="group" href={href} {...props}>
{text} {text}
<span class="more-icon relative inline-flex mis-[0.2em] block-start-[0.2em]"> <span class="more-icon relative inline-flex mis-[0.2em] block-start-[0.4em]">
<Download <Download
aria-hidden="true" aria-hidden="true"
class="icon h-icon w-icon transition-transform duration-500 ease-in-out group-hover:translate-y-1 group-focus:translate-y-1" class="icon h-icon w-icon transition-transform duration-500 ease-in-out group-hover:translate-y-1 group-focus:translate-y-1"

View File

@@ -11,7 +11,7 @@ interface Props extends JSX.HTMLAttributes<HTMLAnchorElement> {
export const MoreLink: FunctionalComponent<Props> = ({ href, text, ...props }) => ( export const MoreLink: FunctionalComponent<Props> = ({ href, text, ...props }) => (
<TextLink class="group" href={href} {...props}> <TextLink class="group" href={href} {...props}>
{text} {text}
<span class="more-icon relative inline-flex mis-[0.2em] block-start-[0.2em]"> <span class="more-icon relative inline-flex mis-[0.2em] block-start-[0.4em]">
<ArrowRight <ArrowRight
aria-hidden="true" aria-hidden="true"
class="icon h-icon w-icon transition-transform duration-500 ease-in-out group-hover:translate-x-1 group-focus:translate-x-1" class="icon h-icon w-icon transition-transform duration-500 ease-in-out group-hover:translate-x-1 group-focus:translate-x-1"

View File

@@ -5,12 +5,13 @@ import { Link } from '.';
--- ---
<Link <Link
class="col-span-2 col-start-1 h-clickarea w-clickarea scale-75 items-center justify-center self-center justify-self-center transition-transform duration-500 ease-in-out hover:scale-90 focus:scale-90 print:hidden md:col-span-1" aria-label="Search the website (/)"
class="col-span-2 col-start-1 h-clickarea w-clickarea scale-75 items-center justify-center self-center justify-self-center transition-transform duration-500 ease-in-out hover:scale-90 focus:scale-90 md:col-span-1 print:hidden"
href="#search"
id="search-link" id="search-link"
title="Search the website (/)" title="Search the website (/)"
> >
<button <button
aria-label="Search the website (/)"
class="flex h-clickarea w-clickarea cursor-pointer items-center justify-center border-none text-[0]" class="flex h-clickarea w-clickarea cursor-pointer items-center justify-center border-none text-[0]"
tabindex={-1} tabindex={-1}
type="button" type="button"

View File

@@ -6,14 +6,12 @@ import { ArrowUp } from './icons';
export const UpLink: FunctionalComponent = ({ ...props }) => ( export const UpLink: FunctionalComponent = ({ ...props }) => (
<div class="flex flex-1 justify-end" {...props}> <div class="flex flex-1 justify-end" {...props}>
<Link <Link
id="up-link" aria-label="Back to top"
class="transition-transform duration-500 ease-in-out hover:-translate-y-1 focus:-translate-y-1" class="transition-transform duration-500 ease-in-out hover:-translate-y-1 focus:-translate-y-1"
href="#top" href="#top"
id="up-link"
> >
<button <button class="flex h-clickarea w-clickarea cursor-pointer items-center justify-center">
aria-label="Back to top"
class="flex h-clickarea w-clickarea cursor-pointer items-center justify-center"
>
<ArrowUp class="icon h-icon w-icon" /> <ArrowUp class="icon h-icon w-icon" />
</button> </button>
</Link> </Link>