Skip to content

Commit

Permalink
Component/image (#534)
Browse files Browse the repository at this point in the history
closes #477

---------

Co-authored-by: Ruben Smit <[email protected]>
Co-authored-by: Mees <[email protected]>
Co-authored-by: Sjimmie <[email protected]>
  • Loading branch information
4 people authored Aug 15, 2024
1 parent 448b86a commit 70381ba
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/components-react/src/Image.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Image as UtrechtImage } from '@utrecht/component-library-react/dist/css-module';
import { ForwardedRef, forwardRef, ImgHTMLAttributes } from 'react';

export const Image = forwardRef(
({ className, ...restProps }: ImgHTMLAttributes<HTMLImageElement>, ref: ForwardedRef<HTMLImageElement>) => (
<UtrechtImage {...restProps} ref={ref} photo className={className} />
),
);

Image.displayName = 'Image';
1 change: 1 addition & 0 deletions packages/storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@rijkshuisstijl-community/rivm-design-tokens": "workspace:*",
"@rijkshuisstijl-community/web-components-stencil": "workspace:*",
"@rijkshuisstijl-community/web-components-react": "workspace:*",
"@rijkshuisstijl-community/components-react": "workspace:*",

Check failure on line 39 in packages/storybook/package.json

View workflow job for this annotation

GitHub Actions / lint

Duplicate object key
"@storybook/addon-a11y": "8.2.4",
"@storybook/addon-actions": "8.2.4",
"@storybook/addon-docs": "8.2.4",
Expand Down
3 changes: 3 additions & 0 deletions packages/storybook/src/community/image.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<!-- @license CC0-1.0 -->

# Rijkshuisstijl Community image component
61 changes: 61 additions & 0 deletions packages/storybook/src/community/image.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { Image } from '@rijkshuisstijl-community/components-react';
import type { Meta, StoryObj } from '@storybook/react';
import readme from './image.md?raw';

const meta = {
title: 'Rijkshuisstijl/Image',
id: 'rijkshuisstijl-image',
component: Image,
argTypes: {
src: {
description: 'Image source',
control: { type: 'text' },
table: {
category: 'Property',
},
},
alt: {
description: 'Image alt text',
control: { type: 'text' },
table: {
category: 'Property',
},
},
width: {
description: 'Image width',
control: { type: 'number' },
table: {
category: 'Property',
},
},
height: {
description: 'Image height',
control: { type: 'number' },
table: {
category: 'Property',
},
},
},
tags: ['autodocs'],
parameters: {
docs: {
description: {
component: readme,
},
},
},
} as Meta<typeof Image>;

export default meta;

type Story = StoryObj<typeof meta>;

export const Default: Story = {
args: {
alt: 'Multicolored tulip field',
height: 763,
width: 640,
src: './placeholder.jpg',
},
name: 'Image',
};
Binary file added proprietary/assets/src/placeholder.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 70381ba

Please sign in to comment.