-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip create component BorderedSection
- Loading branch information
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
...design-system/src/immersionFacile/components/bordered-section/BorderedSection.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,35 @@ | ||
import type { ArgTypes, Meta, StoryObj } from "@storybook/react"; | ||
import React from "react"; | ||
import { BorderedSection, BorderedSectionProperties } from "./BorderedSection"; | ||
|
||
const Component = BorderedSection; | ||
type Story = StoryObj<typeof Component>; | ||
const argTypes: Partial<ArgTypes<BorderedSectionProperties>> | undefined = {}; | ||
|
||
const componentDescription = ` | ||
Affiche un élément section ayant une bordure et contenant un titre. | ||
\`\`\`tsx | ||
import { BorderedSection } from "react-design-system"; | ||
\`\`\` | ||
`; | ||
|
||
export default { | ||
title: "BorderedSection", | ||
component: Component, | ||
argTypes, | ||
parameters: { | ||
docs: { | ||
description: { | ||
component: componentDescription, | ||
}, | ||
}, | ||
}, | ||
} as Meta<typeof Component>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
title: "Titre de la section", | ||
children: <></>, | ||
}, | ||
}; |
34 changes: 34 additions & 0 deletions
34
libs/react-design-system/src/immersionFacile/components/bordered-section/BorderedSection.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,34 @@ | ||
import { fr } from "@codegouvfr/react-dsfr"; | ||
import React, { ReactNode } from "react"; | ||
|
||
export type BorderedSectionProperties = { | ||
title: string; | ||
children: ReactNode; | ||
}; | ||
|
||
// Inspired by https://github.com/MinooTavakoli/crisp-react | ||
export const BorderedSection = ({ | ||
title, | ||
children, | ||
}: BorderedSectionProperties) => { | ||
return ( | ||
<section | ||
className={fr.cx("fr-mb-2w", "fr-p-2w")} | ||
style={{ | ||
border: "1px solid var(--grey-900-175)", | ||
borderRadius: "5px", | ||
}} | ||
> | ||
<h2 | ||
className={fr.cx("fr-mb-2w", "fr-pb-1w")} | ||
style={{ | ||
color: "var(--text-title-blue-france)", | ||
borderBottom: "1px solid var(--grey-900-175)", | ||
}} | ||
> | ||
{title} | ||
</h2> | ||
{children} | ||
</section> | ||
); | ||
}; |
1 change: 1 addition & 0 deletions
1
libs/react-design-system/src/immersionFacile/components/bordered-section/index.ts
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 @@ | ||
export * from "./BorderedSection"; |