Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
Create a mask when preview=true query parameter is present
Browse files Browse the repository at this point in the history
  • Loading branch information
kudlajz committed May 16, 2024
1 parent b958732 commit 50540a5
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
6 changes: 6 additions & 0 deletions components/PreviewPageMask/PreviewPageMask.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.mask {
position: fixed;
inset: 0;
background: transparent;
z-index: 9999;
}
14 changes: 14 additions & 0 deletions components/PreviewPageMask/PreviewPageMask.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { useSearchParams } from 'next/navigation';

import styles from './PreviewPageMask.module.scss';

export function PreviewPageMask() {
const searchParams = useSearchParams();
const preview = JSON.parse(searchParams.get('preview') ?? 'false');

if (!preview) {
return null;
}

return <div className={styles.mask} />;
}
1 change: 1 addition & 0 deletions components/PreviewPageMask/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { PreviewPageMask } from './PreviewPageMask';
2 changes: 2 additions & 0 deletions modules/Layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import type { PropsWithChildren } from 'react';
import { useEffect, useMemo, useState } from 'react';

import { NotificationsBar } from '@/components';
import { PreviewPageMask } from '@/components/PreviewPageMask';
import { IconArrowTop } from '@/icons';
import { LoadingBar, ScrollToTopButton } from '@/ui';

Expand Down Expand Up @@ -106,6 +107,7 @@ function Layout({ title, description, imageUrl, hasError, children }: PropsWithC
icon={IconArrowTop}
iconClassName={styles.scrollToTopIcon}
/>
<PreviewPageMask />
</div>
</>
);
Expand Down

0 comments on commit 50540a5

Please sign in to comment.