From 3951724bcdd5e510b6bc1109bba2b4bef50f7f90 Mon Sep 17 00:00:00 2001 From: Xiao Yijun Date: Fri, 13 Jan 2023 10:41:55 +0800 Subject: [PATCH] refactor(console): make the `disabled` prop of the `CheckBox` optional (#2933) --- packages/console/src/components/Checkbox/index.tsx | 4 ++-- .../RoleScopesTransfer/components/ResourceItem/index.tsx | 1 - .../RoleScopesTransfer/components/SourceScopeItem/index.tsx | 1 - .../RoleUsersTransfer/components/SourceUserItem/index.tsx | 1 - .../UserRolesTransfer/components/SourceRoleItem/index.tsx | 1 - 5 files changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/console/src/components/Checkbox/index.tsx b/packages/console/src/components/Checkbox/index.tsx index e31fed92e..fb0d8a7ed 100644 --- a/packages/console/src/components/Checkbox/index.tsx +++ b/packages/console/src/components/Checkbox/index.tsx @@ -10,7 +10,7 @@ import * as styles from './index.module.scss'; type Props = { /* eslint-disable react/boolean-prop-naming */ checked: boolean; - disabled: boolean; + disabled?: boolean; indeterminate?: boolean; /* eslint-enable react/boolean-prop-naming */ onChange: (value: boolean) => void; @@ -21,7 +21,7 @@ type Props = { const Checkbox = ({ checked, - disabled, + disabled = false, indeterminate, onChange, label, diff --git a/packages/console/src/components/RoleScopesTransfer/components/ResourceItem/index.tsx b/packages/console/src/components/RoleScopesTransfer/components/ResourceItem/index.tsx index 185a393b0..4c9037cad 100644 --- a/packages/console/src/components/RoleScopesTransfer/components/ResourceItem/index.tsx +++ b/packages/console/src/components/RoleScopesTransfer/components/ResourceItem/index.tsx @@ -32,7 +32,6 @@ const ResourceItem = ({ resource, selectedScopes, onSelectResource, onSelectScop 0 && selectedScopesCount < totalScopesCount} - disabled={false} onChange={() => { onSelectResource(resource); }} diff --git a/packages/console/src/components/RoleScopesTransfer/components/SourceScopeItem/index.tsx b/packages/console/src/components/RoleScopesTransfer/components/SourceScopeItem/index.tsx index 63fb413aa..289ce861c 100644 --- a/packages/console/src/components/RoleScopesTransfer/components/SourceScopeItem/index.tsx +++ b/packages/console/src/components/RoleScopesTransfer/components/SourceScopeItem/index.tsx @@ -15,7 +15,6 @@ const SourceScopeItem = ({ scope, scope: { name }, isSelected, onSelect }: Props
{ onSelect(scope); }} diff --git a/packages/console/src/components/RoleUsersTransfer/components/SourceUserItem/index.tsx b/packages/console/src/components/RoleUsersTransfer/components/SourceUserItem/index.tsx index 105c9d00a..2058ea20b 100644 --- a/packages/console/src/components/RoleUsersTransfer/components/SourceUserItem/index.tsx +++ b/packages/console/src/components/RoleUsersTransfer/components/SourceUserItem/index.tsx @@ -30,7 +30,6 @@ const SourceUserItem = ({ user: { avatar, name }, isSelected, onSelect }: Props) > { onSelect(); }} diff --git a/packages/console/src/components/UserRolesTransfer/components/SourceRoleItem/index.tsx b/packages/console/src/components/UserRolesTransfer/components/SourceRoleItem/index.tsx index d5b79366b..944c653d7 100644 --- a/packages/console/src/components/UserRolesTransfer/components/SourceRoleItem/index.tsx +++ b/packages/console/src/components/UserRolesTransfer/components/SourceRoleItem/index.tsx @@ -30,7 +30,6 @@ const SourceRoleItem = ({ role, isSelected, onSelect }: Props) => { > { onSelect(); }}