Skip to content
Snippets Groups Projects
Commit 8512d6d9 authored by Moritz Stückler's avatar Moritz Stückler :cowboy:
Browse files

fix: convert form checkicon to checkbox

parent b0d5f025
No related branches found
No related tags found
No related merge requests found
......@@ -5,9 +5,9 @@ import fetcher from '../../util/fetcher';
import TextInput from './TextInput';
import FileInput from './FileInput';
import TextAreaInput from './TextAreaInput';
import { CheckCircleOutline as CheckIcon } from 'heroicons-react';
import { useStore } from '../../hooks';
import { useHistory } from 'react-router-dom';
import CheckboxInput from './CheckboxInput';
interface Props {}
......@@ -115,11 +115,7 @@ const AddPoiForm: React.FC<Props> = () => {
return (
<form className="flex flex-col" onSubmit={handleSubmit} ref={formRef}>
<p className="flex items-center leading-relaxed mb-5 text-gray-600">
<CheckIcon className={`${draftPoi ? 'text-indigo-500' : 'text-gray-400'} mr-2`} />
Bitte einen Pin auf der Karte setzen.
</p>
<CheckboxInput name="draft" label={'Bitte einen Pin auf der Karte setzen.'} value={Boolean(draftPoi)} required />
<TextInput label={'Name des Orts'} name={'name'} value={formData.name} onChange={handleInputChange} required />
<TextInput
label={'Kategorie'}
......
import React from 'react';
import { CheckCircleOutline as CheckIcon } from 'heroicons-react';
interface Props {
label: string;
value: boolean;
name: string;
required?: boolean;
}
const CheckboxInput: React.FC<Props> = ({ name, label, value, ...inputProps }) => {
return (
<label className="flex mb-4 items-center">
<CheckIcon className={`${value ? 'text-indigo-500' : 'text-gray-400'} mr-2`} />
<input readOnly type="checkbox" name={name} value={name} className="hidden" checked={value} {...inputProps} />
{!!label && <span className="form-label">{label}</span>}
</label>
);
};
export default CheckboxInput;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment