Files
xLog/src/components/common/Style.tsx
T

25 lines
482 B
TypeScript

import { toGateway } from "~/lib/ipfs-parser"
export const Style: React.FC<{
content?: string
children?: React.ReactNode[]
}> = ({ content, children }) => {
let css = content
if (!css && typeof children?.[0] === "string") {
css = children[0].trim()
}
if (!css) {
return null
}
return (
<link
type="text/css"
rel="stylesheet"
href={
"data:text/css;base64," + Buffer.from(toGateway(css)).toString("base64")
}
/>
)
}