-
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.
- Loading branch information
Showing
10 changed files
with
745 additions
and
510 deletions.
There are no files selected for viewing
634 changes: 572 additions & 62 deletions
634
front/src/app/components/admin/conventions/ConventionValidationDetails.tsx
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
34 changes: 0 additions & 34 deletions
34
libs/react-design-system/src/immersionFacile/components/bordered-section/BorderedSection.tsx
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
libs/react-design-system/src/immersionFacile/components/bordered-section/index.ts
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
...ct-design-system/src/immersionFacile/components/convention-summary/ConventionSummary.scss
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,18 @@ | ||
@import "../../../config/responsive"; | ||
|
||
.im-convention-summary { | ||
&__section { | ||
border: 1px solid var(--grey-900-175); | ||
border-radius: 8px; | ||
} | ||
|
||
&__subsection { | ||
&--highlight { | ||
background-color: var(--background-alt-blue-france), | ||
} | ||
} | ||
|
||
&__subsection__value { | ||
font-weight: 700; | ||
} | ||
} |
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
7 changes: 7 additions & 0 deletions
7
...sign-system/src/immersionFacile/components/convention-summary/ConventionSummary.styles.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,7 @@ | ||
import "./ConventionSummary.scss"; | ||
|
||
export default { | ||
section: "im-convention-summary__section", | ||
subsectionHighlight: "im-convention-summary__subsection--highlight", | ||
subsectionValue: "im-convention-summary__subsection__value", | ||
}; |
132 changes: 132 additions & 0 deletions
132
...act-design-system/src/immersionFacile/components/convention-summary/ConventionSummary.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,132 @@ | ||
import { fr } from "@codegouvfr/react-dsfr"; | ||
import { Badge } from "@codegouvfr/react-dsfr/Badge"; | ||
import React, { ReactNode } from "react"; | ||
import { useStyles } from "tss-react/dsfr"; | ||
import Styles from "./ConventionSummary.styles"; | ||
|
||
export type ConventionSummaryProperties = { | ||
conventionId?: string; | ||
submittedAt: string; | ||
summary: ConventionSummarySection[]; | ||
}; | ||
|
||
export type ConventionSummarySection = { | ||
title: string; | ||
subSections: ConventionSummarySubSection[]; | ||
}; | ||
|
||
export type ConventionSummarySubSection = { | ||
title?: string; | ||
fields: ConventionSummaryField[]; | ||
isFullWidthDisplay?: boolean; | ||
hasBackgroundColor?: boolean; | ||
isSchedule?: boolean; | ||
}; | ||
|
||
export type ConventionSummaryField = { id: string } & ( | ||
| { | ||
label: string; | ||
value: string | ReactNode; | ||
copyButton?: string | ReactNode; | ||
hasBackgroundColor?: boolean; | ||
} | ||
| { | ||
value: string | ReactNode; | ||
badgeSeverity: "success" | "warning"; | ||
} | ||
); | ||
|
||
// Inspired by https://github.com/MinooTavakoli/crisp-react | ||
export const ConventionSummary = ({ | ||
conventionId, | ||
submittedAt, | ||
summary, | ||
}: ConventionSummaryProperties) => { | ||
const { cx } = useStyles(); | ||
|
||
return ( | ||
<> | ||
<section className={cx(fr.cx("fr-mb-3w", "fr-p-2w"), Styles.section)}> | ||
<div> | ||
<h2>Convention</h2> | ||
<div>Date de soumission : {submittedAt}</div> | ||
<div> | ||
<span>ID : </span> | ||
{conventionId} | ||
</div> | ||
</div> | ||
</section> | ||
{summary.map((section) => { | ||
return ( | ||
<section | ||
className={cx(fr.cx("fr-mb-3w", "fr-p-2w"), Styles.section)} | ||
key={section.title} | ||
> | ||
<h2 className={fr.cx("fr-mt-3v", "fr-mb-0")}>{section.title}</h2> | ||
<div className={fr.cx("fr-grid-row")}> | ||
{section.subSections.map((subSection) => { | ||
return ( | ||
<section | ||
key={subSection.title} | ||
className={cx( | ||
fr.cx( | ||
"fr-col-12", | ||
!subSection.isFullWidthDisplay && "fr-col-md-6", | ||
subSection.hasBackgroundColor && "fr-p-2w", | ||
subSection.hasBackgroundColor && "fr-mt-2w", | ||
), | ||
subSection.hasBackgroundColor && | ||
Styles.subsectionHighlight, | ||
)} | ||
> | ||
<h3>{subSection.title}</h3> | ||
<div className={fr.cx("fr-grid-row")}> | ||
{subSection.fields.map((field) => { | ||
if ("badgeSeverity" in field) { | ||
return ( | ||
<div | ||
key={field.id} | ||
className={fr.cx("fr-col-12", "fr-mb-2w")} | ||
> | ||
<Badge severity={field.badgeSeverity}> | ||
{field.badgeSeverity === "success" | ||
? `Signée - Le ${field.value}` | ||
: "Signature en attente"} | ||
</Badge> | ||
</div> | ||
); | ||
} | ||
return ( | ||
<div | ||
className={fr.cx( | ||
"fr-col-12", | ||
"fr-col-sm-6", | ||
"fr-mb-2w", | ||
)} | ||
key={field.id} | ||
> | ||
{"label" in field && ( | ||
<div className={fr.cx("fr-text--xs", "fr-m-0")}> | ||
<div className={fr.cx("fr-text--xs", "fr-m-0")}> | ||
{field.label} | ||
</div> | ||
<div className={cx(Styles.subsectionValue)}> | ||
{field.value} | ||
{field.copyButton} | ||
</div> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
})} | ||
</div> | ||
</section> | ||
); | ||
})} | ||
</div> | ||
</section> | ||
); | ||
})} | ||
</> | ||
); | ||
}; |
1 change: 1 addition & 0 deletions
1
libs/react-design-system/src/immersionFacile/components/convention-summary/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 "./ConventionSummary"; |
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