mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-09 04:51:33 +08:00
解决按钮无障碍
This commit is contained in:
@@ -265,9 +265,17 @@ export function Input(props: InputProps) {
|
||||
);
|
||||
}
|
||||
|
||||
export function PasswordInput(props: HTMLProps<HTMLInputElement>) {
|
||||
const [visible, setVisible] = useState(false);
|
||||
// 定义一个接口 AriaProps,包含一个可选的 aria 属性
|
||||
interface AriaProps {
|
||||
aria?: string;
|
||||
}
|
||||
|
||||
// 定义一个接口 PasswordInputProps,继承自 HTMLProps<HTMLInputElement> 和 AriaProps
|
||||
// 用于描述密码输入框组件的属性
|
||||
interface PasswordInputProps extends HTMLProps<HTMLInputElement>, AriaProps {}
|
||||
|
||||
export function PasswordInput(props: PasswordInputProps) {
|
||||
const [visible, setVisible] = useState(false);
|
||||
function changeVisibility() {
|
||||
setVisible(!visible);
|
||||
}
|
||||
@@ -275,6 +283,7 @@ export function PasswordInput(props: HTMLProps<HTMLInputElement>) {
|
||||
return (
|
||||
<div className={"password-input-container"}>
|
||||
<IconButton
|
||||
aria={props.aria}
|
||||
icon={visible ? <EyeIcon /> : <EyeOffIcon />}
|
||||
onClick={changeVisibility}
|
||||
className={"password-eye"}
|
||||
|
Reference in New Issue
Block a user