diff --git a/src/front/Components/DesignSystem/CircleProgress/classes.module.scss b/src/front/Components/DesignSystem/CircleProgress/classes.module.scss new file mode 100644 index 00000000..44d35be5 --- /dev/null +++ b/src/front/Components/DesignSystem/CircleProgress/classes.module.scss @@ -0,0 +1,24 @@ +@import "@Themes/constants.scss"; + +.root { + display: flex; + align-items: center; + gap: 24px; + + svg { + width: 100%; + height: 100%; + transform: rotate(-90deg); + + .circleBackground { + fill: none; + stroke: var(--background-elevation-2); + } + + .circleProgress { + fill: none; + stroke: var(--color-secondary-500); + transition: stroke-dashoffset 0.35s; + } + } +} diff --git a/src/front/Components/DesignSystem/CircleProgress/index.tsx b/src/front/Components/DesignSystem/CircleProgress/index.tsx new file mode 100644 index 00000000..d468e4d2 --- /dev/null +++ b/src/front/Components/DesignSystem/CircleProgress/index.tsx @@ -0,0 +1,61 @@ +import React, { useCallback, useEffect, useRef, useState } from "react"; + +import Typography, { ETypo, ETypoColor } from "../Typography"; +import classes from "./classes.module.scss"; + +type IProps = { + percentage: number; +}; +export default function CircleProgress(props: IProps) { + const { percentage } = props; + + const [animatedProgress, setAnimatedProgress] = useState(0); + const requestRef = useRef(); + + const animate = useCallback(() => { + setAnimatedProgress((prev) => { + if (prev < percentage) { + return prev + 1; + } else { + if (requestRef.current) { + cancelAnimationFrame(requestRef.current); + } + return prev; + } + }); + requestRef.current = requestAnimationFrame(animate); + }, [percentage]); + + useEffect(() => { + requestRef.current = requestAnimationFrame(animate); + return () => { + if (requestRef.current) { + cancelAnimationFrame(requestRef.current); + } + }; + }, [animate, percentage]); + + const radius = 11; + const circumference = 2 * Math.PI * radius; + const offset = circumference - (animatedProgress / 100) * circumference; + + return ( +
+ + + + + + {percentage}% + +
+ ); +} diff --git a/src/front/Components/Layouts/Folder/classes.module.scss b/src/front/Components/Layouts/Folder/classes.module.scss index b09e316f..0d8fab61 100644 --- a/src/front/Components/Layouts/Folder/classes.module.scss +++ b/src/front/Components/Layouts/Folder/classes.module.scss @@ -72,6 +72,17 @@ margin-bottom: 24px; } } + + .components { + display: flex; + flex-direction: column; + gap: 24px; + + .rows { + display: flex; + gap: 16px; + } + } } .buttons { diff --git a/src/front/Components/Layouts/Folder/index.tsx b/src/front/Components/Layouts/Folder/index.tsx index 4d24f00f..092ab68e 100644 --- a/src/front/Components/Layouts/Folder/index.tsx +++ b/src/front/Components/Layouts/Folder/index.tsx @@ -7,6 +7,7 @@ import classes from "./classes.module.scss"; import Newletter from "@Front/Components/DesignSystem/Newsletter"; import Button, { EButtonStyleType, EButtonVariant } from "@Front/Components/DesignSystem/Button"; import Tag, { ETagColor, ETagVariant } from "@Front/Components/DesignSystem/Tag"; +import CircleProgress from "@Front/Components/DesignSystem/CircleProgress"; type IProps = {}; type IState = { @@ -28,6 +29,31 @@ export default class Folder extends BasePage { return (
+
+ Circle Progress +
+ + + + +
+ Tags +
+ + + + +
+ + Table Tags +
+ + + + +
+
+
Informations du dossier
@@ -97,21 +123,8 @@ export default class Folder extends BasePage { INFO
- -
- - - - -
-
- - - - -
- +