Skip to content

Commit

Permalink
fix: overflow bug
Browse files Browse the repository at this point in the history
credits @amelie-schlueter for telling me
  • Loading branch information
flornkm committed Apr 12, 2024
1 parent ef37c5b commit 075239c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
11 changes: 2 additions & 9 deletions markdown/Markdown.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
export default function Markdown(props: {
class?: string
content: string
noSelect?: boolean
}) {
export default function Markdown(props: { class?: string; content: string }) {
// Regular expression pattern to capture video ID and image source
const pattern =
/<a\s+href="([A-Za-z0-9_-]{11})"\s*><img\s+src="([^"]+)"[^>]+><\/a>/g
Expand All @@ -26,10 +22,7 @@ export default function Markdown(props: {
)

return (
<article
class={props.class}
style={{ userSelect: props.noSelect ? "none" : "auto" }}
>
<article class={props.class}>
<div dangerouslySetInnerHTML={{ __html: replacedContent }}></div>
</article>
)
Expand Down
5 changes: 2 additions & 3 deletions pages/feed/index/+Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,12 @@ export default function Page({
</p>
</div>
<div class="lg:max-w-nav w-full lg:mx-auto">
<div class="relative">
<div class="relative max-h-[450px] overflow-hidden">
<Markdown
noSelect
class="post line-clamp-5"
content={content[post.slug]}
/>
<div class="absolute bottom-0 w-full z-10 pointer-events-none bg-gradient-to-b from-transparent to-light-neutral h-1/5 dark:to-black" />
<div class="absolute bottom-0 w-full z-10 bg-gradient-to-b from-transparent to-light-neutral h-1/5 dark:to-black" />
</div>
<Button type="text" link={post.url} class="mt-4 mx-auto">
{m.read_more()}
Expand Down

0 comments on commit 075239c

Please sign in to comment.