-
Notifications
You must be signed in to change notification settings - Fork 0
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
Alessandro Mazzon
committed
Nov 10, 2023
1 parent
c6246a2
commit 114243d
Showing
9 changed files
with
70 additions
and
3 deletions.
There are no files selected for viewing
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,39 @@ | ||
import { InputSwitch } from "primereact/inputswitch"; | ||
import React, { useState } from "react"; | ||
|
||
interface Props { | ||
readonly title: string; | ||
readonly value?: boolean; | ||
readonly onChange?: (value: boolean) => void; | ||
readonly required?: boolean; | ||
} | ||
|
||
const SmallTextInput = ({ title, value, onChange, required }: Props) => { | ||
const [isChecked, setIsChecked] = useState(value || false); | ||
return ( | ||
<div className="flex flex-1 flex-row bg-bondscape-text_neutral_100 gap-2 px-[1rem] rounded-[16px] items-center"> | ||
<div className="flex w-[130px]"> | ||
<label className="text-[16px] text-bondscape-text_neutral_900"> | ||
{title} | ||
</label> | ||
{required && <span className="ml-1 text-[#FF8686]">*</span>} | ||
</div> | ||
<InputSwitch | ||
pt={{ | ||
slider: ({ props }) => ({ | ||
className: props.checked | ||
? "bg-bondscape-primary" | ||
: "bg-bondscape-text_neutral_300", | ||
}), | ||
}} | ||
checked={isChecked} | ||
onChange={(e) => { | ||
setIsChecked(e.value); | ||
onChange && onChange(e.value); | ||
}} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default SmallTextInput; |
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
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
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
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
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
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
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
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