From a24563a09633b7b842107ac6d1e0ac109ecafca6 Mon Sep 17 00:00:00 2001 From: Anton Date: Wed, 27 Sep 2023 18:29:47 +0200 Subject: [PATCH] Components Finetuning --- src/Components/AppShell/DialogModal.tsx | 2 +- src/Components/Input/SelectBox.tsx | 51 +++++++++++++++++++++++++ src/Components/Input/index.tsx | 3 +- src/Components/Templates/CardPage.tsx | 2 +- src/Components/Templates/TitleCard.tsx | 5 ++- src/index.tsx | 2 +- 6 files changed, 59 insertions(+), 6 deletions(-) create mode 100644 src/Components/Input/SelectBox.tsx diff --git a/src/Components/AppShell/DialogModal.tsx b/src/Components/AppShell/DialogModal.tsx index f1cf2091..8ec0199e 100644 --- a/src/Components/AppShell/DialogModal.tsx +++ b/src/Components/AppShell/DialogModal.tsx @@ -43,7 +43,7 @@ const DialogModal = ({ return ( - void; + + options: {name: string, value: string}[]; + labelDescription?: string +} + +export function SelectBox(props : SelectBoxProps){ + + const {labelTitle, labelDescription, defaultValue, containerStyle, placeholder, labelStyle, options, updateFormValue} = props + + const [value, setValue] = useState(defaultValue || "") + + + const updateValue = (newValue: string) =>{ + updateFormValue(newValue) + setValue(newValue) + } + + + return ( +
+ {labelTitle? + + : ""} + +
+ ) +} \ No newline at end of file diff --git a/src/Components/Input/index.tsx b/src/Components/Input/index.tsx index 432f954c..5bcdbe5f 100644 --- a/src/Components/Input/index.tsx +++ b/src/Components/Input/index.tsx @@ -1,2 +1,3 @@ export {TextAreaInput} from "./TextAreaInput" -export {TextInput} from "./TextInput" \ No newline at end of file +export {TextInput} from "./TextInput" +export {SelectBox} from "./SelectBox" \ No newline at end of file diff --git a/src/Components/Templates/CardPage.tsx b/src/Components/Templates/CardPage.tsx index 76484487..558fc4ef 100644 --- a/src/Components/Templates/CardPage.tsx +++ b/src/Components/Templates/CardPage.tsx @@ -11,7 +11,7 @@ export function CardPage({title,children} : { return (
-
+
  • Home
  • diff --git a/src/Components/Templates/TitleCard.tsx b/src/Components/Templates/TitleCard.tsx index abacda06..b8ba5c7b 100644 --- a/src/Components/Templates/TitleCard.tsx +++ b/src/Components/Templates/TitleCard.tsx @@ -6,12 +6,13 @@ interface TitleCardProps { title: string, children : React.ReactNode, topMargin: string, + className?: string, TopSideButtons?: any } - export function TitleCard({title, children, topMargin, TopSideButtons} : TitleCardProps){ + export function TitleCard({title, children, topMargin, TopSideButtons, className} : TitleCardProps){ return( -
    +
    {/* Title for Card */} diff --git a/src/index.tsx b/src/index.tsx index 46d3ae09..825bf022 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -4,7 +4,7 @@ export {AuthProvider, useAuth, LoginPage, SignupPage} from "./Components/Auth" export {Settings} from './Components/Profile' export {Quests, Modal} from './Components/Gaming' export {TitleCard, CardPage} from './Components/Templates' -export {TextInput, TextAreaInput} from './Components/Input' +export {TextInput, TextAreaInput, SelectBox} from './Components/Input' import "./index.css"