diff --git a/app/components/ItemPicker.tsx b/app/components/ItemPicker.tsx index a0949916ec..8e80dd2742 100644 --- a/app/components/ItemPicker.tsx +++ b/app/components/ItemPicker.tsx @@ -25,7 +25,7 @@ export const ItemPicker = ({ onClick={handleSelected} > -
+

{label}

) diff --git a/app/components/LoadingBar.tsx b/app/components/LoadingBar.tsx new file mode 100644 index 0000000000..90a112df5c --- /dev/null +++ b/app/components/LoadingBar.tsx @@ -0,0 +1,54 @@ +import { twMerge } from 'tailwind-merge'; +import { H4 } from '.'; + +interface LoadingBarProps{ + label?: string; + progress?: number; + variant?: string; + message?: string; + wrapperClassName?: string; + useFakeTimer?: number; +} +export const LoadingBar = ({ + label, + progress = 0, + variant = 'primary', + message, + wrapperClassName : propsWrapperClassName, + useFakeTimer = (1000 * 60) //defaults to 1min +}: LoadingBarProps) => { + + function getVariantClassNames(variant: string) { + switch (variant) { + case "secondary": { + return " bg-brand-secondary text-white "; + } + case "primary": + default: { + return " bg-brand-primary text-white "; + } + } + } + + const wrapperClassName = twMerge( + "w-full h-full flex flex-col justify-center items-center bg-ui-background p-4 gap-4", + propsWrapperClassName, + ) + const progressClassName = twMerge( + "h-2.5 rounded-full transition-all duration-1000", + getVariantClassNames(variant), + ); + + return ( +
+ {label && } +
+
+
+ {message &&

{message}

} +
+ ); +} \ No newline at end of file diff --git a/app/components/LoadingDots.tsx b/app/components/LoadingDots.tsx index a662dbeadf..3abfa49eb6 100644 --- a/app/components/LoadingDots.tsx +++ b/app/components/LoadingDots.tsx @@ -26,7 +26,7 @@ export const LoadingDotsTyping = (props: LoadingDotsProps)=>{ } export const LoadingDotsBricks = (props: LoadingDotsProps)=>{ return ( - + ) } diff --git a/app/components/index.tsx b/app/components/index.tsx index 10683e5c8b..5dabccba07 100644 --- a/app/components/index.tsx +++ b/app/components/index.tsx @@ -6,6 +6,7 @@ import { Input } from "./Input"; import { H4 } from "./H4"; import { ItemPicker } from "./ItemPicker"; import { Textarea } from "./Textarea"; +import { LoadingBar } from "./LoadingBar"; import { LoadingDots, LoadingDotsBricks, LoadingDotsTyping } from "./LoadingDots"; export { @@ -17,6 +18,7 @@ export { ItemPicker, Textarea, Input, + LoadingBar, LoadingDots, LoadingDotsBricks, LoadingDotsTyping, diff --git a/app/routes/ComponentLibrary.tsx b/app/routes/ComponentLibrary.tsx index 41bbfb7f8d..acc2188c52 100644 --- a/app/routes/ComponentLibrary.tsx +++ b/app/routes/ComponentLibrary.tsx @@ -1,11 +1,72 @@ -import { Button } from "~/components/Button"; -import { ButtonLink } from "~/components/ButtonLink"; +import { useState, useEffect } from "react"; +import { + Button, + ButtonLink, + H4, + LoadingBar, + LoadingDotsTyping, + LoadingDotsBricks, +} from "~/components"; + export default function ComponentLibrary () { + const [progress, setProgress] = useState(0); + useEffect(()=>{ + if(progress === 0){ + const loop = setInterval(function timer(){ + setProgress((curr)=>{ + if (curr < 100){ + return curr+10; + }else{ + clearTimeout(loop); + return curr; + } + })} + , 3000); + } + }, [progress]); + return( - <> - - Button with Link - +
+ +
+

Buttons

+
+ + + +
+
+ +
+

ButtonLink

+ Back to / +
+ +
+

Loading Dots

+
+
+ +
+
+ +
+
+
+ +
+

Loading Bar

+
+ + +
+ +
+
); }; \ No newline at end of file