Added support to enable/disable validating the URL while it is created

This commit is contained in:
Alejandro Celaya 2020-12-06 13:07:44 +01:00
parent 0ed88079ad
commit 8f7e356e54
4 changed files with 28 additions and 12 deletions

View file

@ -1,4 +1,4 @@
import { ChangeEvent, FC } from 'react';
import { ChangeEvent, FC, useRef } from 'react';
import classNames from 'classnames';
import { v4 as uuid } from 'uuid';
import { identity } from 'ramda';
@ -17,7 +17,7 @@ interface BooleanControlWithTypeProps extends BooleanControlProps {
const BooleanControl: FC<BooleanControlWithTypeProps> = (
{ checked = false, onChange = identity, className, children, type, inline = false },
) => {
const id = uuid();
const { current: id } = useRef(uuid());
const onChecked = (e: ChangeEvent<HTMLInputElement>) => onChange(e.target.checked, e);
const typeClasses = {
'custom-switch': type === 'switch',