website refactor

This commit is contained in:
2026-01-19 18:01:30 +01:00
parent 6154d54435
commit 61b5cf3b64
120 changed files with 2226 additions and 2021 deletions

View File

@@ -1,35 +1,28 @@
import React, { useState } from 'react';
import React from 'react';
import { Box, BoxProps } from './Box';
import { ImagePlaceholder } from './ImagePlaceholder';
export interface ImageProps extends Omit<BoxProps<'img'>, 'children'> {
src: string;
alt: string;
fallbackSrc?: string;
fallbackComponent?: React.ReactNode;
}
/**
* Image
*
* Stateless UI primitive for images.
* For error handling, use SafeImage component.
*/
export const Image = ({
src,
alt,
fallbackSrc,
fallbackComponent,
...props
}: ImageProps) => {
const [error, setError] = useState(false);
if (error) {
if (fallbackComponent) return <>{fallbackComponent}</>;
if (fallbackSrc) return <Box as="img" src={fallbackSrc} alt={alt} {...props} />;
return <ImagePlaceholder />;
}
return (
<Box
as="img"
src={src}
alt={alt}
onError={() => setError(true)}
{...props}
/>
);