-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Refactor Posts pages for small seminars * Remove unnecessary styles * Remove default padding for buttons * Add Post detail * Rename new input props * Add Markdown component for Posts * Improve Markdown for static pages * Position PostDetail properly * fix PostDetailProps * refactor Posts to use MUI Grid component * Posts structure comments * Post - minimal gap between links and date * PostDetail - fix always showing scrollbar space --------- Co-authored-by: rtrembecky <[email protected]>
- Loading branch information
1 parent
90fec87
commit eefe562
Showing
13 changed files
with
178 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import {Stack, Typography} from '@mui/material' | ||
import {FC} from 'react' | ||
|
||
import {PostMarkdown} from './PostMarkdown' | ||
|
||
type PostDetailProps = { | ||
caption: string | ||
details: string | ||
} | ||
|
||
export const PostDetail: FC<PostDetailProps> = ({caption, details}) => { | ||
return ( | ||
<Stack | ||
p={2} | ||
sx={{ | ||
border: '1rem solid black', | ||
backgroundColor: 'white', | ||
maxHeight: '60vh', | ||
overflow: 'auto', | ||
}} | ||
> | ||
<Typography variant="postTitle" textTransform="uppercase" fontStyle="italic" mb={4}> | ||
{caption} | ||
</Typography> | ||
<PostMarkdown content={details} /> | ||
</Stack> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import 'katex/dist/katex.min.css' | ||
|
||
import {FC} from 'react' | ||
import ReactMarkdown from 'react-markdown' | ||
import rehypeKatex from 'rehype-katex' | ||
import remarkGfm from 'remark-gfm' | ||
import remarkMath from 'remark-math' | ||
|
||
import {Header, MarkdownLink, Ol, Paragraph, Ul} from './PostMarkdownTexts' | ||
|
||
type PostMarkdownProps = { | ||
content: string | ||
} | ||
|
||
export const PostMarkdown: FC<PostMarkdownProps> = ({content}) => ( | ||
<ReactMarkdown | ||
remarkPlugins={[remarkGfm, remarkMath]} | ||
rehypePlugins={[rehypeKatex]} | ||
components={{ | ||
a: MarkdownLink, | ||
p: Paragraph, | ||
h1: Header, | ||
h2: Header, | ||
h3: Header, | ||
h4: Header, | ||
h5: Header, | ||
h6: Header, | ||
ol: Ol, | ||
ul: Ul, | ||
}} | ||
disallowedElements={['table']} | ||
> | ||
{content} | ||
</ReactMarkdown> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import {Typography} from '@mui/material' | ||
import {FC, ReactNode} from 'react' | ||
import {HeadingProps, OrderedListProps, ReactMarkdownProps, UnorderedListProps} from 'react-markdown/lib/ast-to-react' | ||
|
||
import {Link} from '../Clickable/Link' | ||
|
||
type MarkdownLinkProps = { | ||
children: ReactNode[] | ||
href?: string | ||
} | ||
|
||
export const MarkdownLink: FC<MarkdownLinkProps> = ({children, href}) => ( | ||
<Link href={href}> | ||
<Typography variant="postBody">{children}</Typography> | ||
</Link> | ||
) | ||
|
||
export const Ol: FC<OrderedListProps> = ({children}) => ( | ||
<Typography variant="postBody" component="ol"> | ||
{children} | ||
</Typography> | ||
) | ||
|
||
export const Ul: FC<UnorderedListProps> = ({children}) => ( | ||
<Typography variant="postBody" component="ul"> | ||
{children} | ||
</Typography> | ||
) | ||
|
||
export const Paragraph: FC<ReactMarkdownProps> = ({children}) => ( | ||
<Typography variant="postBody" mt={0.5} component="div"> | ||
{children} | ||
</Typography> | ||
) | ||
|
||
export const Header: FC<HeadingProps> = ({children}) => ( | ||
<Typography variant="postBody" mt={1} component="div" fontWeight={800}> | ||
{children} | ||
</Typography> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
import {NextPage} from 'next' | ||
|
||
import {PageLayout} from '@/components/PageLayout/PageLayout' | ||
import {Posts} from '@/components/Posts/Posts' | ||
import Page from '../strom/index' | ||
|
||
const Malynar: NextPage = () => ( | ||
<PageLayout title="Novinky" contentWidth={1}> | ||
<Posts /> | ||
</PageLayout> | ||
) | ||
const Malynar: NextPage = () => { | ||
return <Page /> | ||
} | ||
|
||
export default Malynar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
import {NextPage} from 'next' | ||
|
||
import {PageLayout} from '@/components/PageLayout/PageLayout' | ||
import {Posts} from '@/components/Posts/Posts' | ||
import Page from '../strom/index' | ||
|
||
const Matik: NextPage = () => ( | ||
<PageLayout title="Novinky" contentWidth={1}> | ||
<Posts /> | ||
</PageLayout> | ||
) | ||
const Matik: NextPage = () => { | ||
return <Page /> | ||
} | ||
|
||
export default Matik |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters