set filter modal

This commit is contained in:
Jan Prochazka
2020-05-16 07:55:02 +02:00
parent 3b7f391b8c
commit 96e160f122
4 changed files with 178 additions and 12 deletions

View File

@@ -22,25 +22,35 @@ export const FormLabel = styled.div`
export const FormValue = styled.div``;
export function FormTextFieldRaw({ ...other }) {
return <Field {...other} as={TextField} />;
}
export function FormTextField({ label, ...other }) {
return (
<FormRow>
<FormLabel>{label}</FormLabel>
<FormValue>
<Field {...other} as={TextField} />
<FormTextFieldRaw {...other} />
</FormValue>
</FormRow>
);
}
export function FormSelectFieldRaw({ children, ...other }) {
return (
<Field {...other} as={SelectField}>
{children}
</Field>
);
}
export function FormSelectField({ label, children, ...other }) {
return (
<FormRow>
<FormLabel>{label}</FormLabel>
<FormValue>
<Field {...other} as={SelectField}>
{children}
</Field>
<FormSelectFieldRaw {...other}>{children}</FormSelectFieldRaw>
</FormValue>
</FormRow>
);
@@ -54,3 +64,19 @@ export function FormButton({ text, onClick, ...other }) {
const { values } = useFormikContext();
return <FormStyledButton type="button" value={text} onClick={() => onClick(values)} {...other} />;
}
export function FormRadioGroupItem({ name, text, value }) {
const { setFieldValue, values } = useFormikContext();
return (
<div>
<input
type="radio"
name={name}
id={`${name}_${value}`}
defaultChecked={values[name] == value}
onClick={() => setFieldValue(name, value)}
/>
<label htmlFor={`multiple_values_option_${value}`}>{text}</label>
</div>
);
}