-
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.
- Loading branch information
1 parent
5176d32
commit b4bc8d4
Showing
17 changed files
with
1,735 additions
and
202 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
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,38 @@ | ||
import Markdown from "react-markdown"; | ||
|
||
import rehypeRaw from "rehype-raw"; | ||
import remarkGfm from "remark-gfm"; | ||
|
||
import { cn } from "@/lib/utils"; | ||
import { omit } from "lodash-es"; | ||
|
||
type RichTextProps = { | ||
children: string | undefined | null; | ||
className?: string; | ||
}; | ||
|
||
const RichText = ({ children, className }: RichTextProps) => { | ||
return ( | ||
<Markdown | ||
components={{ | ||
a: (props) => ( | ||
<a {...omit(props, "node")} target="_blank" className="underline"> | ||
{props.children} | ||
</a> | ||
), | ||
ol: (props) => ( | ||
<ol {...omit(props, "node")} className="ml-4 list-decimal"> | ||
{props.children} | ||
</ol> | ||
), | ||
}} | ||
className={cn("space-y-2", className)} | ||
remarkPlugins={[[remarkGfm, { singleTilde: false }]]} | ||
rehypePlugins={[rehypeRaw]} | ||
> | ||
{children} | ||
</Markdown> | ||
); | ||
}; | ||
|
||
export default RichText; |
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,40 @@ | ||
"use client"; | ||
import RichText from "@/components/ui/rich-text"; | ||
import { useTranslations } from "@/i18n"; | ||
import { DefaultCitationsComponent } from "@/types/generated/strapi.schemas"; | ||
|
||
type DatsetInfoProps = { | ||
info?: string; | ||
citations?: DefaultCitationsComponent[]; | ||
}; | ||
|
||
const DatasetInfo = ({ citations, info }: DatsetInfoProps) => { | ||
const t = useTranslations(); | ||
return ( | ||
<div className="space-y-4"> | ||
<div> | ||
<RichText>{info}</RichText> | ||
</div> | ||
{!!citations?.length && ( | ||
<div className="space-y-2 text-sm"> | ||
<h3 className="font-medium">{t("Dataset reference")}</h3> | ||
{citations.map((citation) => ( | ||
<div className="text-xs" key={citation.id}> | ||
<h4>{citation?.name}</h4> | ||
<a | ||
href={citation?.url} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
className="underline" | ||
> | ||
{citation?.url} | ||
</a> | ||
</div> | ||
))} | ||
</div> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default DatasetInfo; |
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
Oops, something went wrong.