input booleans
This commit is contained in:
1 parent
70eba32b34
commit
126f1df657
7 files changed
+166
-5
No files matched your search
@@ -0,0 +1,26 @@
|
||||
import InputWrapper from "./InputWrapper";
|
||||
|
||||
export interface Props {
|
||||
label: string;
|
||||
value: boolean;
|
||||
onChange: (v: boolean) => void;
|
||||
}
|
||||
export default function InputBoolean({
|
||||
label,
|
||||
value=false,
|
||||
onChange,
|
||||
}: Props) {
|
||||
return <InputWrapper label={label} style={{
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'space-between',
|
||||
marginTop: '3%',
|
||||
marginBottom: '3%'
|
||||
}}>
|
||||
<span className="checkbox" onClick={e => {
|
||||
e.preventDefault()
|
||||
onChange(!value)
|
||||
}}>
|
||||
{value ? '✔️' : ' '}
|
||||
</span>
|
||||
</InputWrapper>
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { useToolTip } from "../tooltip/context";
|
||||
import InputWrapper from "./InputWrapper";
|
||||
|
||||
export interface Props {
|
||||
label: string;
|
||||
value: number;
|
||||
onChange: (v: number) => void;
|
||||
}
|
||||
export default function InputNumber({
|
||||
label,
|
||||
value=0,
|
||||
onChange,
|
||||
}: Props) {
|
||||
const tooltip = useToolTip();
|
||||
return <InputWrapper label={label}>
|
||||
<input
|
||||
type="number"
|
||||
value={value}
|
||||
onChange={e => {
|
||||
e.preventDefault();
|
||||
onChange(Number(e.target.value))
|
||||
}}
|
||||
/>
|
||||
</InputWrapper>
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
import { PropsWithChildren } from "react";
|
||||
import { CSSProperties, PropsWithChildren } from "react";
|
||||
|
||||
|
||||
export interface Props {
|
||||
label: string;
|
||||
style?: CSSProperties;
|
||||
}
|
||||
export default function InputWrapper({label, children}: PropsWithChildren<Props>) {
|
||||
return <div className="input-wrapper">
|
||||
export default function InputWrapper({label, children, style={}}: PropsWithChildren<Props>) {
|
||||
return <div className="input-wrapper" style={style}>
|
||||
<label>{label}</label>
|
||||
{children}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user