Skip to content

chore: use emotion for styling (pt. 8) #10447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Nov 1, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
emotion: TemplateDocsPage
  • Loading branch information
aslilac committed Oct 31, 2023
commit 641ede7e7472dd76918c280293c697611421748d
59 changes: 29 additions & 30 deletions site/src/pages/TemplatePage/TemplateDocsPage/TemplateDocsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { makeStyles } from "@mui/styles";
import { MemoizedMarkdown } from "components/Markdown/Markdown";
import { useTemplateLayoutContext } from "pages/TemplatePage/TemplateLayout";
import { useTheme } from "@emotion/react";
import frontMatter from "front-matter";
import { Helmet } from "react-helmet-async";
import { MemoizedMarkdown } from "components/Markdown/Markdown";
import { useTemplateLayoutContext } from "pages/TemplatePage/TemplateLayout";
import { pageTitle } from "utils/page";

export default function TemplateDocsPage() {
const { template, activeVersion } = useTemplateLayoutContext();
const styles = useStyles();
const theme = useTheme();

const readme = frontMatter(activeVersion.readme);

Expand All @@ -17,35 +17,34 @@ export default function TemplateDocsPage() {
<title>{pageTitle(`${template.name} · Documentation`)}</title>
</Helmet>

<div className={styles.markdownSection} id="readme">
<div className={styles.readmeLabel}>README.md</div>
<div className={styles.markdownWrapper}>
<div
css={{
background: theme.palette.background.paper,
border: `1px solid ${theme.palette.divider}`,
borderRadius: theme.shape.borderRadius,
}}
id="readme"
>
<div
css={{
color: theme.palette.text.secondary,
fontWeight: 600,
padding: theme.spacing(2, 3),
borderBottom: `1px solid ${theme.palette.divider}`,
}}
>
README.md
</div>
<div
css={{
padding: theme.spacing(0, 3, 5),
maxWidth: 800,
margin: "auto",
}}
>
<MemoizedMarkdown>{readme.body}</MemoizedMarkdown>
</div>
</div>
</>
);
}

export const useStyles = makeStyles((theme) => {
return {
markdownSection: {
background: theme.palette.background.paper,
border: `1px solid ${theme.palette.divider}`,
borderRadius: theme.shape.borderRadius,
},

readmeLabel: {
color: theme.palette.text.secondary,
fontWeight: 600,
padding: theme.spacing(2, 3),
borderBottom: `1px solid ${theme.palette.divider}`,
},

markdownWrapper: {
padding: theme.spacing(0, 3, 5),
maxWidth: 800,
margin: "auto",
},
};
});