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 fe27b18
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 48 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
7 changes: 5 additions & 2 deletions src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@ function Header() {
className={twMerge(
"mb-auto",
"text-sm",
isCompliant && ["bg-gradient-to-b", "from-blueZodiac", "to-background"],
isCompliant && [
"bg-gradient-to-b",
"from-blueZodiac",
"to-backgroundCompliant",
],
"lg:min-h-screen",
"flex",
"flex-col",
)}
>
<Container className="grow flex flex-col">
<Navigation />

<div className="pt-12 my-auto">
<div className="uppercase text-4xl lg:text-7xl/normal">
{isCompliant && (
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
69 changes: 39 additions & 30 deletions src/components/NewsTeaser.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { NewsItem } from "@/assets/content";
import { ArrowRight } from "@/assets/icons";
import { useAppState } from "@/providers";
import { twMerge } from "tailwind-merge";
import { Typography } from ".";

type NewsTeaserProps = Omit<NewsItem, "key">;
Expand All @@ -9,40 +10,41 @@ 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"
/>
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>

<img
src={image}
alt={altText}
className="w-full aspect-video object-cover object-center order-1"
/>
<p>{summary}</p>

<div
className={twMerge([
"absolute",
"bottom-0",
"right-0",
"aspect-square",
isCompliant ? "bg-backgroundCompliant" : "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 All @@ -59,7 +61,14 @@ function NewsTeaser({ image, title, summary, href, altText }: NewsTeaserProps) {
href={href}
target="_blank"
rel="noreferrer"
className="absolute bottom-0 right-0 aspect-square bg-background text-white p-2"
className={twMerge(
"absolute",
"bottom-0",
"right-0",
"aspect-square",
isCompliant ? "bg-backgroundCompliant" : "bg-background",
"text-white p-2",
)}
>
<ArrowRight aria-hidden />
</a>
Expand Down
11 changes: 8 additions & 3 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,14 +35,15 @@ function Switch({ label, value, onChange, className, ...props }: SwitchProps) {
"h-6",
"bg-white/40",
"rounded-full",
"text-black",

// Checked indicator
"after:content-['']",
"after:absolute",
"after:top-[2px]",
"after:start-[2px]",
"after:bg-white",
"after:border-gray-300",
"after:border-white",
"after:border",
"after:rounded-full",
"after:h-5",
Expand All @@ -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
12 changes: 11 additions & 1 deletion src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,23 @@
}

body.compliant {
@apply font-noto;
@apply font-noto bg-backgroundCompliant;
}

body.compliant p {
@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
8 changes: 5 additions & 3 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ 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",
outlineColor: "#ec7100",
background: "#007da3",
backgroundCompliant: "#094f64",
},

fontFamily: {
Expand Down

0 comments on commit fe27b18

Please sign in to comment.