hide right column in some views
Some checks failed
continuous-integration/drone/pr Build is failing

This commit is contained in:
Martti Malmi 2023-11-26 16:50:05 +02:00
parent 8bc323489e
commit 0434ae43d8
3 changed files with 11 additions and 5 deletions

View File

@ -3,10 +3,14 @@ import TrendingUsers from "@/Element/TrendingUsers";
import TrendingHashtags from "@/Element/TrendingHashtags"; import TrendingHashtags from "@/Element/TrendingHashtags";
import TrendingNotes from "@/Element/TrendingPosts"; import TrendingNotes from "@/Element/TrendingPosts";
import { FormattedMessage } from "react-intl"; import { FormattedMessage } from "react-intl";
import classNames from "classnames";
export default function RightColumn() { export default function RightColumn({ show = true }) {
return ( return (
<div className="flex-col hidden lg:flex lg:w-1/3 sticky top-0 h-screen p-2 border-l border-neutral-900"> <div
className={classNames("flex-col hidden lg:w-1/3 sticky top-0 h-screen p-2 border-l border-neutral-900", {
"lg:flex": show,
})}>
<div> <div>
<SearchBox /> <SearchBox />
</div> </div>

View File

@ -29,7 +29,9 @@ export default function Index() {
useLoginFeed(); useLoginFeed();
const hideHeaderPaths = ["/login", "/new"]; const hideHeaderPaths = ["/login", "/new"];
const hideRightColumnPaths = ["/login", "/new", "/messages", "/settings"];
const shouldHideHeader = hideHeaderPaths.some(path => location.pathname.startsWith(path)); const shouldHideHeader = hideHeaderPaths.some(path => location.pathname.startsWith(path));
const shouldHideRightColumn = hideRightColumnPaths.some(path => location.pathname.startsWith(path));
const pageClassPaths = useMemo( const pageClassPaths = useMemo(
() => ({ () => ({
@ -67,7 +69,7 @@ export default function Index() {
<Outlet /> <Outlet />
</ErrorBoundary> </ErrorBoundary>
</div> </div>
<RightColumn /> <RightColumn show={!shouldHideRightColumn} />
</div> </div>
<div className="md:hidden"> <div className="md:hidden">
<NoteCreatorButton className="note-create-button" /> <NoteCreatorButton className="note-create-button" />

View File

@ -1,8 +1,7 @@
.dm-page { .dm-page {
--full-height: calc(100vh - 42px - var(--header-padding-tb) - var(--header-padding-tb) - 16px);
display: grid; display: grid;
grid-template-columns: 350px auto; grid-template-columns: 350px auto;
height: var(--full-height); height: 100vh;
/* 100vh - header - padding */ /* 100vh - header - padding */
overflow: hidden; overflow: hidden;
padding: 4px; padding: 4px;
@ -16,6 +15,7 @@
@media (max-width: 768px) { @media (max-width: 768px) {
.dm-page { .dm-page {
grid-template-columns: 100vw; grid-template-columns: 100vw;
height: calc(100vh - 62px);
} }
.dm-page > div:nth-child(1) { .dm-page > div:nth-child(1) {