mirror of
https://github.com/logto-io/logto.git
synced 2025-01-13 21:30:30 -05:00
feat(console): add scrollbar for tenant selector (#4054)
This commit is contained in:
parent
d1cf786bf8
commit
f34ff9119a
2 changed files with 29 additions and 15 deletions
|
@ -1,5 +1,12 @@
|
|||
@use '@/scss/underscore' as _;
|
||||
|
||||
$topbar-height: 64px;
|
||||
$topbar-tenant-card-margin: _.unit(4);
|
||||
$dropdown-top-margin: _.unit(1);
|
||||
$dropdown-bottom-margin: _.unit(6);
|
||||
$dropdown-item-margin: _.unit(1);
|
||||
$dropdown-item-height: 40px;
|
||||
|
||||
.currentTenantCard {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
@ -58,6 +65,10 @@
|
|||
.dropdown {
|
||||
max-width: 500px;
|
||||
min-width: 320px;
|
||||
|
||||
.scrollableContent {
|
||||
max-height: calc(100vh - ($topbar-height - $topbar-tenant-card-margin + $dropdown-top-margin) - $dropdown-bottom-margin - ($dropdown-item-height + $dropdown-item-margin * 2)); // Secure 24px bottom safe margin.
|
||||
}
|
||||
}
|
||||
|
||||
.dropdownItem {
|
||||
|
|
|
@ -11,6 +11,7 @@ import CreateTenantModal from '@/cloud/pages/Main/TenantLandingPage/TenantLandin
|
|||
import AppError from '@/components/AppError';
|
||||
import Divider from '@/ds-components/Divider';
|
||||
import Dropdown, { DropdownItem } from '@/ds-components/Dropdown';
|
||||
import OverlayScrollbar from '@/ds-components/OverlayScrollbar';
|
||||
import useTenants from '@/hooks/use-tenants';
|
||||
import { onKeyDownHandler } from '@/utils/a11y';
|
||||
|
||||
|
@ -69,21 +70,23 @@ function TenantSelector() {
|
|||
setShowDropdown(false);
|
||||
}}
|
||||
>
|
||||
{tenants.map(({ id, name, tag }) => (
|
||||
<DropdownItem
|
||||
key={id}
|
||||
className={styles.dropdownItem}
|
||||
onClick={() => {
|
||||
window.open(new URL(`/${id}`, window.location.origin).toString(), '_self');
|
||||
}}
|
||||
>
|
||||
<div className={styles.dropdownName}>{name}</div>
|
||||
<TenantEnvTag className={styles.dropdownTag} tag={tag} />
|
||||
<Tick
|
||||
className={classNames(styles.checkIcon, id === currentTenantId && styles.visible)}
|
||||
/>
|
||||
</DropdownItem>
|
||||
))}
|
||||
<OverlayScrollbar className={styles.scrollableContent}>
|
||||
{tenants.map(({ id, name, tag }) => (
|
||||
<DropdownItem
|
||||
key={id}
|
||||
className={styles.dropdownItem}
|
||||
onClick={() => {
|
||||
window.open(new URL(`/${id}`, window.location.origin).toString(), '_self');
|
||||
}}
|
||||
>
|
||||
<div className={styles.dropdownName}>{name}</div>
|
||||
<TenantEnvTag className={styles.dropdownTag} tag={tag} />
|
||||
<Tick
|
||||
className={classNames(styles.checkIcon, id === currentTenantId && styles.visible)}
|
||||
/>
|
||||
</DropdownItem>
|
||||
))}
|
||||
</OverlayScrollbar>
|
||||
<Divider />
|
||||
<div
|
||||
role="button"
|
||||
|
|
Loading…
Add table
Reference in a new issue