From 21ef9a4567ec4f61a4d0db26f0e23815bb0f7924 Mon Sep 17 00:00:00 2001 From: Dogtiti <499960698@qq.com> Date: Thu, 25 Jul 2024 17:37:21 +0800 Subject: [PATCH] feat: artifacts style --- .gitignore | 2 ++ app/components/artifact.module.scss | 12 +++++++++ app/components/artifact.tsx | 25 +++++++++--------- app/components/markdown.tsx | 4 +-- app/components/ui-lib.module.scss | 1 + app/components/ui-lib.tsx | 39 +++++++++++++++++++++-------- 6 files changed, 58 insertions(+), 25 deletions(-) create mode 100644 app/components/artifact.module.scss diff --git a/.gitignore b/.gitignore index a24c6e047..2ff556f64 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,5 @@ dev *.key *.key.pub + +masks.json diff --git a/app/components/artifact.module.scss b/app/components/artifact.module.scss new file mode 100644 index 000000000..1e166f418 --- /dev/null +++ b/app/components/artifact.module.scss @@ -0,0 +1,12 @@ +.artifact { + display: block; + width: 100%; + height: 100%; + position: relative; +} + +.artifact-iframe { + width: 100%; + border: var(--border-in-light); + border-radius: 6px; +} diff --git a/app/components/artifact.tsx b/app/components/artifact.tsx index c06573b09..64a6ad652 100644 --- a/app/components/artifact.tsx +++ b/app/components/artifact.tsx @@ -13,6 +13,7 @@ import { Modal, showToast } from "./ui-lib"; import { copyToClipboard, downloadAs } from "../utils"; import { Path, ApiPath, REPO_URL } from "@/app/constant"; import { Loading } from "./home"; +import styles from "./artifact.module.scss"; export function HTMLPreview(props: { code: string; @@ -61,17 +62,22 @@ export function HTMLPreview(props: { return props.code + script; }, [props.code]); + const handleOnLoad = () => { + if (props?.onLoad) { + props.onLoad(title); + } + }; + return ( + onLoad={handleOnLoad} + /> ); } @@ -186,14 +192,7 @@ export function Artifact() { }, [id]); return ( -