-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
875e5c3
commit 4e9c904
Showing
7 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
...d/libs/studio-components/src/components/StudioSurfaceCard/StudioSurfaceCard.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import {Canvas, Meta} from '@storybook/blocks'; | ||
import {Heading, Paragraph} from '@digdir/design-system-react'; | ||
import * as StudioSurfaceCardStories from './StudioSurfaceCard.stories'; | ||
|
||
<Meta of={StudioSurfaceCardStories}/> | ||
|
||
<Heading level={1} size='small'> | ||
StudioSurfaceCard | ||
</Heading> | ||
<Paragraph> | ||
StudioSurfaceCard is used to composite components in a card-like container with a shadow. | ||
</Paragraph> | ||
|
||
<Canvas of={StudioSurfaceCardStories.Preview}/> |
9 changes: 9 additions & 0 deletions
9
...tend/libs/studio-components/src/components/StudioSurfaceCard/StudioSurfaceCard.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.card { | ||
padding: 0; | ||
} | ||
|
||
.header { | ||
font-size: var(--fds-sizing-2); | ||
color: red; | ||
padding: 0; | ||
} |
20 changes: 20 additions & 0 deletions
20
...end/libs/studio-components/src/components/StudioSurfaceCard/StudioSurfaceCard.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react'; | ||
import type { Meta, StoryFn } from '@storybook/react'; | ||
import { StudioSurfaceCard } from './StudioSurfaceCard'; | ||
|
||
type Story = StoryFn<typeof StudioSurfaceCard>; | ||
|
||
const meta: Meta = { | ||
title: 'Studio/StudioSurfaceCard', | ||
component: StudioSurfaceCard, | ||
argTypes: {}, | ||
}; | ||
export const Preview: Story = (args): React.ReactElement => ( | ||
<StudioSurfaceCard {...args}>{args.children}</StudioSurfaceCard> | ||
); | ||
|
||
Preview.args = { | ||
title: 'hello', | ||
children: <div>hello</div>, | ||
}; | ||
export default meta; |
21 changes: 21 additions & 0 deletions
21
frontend/libs/studio-components/src/components/StudioSurfaceCard/StudioSurfaceCard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React, { forwardRef } from 'react'; | ||
|
||
import classes from './StudioSurfaceCard.module.css'; | ||
|
||
type StudioSurfaceCardProps = { | ||
title: string; | ||
children: React.ReactNode; | ||
} & React.HTMLAttributes<HTMLDivElement>; | ||
export const StudioSurfaceCard = forwardRef<HTMLDivElement, StudioSurfaceCardProps>( | ||
( | ||
{ title, children, className: givenClassName }: StudioSurfaceCardProps, | ||
ref, | ||
): React.ReactElement => { | ||
return ( | ||
<div className={givenClassName}> | ||
<div className={classes.header}>{title}</div> | ||
<div>{children}</div> | ||
</div> | ||
); | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters