From 221a1895ee2e7fe8be232021a43626d58bdedb94 Mon Sep 17 00:00:00 2001 From: Ruben Sibon Date: Fri, 1 Nov 2024 16:23:19 +0100 Subject: [PATCH] feat(image)!: alt prop is required --- packages/react/src/Image/Image.test.tsx | 10 +++++----- packages/react/src/Image/Image.tsx | 2 ++ storybook/src/docs/components/AppIcons.tsx | 16 ++++++++-------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/packages/react/src/Image/Image.test.tsx b/packages/react/src/Image/Image.test.tsx index dbb18575a1..47272ef775 100644 --- a/packages/react/src/Image/Image.test.tsx +++ b/packages/react/src/Image/Image.test.tsx @@ -5,7 +5,7 @@ import '@testing-library/jest-dom' describe('Image', () => { it('renders', () => { - const { container } = render() + const { container } = render({'Image'}) const component = container.querySelector(':only-child') @@ -14,7 +14,7 @@ describe('Image', () => { }) it('renders a design system BEM class name', () => { - const { container } = render() + const { container } = render({'Image'}) const component = container.querySelector(':only-child') @@ -22,7 +22,7 @@ describe('Image', () => { }) it('renders an additional class name', () => { - const { container } = render() + const { container } = render({'Image'}) const component = container.querySelector(':only-child') @@ -31,7 +31,7 @@ describe('Image', () => { }) it('renders a class name to display the image as large as its container', () => { - const { container } = render() + const { container } = render({'Image'}) const component = container.querySelector(':only-child') @@ -41,7 +41,7 @@ describe('Image', () => { it('supports ForwardRef in React', () => { const ref = createRef() - const { container } = render() + const { container } = render({'Image'}) const component = container.querySelector(':only-child') diff --git a/packages/react/src/Image/Image.tsx b/packages/react/src/Image/Image.tsx index 38a857e0dd..394064563a 100644 --- a/packages/react/src/Image/Image.tsx +++ b/packages/react/src/Image/Image.tsx @@ -8,6 +8,8 @@ import { forwardRef } from 'react' import type { ForwardedRef, ImgHTMLAttributes } from 'react' export type ImageProps = { + /** Descriptive text for the image. */ + alt: string /** Whether to display the image exactly as large as its container. This will clip the image if necessary. */ cover?: boolean } & ImgHTMLAttributes diff --git a/storybook/src/docs/components/AppIcons.tsx b/storybook/src/docs/components/AppIcons.tsx index b417b8e6d8..80eaf3ec2a 100644 --- a/storybook/src/docs/components/AppIcons.tsx +++ b/storybook/src/docs/components/AppIcons.tsx @@ -3,7 +3,7 @@ import { Image } from '@amsterdam/design-system-react' export const AppleTouchIcon = () => (
- + apple-touch-icon.png (180px)
apple-touch-icon.png (180px)
@@ -12,19 +12,19 @@ export const AppleTouchIcon = () => ( export const Favicon = () => (
- + favicon.ico (16px)
favicon.ico (16px)
- + favicon.ico (32px)
favicon.ico (32px)
- + favicon.ico (48px)
favicon.ico (48px)
- + favicon.ico (64px)
favicon.ico (64px)
@@ -33,7 +33,7 @@ export const Favicon = () => ( export const SvgIcon = () => (
- + icon.svg (64px)
icon.svg (64px)
@@ -42,11 +42,11 @@ export const SvgIcon = () => ( export const WebAppIcons = () => (
- + icon-192.png (192px)
icon-192.png (192px)
- + icon-512.png (512px)
icon-512.png (512px)