mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-11 01:53:51 +00:00
Improved design on domains dropdown
This commit is contained in:
@@ -7,6 +7,7 @@ export interface BooleanControlProps {
|
||||
checked?: boolean;
|
||||
onChange?: (checked: boolean, e: ChangeEvent<HTMLInputElement>) => void;
|
||||
className?: string;
|
||||
inline?: boolean;
|
||||
}
|
||||
|
||||
interface BooleanControlWithTypeProps extends BooleanControlProps {
|
||||
@@ -14,7 +15,7 @@ interface BooleanControlWithTypeProps extends BooleanControlProps {
|
||||
}
|
||||
|
||||
const BooleanControl: FC<BooleanControlWithTypeProps> = (
|
||||
{ checked = false, onChange = identity, className, children, type },
|
||||
{ checked = false, onChange = identity, className, children, type, inline = false },
|
||||
) => {
|
||||
const id = uuid();
|
||||
const onChecked = (e: ChangeEvent<HTMLInputElement>) => onChange(e.target.checked, e);
|
||||
@@ -22,9 +23,10 @@ const BooleanControl: FC<BooleanControlWithTypeProps> = (
|
||||
'custom-switch': type === 'switch',
|
||||
'custom-checkbox': type === 'checkbox',
|
||||
};
|
||||
const style = inline ? { display: 'inline-block' } : {};
|
||||
|
||||
return (
|
||||
<span className={classNames('custom-control', typeClasses, className)}>
|
||||
<span className={classNames('custom-control', typeClasses, className)} style={style}>
|
||||
<input type="checkbox" className="custom-control-input" id={id} checked={checked} onChange={onChecked} />
|
||||
<label className="custom-control-label" htmlFor={id}>{children}</label>
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user