mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-22 14:47:56 +01:00
Move label dialog with the rest of the dialogs.
This commit is contained in:
parent
a5847c64d4
commit
18531a981b
@ -22,7 +22,7 @@ type AddLabelFormProps = {
|
|||||||
onAdd: (newLabel: Label) => void;
|
onAdd: (newLabel: Label) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function AddLabelForm({ onAdd }: AddLabelFormProps): React.ReactElement {
|
const AddLabelDialog = ({ onAdd }: AddLabelFormProps): React.ReactElement => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const [createLabelColorIndex, setCreateLabelColorIndex] = React.useState(
|
const [createLabelColorIndex, setCreateLabelColorIndex] = React.useState(
|
||||||
Math.floor(Math.random() * labelColors.length)
|
Math.floor(Math.random() * labelColors.length)
|
||||||
@ -92,3 +92,5 @@ export default function AddLabelForm({ onAdd }: AddLabelFormProps): React.ReactE
|
|||||||
</CreateLabel>
|
</CreateLabel>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default AddLabelDialog;
|
@ -8,7 +8,7 @@ import Client, { Label, ErrorInfo, MapInfo } from '../../../../classes/client';
|
|||||||
import { useQuery } from 'react-query';
|
import { useQuery } from 'react-query';
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
import { activeInstance } from '../../../../redux/clientSlice';
|
import { activeInstance } from '../../../../redux/clientSlice';
|
||||||
import AddLabelForm from '../add-label-form';
|
import AddLabelDialog from '../../action-dispatcher/add-label-dialog';
|
||||||
import { LabelListContainer } from './styled';
|
import { LabelListContainer } from './styled';
|
||||||
|
|
||||||
export type LabelSelectorProps = {
|
export type LabelSelectorProps = {
|
||||||
@ -29,7 +29,7 @@ export function LabelSelector({ onChange, maps }: LabelSelectorProps): React.Rea
|
|||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<AddLabelForm onAdd={(label) => onChange(label, true)} />
|
<AddLabelDialog onAdd={(label) => onChange(label, true)} />
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<LabelListContainer>
|
<LabelListContainer>
|
||||||
{labels.map(({ id, title, color }) => (
|
{labels.map(({ id, title, color }) => (
|
||||||
|
Loading…
Reference in New Issue
Block a user