Move label dialog with the rest of the dialogs.

This commit is contained in:
Paulo Gustavo Veiga 2022-02-17 18:41:03 -08:00
parent a5847c64d4
commit 18531a981b
3 changed files with 5 additions and 3 deletions

View File

@ -22,7 +22,7 @@ type AddLabelFormProps = {
onAdd: (newLabel: Label) => void;
};
export default function AddLabelForm({ onAdd }: AddLabelFormProps): React.ReactElement {
const AddLabelDialog = ({ onAdd }: AddLabelFormProps): React.ReactElement => {
const intl = useIntl();
const [createLabelColorIndex, setCreateLabelColorIndex] = React.useState(
Math.floor(Math.random() * labelColors.length)
@ -92,3 +92,5 @@ export default function AddLabelForm({ onAdd }: AddLabelFormProps): React.ReactE
</CreateLabel>
);
}
export default AddLabelDialog;

View File

@ -8,7 +8,7 @@ import Client, { Label, ErrorInfo, MapInfo } from '../../../../classes/client';
import { useQuery } from 'react-query';
import { useSelector } from 'react-redux';
import { activeInstance } from '../../../../redux/clientSlice';
import AddLabelForm from '../add-label-form';
import AddLabelDialog from '../../action-dispatcher/add-label-dialog';
import { LabelListContainer } from './styled';
export type LabelSelectorProps = {
@ -29,7 +29,7 @@ export function LabelSelector({ onChange, maps }: LabelSelectorProps): React.Rea
return (
<Container>
<FormGroup>
<AddLabelForm onAdd={(label) => onChange(label, true)} />
<AddLabelDialog onAdd={(label) => onChange(label, true)} />
</FormGroup>
<LabelListContainer>
{labels.map(({ id, title, color }) => (