1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-09 00:18:00 +01:00

fix: demo banner zIndex, display on top (#5776)

This PR does 2 things:
- Fixes the `DemoBanner` zIndex to be the same as the sticky banners (no
longer displays on top of modals)
- Moves the `Demo` wrapper to `App` instead of `MainLayout`, always
displaying the demo banner before other banners


![image](https://github.com/Unleash/unleash/assets/14320932/b115ee7f-26e0-468f-91aa-1f82335a6538)
This commit is contained in:
Nuno Góis 2024-01-05 14:57:34 +00:00 committed by GitHub
parent 1724219487
commit c6ba9603c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 89 additions and 98 deletions

View File

@ -23,6 +23,7 @@ import { InitialRedirect } from './InitialRedirect';
import { InternalBanners } from './banners/internalBanners/InternalBanners'; import { InternalBanners } from './banners/internalBanners/InternalBanners';
import { ExternalBanners } from './banners/externalBanners/ExternalBanners'; import { ExternalBanners } from './banners/externalBanners/ExternalBanners';
import { LicenseBanner } from './banners/internalBanners/LicenseBanner'; import { LicenseBanner } from './banners/internalBanners/LicenseBanner';
import { Demo } from './demo/Demo';
const StyledContainer = styled('div')(() => ({ const StyledContainer = styled('div')(() => ({
'& ul': { '& ul': {
@ -59,6 +60,7 @@ export const App = () => {
condition={!hasFetchedAuth} condition={!hasFetchedAuth}
show={<Loader />} show={<Loader />}
elseShow={ elseShow={
<Demo>
<> <>
<ConditionallyRender <ConditionallyRender
condition={Boolean( condition={Boolean(
@ -76,7 +78,9 @@ export const App = () => {
(route) => ( (route) => (
<Route <Route
key={route.path} key={route.path}
path={route.path} path={
route.path
}
element={ element={
<LayoutPicker <LayoutPicker
isStandalone={ isStandalone={
@ -111,6 +115,7 @@ export const App = () => {
<SplashPageRedirect /> <SplashPageRedirect />
</StyledContainer> </StyledContainer>
</> </>
</Demo>
} }
/> />
</Suspense> </Suspense>

View File

@ -3,7 +3,7 @@ import { Sticky } from 'component/common/Sticky/Sticky';
import { usePlausibleTracker } from 'hooks/usePlausibleTracker'; import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
const StyledBanner = styled(Sticky)(({ theme }) => ({ const StyledBanner = styled(Sticky)(({ theme }) => ({
zIndex: theme.zIndex.sticky, zIndex: theme.zIndex.sticky - 100,
display: 'flex', display: 'flex',
gap: theme.spacing(1), gap: theme.spacing(1),
justifyContent: 'center', justifyContent: 'center',

View File

@ -14,7 +14,6 @@ import { ConditionallyRender } from 'component/common/ConditionallyRender/Condit
import { useChangeRequestsEnabled } from 'hooks/useChangeRequestsEnabled'; import { useChangeRequestsEnabled } from 'hooks/useChangeRequestsEnabled';
import { DraftBanner } from './DraftBanner/DraftBanner'; import { DraftBanner } from './DraftBanner/DraftBanner';
import { ThemeMode } from 'component/common/ThemeMode/ThemeMode'; import { ThemeMode } from 'component/common/ThemeMode/ThemeMode';
import { Demo } from 'component/demo/Demo';
import { useUiFlag } from 'hooks/useUiFlag'; import { useUiFlag } from 'hooks/useUiFlag';
interface IMainLayoutProps { interface IMainLayoutProps {
@ -111,8 +110,6 @@ export const MainLayout = forwardRef<HTMLDivElement, IMainLayoutProps>(
return ( return (
<> <>
<SkipNavLink /> <SkipNavLink />
<Demo>
<>
<Header /> <Header />
<SkipNavTarget /> <SkipNavTarget />
<MainLayoutContainer> <MainLayoutContainer>
@ -122,18 +119,9 @@ export const MainLayout = forwardRef<HTMLDivElement, IMainLayoutProps>(
projectId && projectId &&
isChangeRequestConfiguredInAnyEnv(), isChangeRequestConfiguredInAnyEnv(),
)} )}
show={ show={<DraftBanner project={projectId || ''} />}
<DraftBanner
project={projectId || ''}
/> />
} <StyledMainLayoutContent item xs={12} sm={12} my={2}>
/>
<StyledMainLayoutContent
item
xs={12}
sm={12}
my={2}
>
<MainLayoutContentContainer ref={ref}> <MainLayoutContentContainer ref={ref}>
<BreadcrumbNav /> <BreadcrumbNav />
<Proclamation toast={uiConfig.toast} /> <Proclamation toast={uiConfig.toast} />
@ -159,8 +147,6 @@ export const MainLayout = forwardRef<HTMLDivElement, IMainLayoutProps>(
<Footer /> <Footer />
</MainLayoutContainer> </MainLayoutContainer>
</> </>
</Demo>
</>
); );
}, },
); );