Skip to content

Commit

Permalink
fix(console): fix console z index issue on modals and banners
Browse files Browse the repository at this point in the history
  • Loading branch information
charIeszhao committed Aug 21, 2024
1 parent 332131a commit 26620c9
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 37 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
@use '@/scss/underscore' as _;

.banner {
@include _.z-index(front);
.container {
position: absolute;
left: 50%;
transform: translateX(-50%);
top: _.unit(4);
font: var(--font-label-2);
color: var(--color-text);
display: flex;
align-items: center;
gap: _.unit(2.5);
padding: _.unit(1.5) _.unit(4);
background: var(--color-neutral-variant-90);
border-radius: _.unit(4);

.banner {
font: var(--font-label-2);
color: var(--color-text);
display: flex;
align-items: center;
gap: _.unit(2.5);
padding: _.unit(1.5) _.unit(4);
background: var(--color-neutral-variant-90);
border-radius: _.unit(4);
@include _.z-index(front);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,27 @@ function CreateProductionTenantBanner() {
}

return createPortal(
<div className={styles.banner}>
<CreateTenantModal
isOpen={isCreateModalOpen}
onClose={async (tenant?: TenantResponse) => {
setIsCreateModalOpen(false);
if (tenant) {
prependTenant(tenant);
navigateTenant(tenant.id);
}
}}
/>
<span>{t('text')}</span>
<TextLink
onClick={() => {
setIsCreateModalOpen(true);
}}
>
{t('action')}
</TextLink>
<div className={styles.container}>
<div className={styles.banner}>
<CreateTenantModal
isOpen={isCreateModalOpen}
onClose={async (tenant?: TenantResponse) => {
setIsCreateModalOpen(false);
if (tenant) {
prependTenant(tenant);
navigateTenant(tenant.id);
}
}}
/>
<span>{t('text')}</span>
<TextLink
onClick={() => {
setIsCreateModalOpen(true);
}}
>
{t('action')}
</TextLink>
</div>
</div>,
document.body
);
Expand Down
3 changes: 2 additions & 1 deletion packages/console/src/scss/modal.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
inset: 0;
overflow-y: auto;
padding: _.unit(3) 0;
z-index: 101;
@include _.z-index(modal);
}

.content {
Expand All @@ -25,6 +25,7 @@
.fullScreen {
position: fixed;
inset: 0;
@include _.z-index(modal);

&:focus-visible {
outline: none;
Expand Down
7 changes: 0 additions & 7 deletions packages/console/src/scss/normalized.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,3 @@ input {
height: 100%;
flex: 1;
}

.ReactModalPortal {
position: relative;
// Set `z-index` for the portal to ensure it can be placed on the right layer among other
// top-level doms.
@include _.z-index(modal);
}

0 comments on commit 26620c9

Please sign in to comment.