Skip to content

Commit

Permalink
Fix WAVE warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
hstandaert committed Apr 23, 2024
1 parent 66eb122 commit 082df34
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 45 deletions.
11 changes: 8 additions & 3 deletions src/components/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
import { useAppState } from "@/providers";
import type { ButtonHTMLAttributes, PropsWithChildren } from "react";
import { twMerge } from "tailwind-merge";

export type ButtonProps = PropsWithChildren &
ButtonHTMLAttributes<HTMLButtonElement>;

function Button({ type = "button", className, ...props }: ButtonProps) {
const { isCompliant } = useAppState();

return (
<button
className={twMerge(
"bg-blueZodiac",
"hover:bg-blueZodiac/60",
isCompliant
? ["bg-orange"]
: ["bg-blueZodiac", "hover:bg-blueZodiac/60"],
isCompliant && "font-bold",
"transition-colors",
"duration-200",
"text-white",
isCompliant ? "text-blueZodiac" : "text-white",
"py-2",
"px-4",
"rounded",
Expand Down
8 changes: 2 additions & 6 deletions src/components/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,14 @@ function Navigation() {
return (
<div className="w-full sm:flex sm:items-center sm:justify-between my-4 sm:my-6 lg:my-8">
<div className="flex items-center justify-between">
<a
className="flex-none text-xl font-semibold"
title={isCompliant ? "Icapps" : ""}
href="#!"
>
<a className="flex-none text-xl font-semibold" href="#!">
{isCompliant ? (
<>
<span className="sr-only">Icapps</span>
<IcappsLogo aria-hidden />
</>
) : (
<IcappsLogo title="" />
<IcappsLogo title="Icapps" />
)}
</a>
<div className="sm:hidden">
Expand Down
52 changes: 22 additions & 30 deletions src/components/NewsTeaser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,32 @@ function NewsTeaser({ image, title, summary, href, altText }: NewsTeaserProps) {
const { isCompliant } = useAppState();

return isCompliant ? (
<article className="relative mb-4 text-black flex flex-col pb-12 bg-white border-2">
<div className="p-4 order-2">
<Typography variant="h5" as={isCompliant ? "h3" : "h5"}>
{title}
</Typography>

<p>{summary}</p>

<a
href={href}
target="_blank"
rel="noreferrer"
className="absolute bottom-0 right-0 aspect-square bg-background text-white p-2"
>
<span className="sr-only">Read more about "{title}"</span>
<ArrowRight aria-hidden />
</a>
</div>

{/* biome-ignore lint/a11y/useAnchorContent: <explanation> */}
<article className="flex">
<a
href={href}
aria-hidden
tabIndex={-1}
target="_blank"
rel="noreferrer"
className="absolute inset-0"
/>

<img
src={image}
alt={altText}
className="w-full aspect-video object-cover object-center order-1"
/>
className="relative mb-4 text-black flex flex-col pb-12 bg-white border-2"
>
<div className="p-4 order-2">
<Typography variant="h5" as={isCompliant ? "h3" : "h5"}>
{title}
</Typography>

<p>{summary}</p>

<div className="absolute bottom-0 right-0 aspect-square bg-background text-white p-2">
<span className="sr-only">Read more about "{title}"</span>
<ArrowRight aria-hidden />
</div>
</div>

<img
src={image}
alt={altText}
className="w-full aspect-video object-cover object-center order-1"
/>
</a>
</article>
) : (
<div className="relative mb-4 text-black flex flex-col pb-12 bg-white border-2">
Expand Down
9 changes: 7 additions & 2 deletions src/components/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function Switch({ label, value, onChange, className, ...props }: SwitchProps) {
type="button"
role="switch"
aria-checked={value ? "true" : "false"}
aria-labelledby={`${id}-label`}
onClick={handleChange}
id={id}
className={twMerge([
Expand All @@ -34,6 +35,7 @@ function Switch({ label, value, onChange, className, ...props }: SwitchProps) {
"h-6",
"bg-white/40",
"rounded-full",
"text-black",

// Checked indicator
"after:content-['']",
Expand Down Expand Up @@ -64,9 +66,12 @@ function Switch({ label, value, onChange, className, ...props }: SwitchProps) {
<span className="sr-only">off</span>
<span className="sr-only">on</span>
</button>
<label htmlFor={id} className="ms-3 text-sm font-medium cursor-pointer">
<span
id={`${id}-label`}
className="ms-3 text-sm font-medium cursor-pointer"
>
{label}
</label>
</span>
</div>
);
}
Expand Down
10 changes: 10 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
@apply max-w-[60ch];
}

body:not(.compliant) p,
body:not(.compliant) h1,
body:not(.compliant) h2,
body:not(.compliant) h3,
body:not(.compliant) h4,
body:not(.compliant) h5,
body:not(.compliant) h6 {
@apply leading-none;
}

body.compliant button,
body.compliant a,
body.compliant input,
Expand Down
9 changes: 5 additions & 4 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ export default {
white: "#ffffff",
black: "#000000",
gray: "#cccccc",
blueZodiac: "#0a1930",
blueZodiac: "#0a1931",
green: "#00ff00",
brightTurquoise: "#00e5ff",
red: "#EF5350",
red: "#ef5350",
orange: "#ec7100",

// specific
outlineColor: "#93C700",
background: "#007da3",
outlineColor: "#ec7100",
background: "#094f64",
},

fontFamily: {
Expand Down

0 comments on commit 082df34

Please sign in to comment.