0
0
Fork 0

Further de-emphasize filtered notifications banner and add setting to minimize it (#31250)

This commit is contained in:
Claire 2024-08-02 16:59:37 +02:00 committed by GitHub
parent 2ec1181ee5
commit ad95c98054
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 321 additions and 119 deletions

View file

@ -0,0 +1,40 @@
import type { PropsWithChildren } from 'react';
import { useCallback } from 'react';
import Toggle from 'react-toggle';
interface Props {
checked: boolean;
disabled?: boolean;
onChange: (checked: boolean) => void;
}
export const CheckboxWithLabel: React.FC<PropsWithChildren<Props>> = ({
checked,
disabled,
children,
onChange,
}) => {
const handleChange = useCallback(
({ target }: React.ChangeEvent<HTMLInputElement>) => {
onChange(target.checked);
},
[onChange],
);
return (
<label className='app-form__toggle'>
<div className='app-form__toggle__label'>{children}</div>
<div className='app-form__toggle__toggle'>
<div>
<Toggle
checked={checked}
onChange={handleChange}
disabled={disabled}
/>
</div>
</div>
</label>
);
};