-
-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(console): reorg role transfer component file structure
- Loading branch information
Showing
13 changed files
with
95 additions
and
95 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
...ages/console/src/components/RolesTransfer/SourceRolesBox/SourceRoleItem/index.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
@use '@/scss/underscore' as _; | ||
|
||
.item { | ||
display: flex; | ||
align-items: center; | ||
padding: _.unit(2.5) _.unit(4); | ||
user-select: none; | ||
cursor: pointer; | ||
|
||
&:hover { | ||
background-color: var(--color-hover); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...ages/console/src/components/RolesTransfer/TargetRolesBox/TargetRoleItem/index.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@use '@/scss/underscore' as _; | ||
|
||
.item { | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
padding: _.unit(2) _.unit(3) _.unit(2) _.unit(4); | ||
user-select: none; | ||
|
||
&:hover { | ||
background-color: var(--color-hover); | ||
} | ||
|
||
.closeIcon { | ||
margin-left: _.unit(1); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
packages/console/src/components/RolesTransfer/TargetRolesBox/TargetRoleItem/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { type RoleResponse } from '@logto/schemas'; | ||
|
||
import Close from '@/assets/icons/close.svg'; | ||
import IconButton from '@/ds-components/IconButton'; | ||
|
||
import RoleInformation from '../../components/RoleInformation'; | ||
|
||
import * as styles from './index.module.scss'; | ||
|
||
type Props = { | ||
readonly role: RoleResponse; | ||
readonly onDelete: () => void; | ||
}; | ||
|
||
function TargetRoleItem({ role, onDelete }: Props) { | ||
return ( | ||
<div className={styles.item}> | ||
<RoleInformation role={role} /> | ||
<IconButton size="small" className={styles.closeIcon} onClick={onDelete}> | ||
<Close /> | ||
</IconButton> | ||
</div> | ||
); | ||
} | ||
|
||
export default TargetRoleItem; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 2 additions & 8 deletions
10
...mponents/SourceRoleItem/index.module.scss → ...ponents/RoleInformation/index.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
packages/console/src/components/RolesTransfer/components/RoleInformation/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { RoleType, type RoleResponse } from '@logto/schemas'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import * as styles from './index.module.scss'; | ||
|
||
type Props = { | ||
readonly role: RoleResponse; | ||
}; | ||
|
||
function RoleInformation({ role }: Props) { | ||
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' }); | ||
|
||
const { name, type, usersCount, applicationsCount } = role; | ||
|
||
return ( | ||
<div className={styles.container}> | ||
<div className={styles.name}>{name}</div> | ||
<div className={styles.count}> | ||
( | ||
{type === RoleType.User | ||
? t('user_details.roles.assigned_user_count', { value: usersCount }) | ||
: t('application_details.roles.assigned_app_count', { value: applicationsCount })} | ||
) | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default RoleInformation; |
31 changes: 0 additions & 31 deletions
31
packages/console/src/components/RolesTransfer/components/TargetRoleItem/index.module.scss
This file was deleted.
Oops, something went wrong.
37 changes: 0 additions & 37 deletions
37
packages/console/src/components/RolesTransfer/components/TargetRoleItem/index.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters