Skip to content

Commit

Permalink
fix: added print: tailwind classes to hide appbar and footer while pr…
Browse files Browse the repository at this point in the history
…inting
  • Loading branch information
nimit9 committed Mar 28, 2024
1 parent 7c3917a commit a78058e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 23 deletions.
7 changes: 2 additions & 5 deletions src/components/Appbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ export const Appbar = () => {
const currentPath = usePathname();
return (
<>
<nav
id="appbar-nav"
className="fixed z-50 top-0 px-4 w-full h-16 border-b shadow-sm bg-background/80 backdrop-blur-md flex items-center gap-2"
>
<nav className="fixed z-50 top-0 px-4 w-full h-16 border-b shadow-sm bg-background/80 backdrop-blur-md flex items-center gap-2 print:hidden">
{currentPath.includes('courses') && (
<ToggleButton
onClick={() => {
Expand Down Expand Up @@ -92,7 +89,7 @@ export const Appbar = () => {
)}
</div>
</nav>
<div className="h-16 w-full" id="appbar-placeholder" />
<div className="h-16 w-full print:hidden" />
</>
);
};
5 changes: 1 addition & 4 deletions src/components/landing/footer/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ import Logo from '../logo/logo';

const Footer = () => {
return (
<div
id="footer"
className="bottom-0 w-full p-4 bg-neutral-900 dark:bg-slate-900 px-6 lg:px-36"
>
<div className="bottom-0 w-full p-4 bg-neutral-900 dark:bg-slate-900 px-6 lg:px-36 print:hidden">
<div className="md:max-w-screen-2xl mt-4 mx-auto flex flex-row items-start justify-between w-full">
<div className="flex flex-col md:flex-row w-3/5 md:justify-between">
<div className="flex">
Expand Down
14 changes: 0 additions & 14 deletions src/components/print/Print.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,6 @@ export function Print() {
e.style.marginBottom = '0px';
});

// Removing layout header and footer from print
const appbar = document.getElementById('appbar-nav');
const footer = document.getElementById('footer');
const appbarPlaceholder = document.getElementById('appbar-placeholder');
if (appbar) {
appbar.style.display = 'none';
}
if (appbarPlaceholder) {
appbarPlaceholder.style.display = 'none';
}
if (footer) {
footer.style.display = 'none';
}

setTimeout(() => {
print();
opened = true;
Expand Down

0 comments on commit a78058e

Please sign in to comment.