-
-
Notifications
You must be signed in to change notification settings - Fork 267
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
Showing
15 changed files
with
170 additions
and
135 deletions.
There are no files selected for viewing
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
55 changes: 36 additions & 19 deletions
55
components/Container/Container.js → components/Container/Container.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
This file was deleted.
Oops, something went wrong.
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,19 @@ | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
import { descriptions } from 'common/constants/descriptions'; | ||
import Container from '../Container'; | ||
|
||
type ContainerStoryType = StoryObj<typeof Container>; | ||
|
||
const meta: Meta<typeof Container> = { | ||
title: 'Container', | ||
component: Container, | ||
args: { | ||
children: descriptions.long, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
export const Default: ContainerStoryType = { | ||
render: args => <Container {...args} />, | ||
}; |
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
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,70 @@ | ||
import { cloneElement, ReactElement } from 'react'; | ||
import Container from 'components/Container/Container'; | ||
import Heading from 'components/Heading/Heading'; | ||
|
||
export type ContentPropsType = { | ||
/** | ||
* Elements to be rendered in the container. | ||
*/ | ||
columns: React.ReactNode[]; | ||
/** | ||
* Sets the path for an optional background image. | ||
*/ | ||
backgroundImageSource?: string; | ||
/** | ||
* Applies style classes to the wrapping div. | ||
*/ | ||
className?: string; | ||
/** | ||
* Displays an optional line under the title. | ||
*/ | ||
hasTitleUnderline?: boolean; | ||
/** | ||
* Applies an id to the container. | ||
*/ | ||
id?: string; | ||
/** | ||
* Sets the height of the container to be full viewport height. | ||
* @default false | ||
*/ | ||
isFullViewportHeight?: boolean; | ||
/** | ||
* Applies the color theme. | ||
* @default secondary | ||
*/ | ||
theme?: 'gray' | 'secondary' | 'white'; | ||
/** | ||
* Applies an additional title element. | ||
*/ | ||
title?: string; | ||
}; | ||
|
||
function Content({ | ||
className, | ||
columns, | ||
hasTitleUnderline = false, | ||
id, | ||
isFullViewportHeight = false, | ||
theme = 'secondary', | ||
title, | ||
backgroundImageSource, | ||
}: ContentPropsType) { | ||
return ( | ||
<Container | ||
backgroundImageSource={backgroundImageSource} | ||
className={className} | ||
id={id} | ||
isFullViewportHeight={isFullViewportHeight} | ||
theme={theme} | ||
> | ||
{title && <Heading text={title} hasTitleUnderline={hasTitleUnderline} headingLevel={3} />} | ||
|
||
<div className="flex justify-center items-center flex-wrap w-full [&>*]:m-4"> | ||
{/* eslint-disable-next-line react/no-array-index-key */} | ||
{columns.map((column, index) => cloneElement(column as ReactElement<any>, { key: index }))} | ||
</div> | ||
</Container> | ||
); | ||
} | ||
|
||
export default Content; |
This file was deleted.
Oops, something went wrong.
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,45 @@ | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
import Content from '../Content'; | ||
|
||
type ContentStoryType = StoryObj<typeof Content>; | ||
|
||
const multiColumnArray = [ | ||
<div> | ||
<p>Column 1</p> | ||
</div>, | ||
<div> | ||
<p>Column 2</p> | ||
</div>, | ||
<div> | ||
<p>Column 3</p> | ||
</div>, | ||
]; | ||
|
||
const meta: Meta<typeof Content> = { | ||
title: 'Content', | ||
component: Content, | ||
args: { | ||
columns: multiColumnArray.slice(0, 1), | ||
title: 'One column content', | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
/** | ||
* Default Content supplied with only one column | ||
*/ | ||
export const Default: ContentStoryType = { | ||
render: args => <Content {...args} />, | ||
}; | ||
|
||
/** | ||
* Content supplied with multiple columns | ||
*/ | ||
export const MultipleColumns: ContentStoryType = { | ||
...Default, | ||
args: { | ||
columns: multiColumnArray, | ||
title: 'Multiple column content', | ||
}, | ||
}; |
File renamed without changes.
File renamed without changes.
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