Skip to content

Commit

Permalink
Fix markdown weird paragraphs when combined with a stack
Browse files Browse the repository at this point in the history
  • Loading branch information
limdingwen committed Jul 29, 2024
1 parent 0fd15dc commit 599ca86
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
5 changes: 4 additions & 1 deletion site/src/app/components/DebateSpeechCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import StandardCardDescription from "@/app/components/StandardCardDescription";
import Markdown from "react-markdown";
import React from "react";
import { Text } from "@mantine/core";
import StandardMarkdown from "./StandardMarkdown";

function formatProcText(content: string) {
return content
Expand All @@ -27,7 +28,9 @@ export default function DebateSummary({
</>
) : (
<Text size="sm" component="div">
<Markdown>{formatProcText(debateSpeech.content)}</Markdown>
<StandardMarkdown>
{formatProcText(debateSpeech.content)}
</StandardMarkdown>
</Text>
)}
</StandardCard>
Expand Down
4 changes: 2 additions & 2 deletions site/src/app/components/DebateSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import StandardCard from "@/app/components/StandardCard";
import StandardCardTitle from "@/app/components/StandardCardTitle";
import StandardCardDescription from "@/app/components/StandardCardDescription";
import { Stack } from "@mantine/core";
import Markdown from "react-markdown";
import SummaryAiDisclaimer from "@/app/components/SummaryAiDisclaimer";
import SummaryNotAvailableApology from "@/app/components/SummaryNotAvailableApology";
import React from "react";
import StandardMarkdown from "@/app/components/StandardMarkdown";

export default function DebateSummary({
debate,
Expand All @@ -19,7 +19,7 @@ export default function DebateSummary({
<StandardCardDescription>
{debate.summary ? (
<Stack>
<Markdown>{debate.summary}</Markdown>
<StandardMarkdown>{debate.summary}</StandardMarkdown>
<SummaryAiDisclaimer />
</Stack>
) : (
Expand Down
4 changes: 2 additions & 2 deletions site/src/app/components/ShortBill.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Badge, Group, Stack } from "@mantine/core";
import moment from "moment/moment";
import Markdown from "react-markdown";
import SummaryAiDisclaimer from "@/app/components/SummaryAiDisclaimer";
import StandardCard from "@/app/components/StandardCard";
import StandardCardTitle from "@/app/components/StandardCardTitle";
import StandardCardDescription from "@/app/components/StandardCardDescription";
import SummaryNotAvailableApology from "@/app/components/SummaryNotAvailableApology";
import StandardButton from "@/app/components/StandardButton";
import BillOriginalPdfButton from "@/app/components/BillOriginalPdfButton";
import StandardMarkdown from "./StandardMarkdown";

function flipBillNo(billNo: string) {
const [billOfYear, year] = billNo.split("/");
Expand Down Expand Up @@ -47,7 +47,7 @@ export default async function ShortBill({
<StandardCardDescription>
{bill.summary ? (
<Stack>
<Markdown>{bill.summary}</Markdown>
<StandardMarkdown>{bill.summary}</StandardMarkdown>
<SummaryAiDisclaimer />
</Stack>
) : (
Expand Down
4 changes: 2 additions & 2 deletions site/src/app/components/ShortDebate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { Group, Stack } from "@mantine/core";
import StandardCardTitle from "@/app/components/StandardCardTitle";
import moment from "moment";
import StandardCardDescription from "@/app/components/StandardCardDescription";
import Markdown from "react-markdown";
import SummaryAiDisclaimer from "@/app/components/SummaryAiDisclaimer";
import SummaryNotAvailableApology from "@/app/components/SummaryNotAvailableApology";
import StandardButton from "@/app/components/StandardButton";
import StandardCard from "@/app/components/StandardCard";
import StandardCardSubtitle from "@/app/components/StandardCardSubtitle";
import StandardMarkdown from "@/app/components/StandardMarkdown";

export default function ShortDebate({
debate,
Expand Down Expand Up @@ -38,7 +38,7 @@ export default function ShortDebate({
<StandardCardDescription>
{debate.summary ? (
<Stack>
<Markdown>{debate.summary}</Markdown>
<StandardMarkdown>{debate.summary}</StandardMarkdown>
<SummaryAiDisclaimer />
</Stack>
) : (
Expand Down
11 changes: 11 additions & 0 deletions site/src/app/components/StandardMarkdown.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Markdown from "react-markdown";
import { Box } from "@mantine/core";
import React from "react";

export default function StandardMarkdown({ children }: { children: string }) {
return (
<Box>
<Markdown>{children}</Markdown>
</Box>
);
}

0 comments on commit 599ca86

Please sign in to comment.