From ca7aea976cf0177294d7d510904bb9801005c556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=ED=98=84=EC=88=98?= <54893898+junghyeonsu@users.noreply.github.com> Date: Fri, 17 Jan 2025 20:27:02 +0900 Subject: [PATCH] feat: do-dont title --- docs/app/(home)/page.tsx | 2 +- docs/components/sanity/do-dont.tsx | 8 ++++++-- docs/components/sanity/external-image.tsx | 19 ++++++++++--------- docs/components/sanity/image.tsx | 2 +- docs/components/sanity/sanity-content.tsx | 7 ++++--- docs/sanity/schemaTypes/doDontType.tsx | 22 +++++++++++++++++++++- 6 files changed, 43 insertions(+), 17 deletions(-) diff --git a/docs/app/(home)/page.tsx b/docs/app/(home)/page.tsx index 6a6be1082..32820caf2 100644 --- a/docs/app/(home)/page.tsx +++ b/docs/app/(home)/page.tsx @@ -59,7 +59,7 @@ function BlogCard({ title, description, thumbnail }: Blog) {

{title}

diff --git a/docs/components/sanity/do-dont.tsx b/docs/components/sanity/do-dont.tsx index d680ef69b..83c9bad09 100644 --- a/docs/components/sanity/do-dont.tsx +++ b/docs/components/sanity/do-dont.tsx @@ -14,6 +14,7 @@ interface ImageField { interface Section { type: "do" | "dont"; + title: string; description: string; imageField: ImageField; } @@ -44,13 +45,16 @@ export function DoDont({ value, className }: DoDontProps) { /> )}
-
+
{isDo ? ( ) : ( )} - {section.description} +
+ {section.title} + {section.description} +
); diff --git a/docs/components/sanity/external-image.tsx b/docs/components/sanity/external-image.tsx index 107d1f1ae..53c047b54 100644 --- a/docs/components/sanity/external-image.tsx +++ b/docs/components/sanity/external-image.tsx @@ -12,15 +12,16 @@ export const ExternalImage = ({ value, className }: ExternalImageProps) => { const { imageUrl, alt } = value; return ( -
-
- {alt -
+
+ {alt
); }; diff --git a/docs/components/sanity/image.tsx b/docs/components/sanity/image.tsx index 630a8a78c..97660dc2c 100644 --- a/docs/components/sanity/image.tsx +++ b/docs/components/sanity/image.tsx @@ -34,7 +34,7 @@ export const SanityImage = ({ value, className }: ImageProps) => { {value.originalFilename} diff --git a/docs/components/sanity/sanity-content.tsx b/docs/components/sanity/sanity-content.tsx index 60fce3472..8b524c175 100644 --- a/docs/components/sanity/sanity-content.tsx +++ b/docs/components/sanity/sanity-content.tsx @@ -4,13 +4,14 @@ import { PortableText } from "@portabletext/react"; import type { SanityDocument } from "next-sanity"; import { client } from "./client"; +import { ImageTextHalfPreview } from "@/components/sanity/image-text-half"; import { useEffect, useState } from "react"; import ErrorBoundary from "../error-boundary"; -import { PortableImage } from "./image"; -import { Table } from "./table"; -import { ImageTextHalfPreview } from "@/components/sanity/image-text-half"; import { DoDont } from "./do-dont"; import { ExternalImage } from "./external-image"; +import { PortableImage } from "./image"; +import { Table } from "./table"; + interface SanityGuidelineProps { title: string; } diff --git a/docs/sanity/schemaTypes/doDontType.tsx b/docs/sanity/schemaTypes/doDontType.tsx index 7d5b1b61d..0d9878ad9 100644 --- a/docs/sanity/schemaTypes/doDontType.tsx +++ b/docs/sanity/schemaTypes/doDontType.tsx @@ -20,6 +20,11 @@ export const doDontSectionType = defineType({ validation: (Rule) => Rule.required(), }, imageFieldType, // 기존 imageFieldType 재사용 + { + name: "title", + title: "제목", + type: "string", + }, { name: "description", title: "설명", @@ -50,9 +55,21 @@ export const doDontType = defineArrayMember({ secondType: "second.type", firstImage: "first.imageField.uploadImage", firstUrl: "first.imageField.externalUrl", + firstTitle: "first.title", + firstDescription: "first.description", firstImageType: "first.imageField.imageType", + secondTitle: "second.title", + secondDescription: "second.description", }, - prepare({ firstType, secondType, firstImage, firstUrl, firstImageType }) { + prepare({ + firstType, + secondType, + firstImage, + firstUrl, + firstImageType, + firstTitle, + secondTitle, + }) { const image = firstImageType === "upload" ? firstImage @@ -64,8 +81,11 @@ export const doDontType = defineArrayMember({ ? `${firstType?.toUpperCase()} & ${secondType?.toUpperCase()}` : firstType?.toUpperCase(); + const subtitle = `${firstTitle} & ${secondTitle}`; + return { title, + subtitle, media: image, }; },