Skip to content

Commit

Permalink
news: make sidebar width consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Nov 28, 2024
1 parent a04bb26 commit 31c300d
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
display: grid;
gap: 1rem;
grid-template-areas: "left main right";
grid-template-columns: 2fr 5fr 2fr;
grid-template-columns: 300px 5fr 300px;
}

@media (max-width: 1000px) {
Expand Down
30 changes: 29 additions & 1 deletion frontend/src/components/pages/NewsPage/index.module.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.content {
.mainText {
margin-top: 1rem;
}

Expand All @@ -8,3 +8,31 @@
justify-content: space-between;
margin-top: 1rem;
}

.wrapper {
display: grid;
gap: 1rem;
grid-template-areas: "content sidebar";
grid-template-columns: auto 300px;
}

@media (max-width: 1000px) {
.wrapper {
grid-template-columns: 1fr 1fr;
grid-template-rows: min-content auto;
}
}

@media (max-width: 600px) {
.wrapper {
grid-template-columns: 1fr;
grid-template-areas: "sidebar" "content";
}
}

.content {
grid-area: content;
}
.sidebar {
grid-area: sidebar;
}
50 changes: 26 additions & 24 deletions frontend/src/components/pages/NewsPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import { Loader } from "src/components/common/Loader";
import { NewsSidebar } from "src/components/common/NewsSidebar";
import { PermissionGuard } from "src/components/common/PermissionGuard";
import { SectionHeader } from "src/components/common/Section";
import { SidebarLayout } from "src/components/layouts/SidebarLayout";
import { SidebarLayoutVariant } from "src/components/layouts/SidebarLayout";
import { Markdown } from "src/components/markdown/Markdown";
import { usePageMetadata } from "src/contexts/PageMetadataContext";
import type { NewsDetails } from "src/services/NewsService";
Expand Down Expand Up @@ -47,30 +45,34 @@ const NewsPage = () => {

const news: NewsDetails = newsResult.data;

return (
<SidebarLayout
variant={SidebarLayoutVariant.Reverse}
sidebar={<NewsSidebar />}
>
<Box>
{news.subject && (
<SectionHeader>
<Markdown>{news.subject}</Markdown>
</SectionHeader>
)}
const content = (
<Box>
{news.subject && (
<SectionHeader>
<Markdown>{news.subject}</Markdown>
</SectionHeader>
)}

<div className={`${styles.mainText} ChildMarginClear`}>
<Markdown>{news.text || "No news text is available."}</Markdown>
</div>

<div className={`${styles.content} ChildMarginClear`}>
<Markdown>{news.text || "No news text is available."}</Markdown>
</div>
<footer className={styles.footer}>
<em>Posted on {formatDate(news.created)}</em>
<PermissionGuard require={UserPermission.editNews}>
<Button to={`/news/${newsId}/edit`}>Edit news</Button>
</PermissionGuard>
</footer>
</Box>
);

<footer className={styles.footer}>
<em>Posted on {formatDate(news.created)}</em>
<PermissionGuard require={UserPermission.editNews}>
<Button to={`/news/${newsId}/edit`}>Edit news</Button>
</PermissionGuard>
</footer>
</Box>
</SidebarLayout>
return (
<div className={styles.wrapper}>
<div className={styles.sidebar}>
<NewsSidebar />
</div>
<div className={styles.content}>{content}</div>
</div>
);
};

Expand Down

0 comments on commit 31c300d

Please sign in to comment.