mirror of
https://github.com/logto-io/logto.git
synced 2024-12-30 20:33:54 -05:00
fix(console): remove react warning from Switch component (#3719)
This commit is contained in:
parent
666c4eaaa7
commit
e0649aa81a
1 changed files with 3 additions and 3 deletions
|
@ -3,16 +3,16 @@ import { forwardRef } from 'react';
|
|||
|
||||
import * as styles from './index.module.scss';
|
||||
|
||||
type Props = HTMLProps<HTMLInputElement> & {
|
||||
type Props = Omit<HTMLProps<HTMLInputElement>, 'value'> & {
|
||||
label?: ReactNode;
|
||||
};
|
||||
|
||||
function Switch({ label, ...rest }: Props, ref?: Ref<HTMLInputElement>) {
|
||||
function Switch({ label, checked = false, ...rest }: Props, ref?: Ref<HTMLInputElement>) {
|
||||
return (
|
||||
<div className={styles.wrapper}>
|
||||
<div className={styles.label}>{label}</div>
|
||||
<label className={styles.switch}>
|
||||
<input type="checkbox" {...rest} ref={ref} />
|
||||
<input type="checkbox" checked={checked} {...rest} ref={ref} />
|
||||
<span className={styles.slider} />
|
||||
</label>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue