diff --git a/src/components/common/Style.tsx b/src/components/common/Style.tsx new file mode 100644 index 00000000..0830d78b --- /dev/null +++ b/src/components/common/Style.tsx @@ -0,0 +1,24 @@ +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 ( + + ) +} diff --git a/src/components/site/SiteLayout.tsx b/src/components/site/SiteLayout.tsx index 7bbabfbf..12e95d6d 100644 --- a/src/components/site/SiteLayout.tsx +++ b/src/components/site/SiteLayout.tsx @@ -4,10 +4,10 @@ import React, { useEffect } from "react" import { useAccountState } from "@crossbell/connect-kit" import { BlockchainInfo } from "~/components/common/BlockchainInfo" +import { Style } from "~/components/common/Style" import { useUserRole } from "~/hooks/useUserRole" import { IS_PROD } from "~/lib/constants" import { OUR_DOMAIN, SITE_URL } from "~/lib/env" -import { toGateway } from "~/lib/ipfs-parser" import { getUserContentsUrl } from "~/lib/user-contents" import { cn } from "~/lib/utils" import { useCheckLike, useCheckMint, useGetPage } from "~/queries/page" @@ -91,16 +91,7 @@ export const SiteLayout: React.FC = ({ icon={getUserContentsUrl(site.data?.avatars?.[0])} site={domainOrSubdomain} /> - {site?.data?.css && ( - - )} +