From e000312c83dd69d19b5fc1f884adad09dd25b748 Mon Sep 17 00:00:00 2001 From: Hsu Zhong Jun <27919917+dcshzj@users.noreply.github.com> Date: Tue, 23 Jul 2024 14:51:16 +0800 Subject: [PATCH] chore: remove props only used in classic from schema (#344) --- .../components/src/interfaces/complex/InfoCards.ts | 6 +++--- .../components/src/interfaces/complex/InfoCols.ts | 3 +-- .../components/src/interfaces/complex/Infobar.ts | 10 ++-------- .../components/src/interfaces/complex/Infopic.ts | 13 ++++--------- 4 files changed, 10 insertions(+), 22 deletions(-) diff --git a/packages/components/src/interfaces/complex/InfoCards.ts b/packages/components/src/interfaces/complex/InfoCards.ts index 638ac3c71..5cbbe1e64 100644 --- a/packages/components/src/interfaces/complex/InfoCards.ts +++ b/packages/components/src/interfaces/complex/InfoCards.ts @@ -35,8 +35,6 @@ export const SingleCardSchema = Type.Object({ export const InfoCardsSchema = Type.Object( { type: Type.Literal("infocards", { default: "infocards" }), - // TODO: Remove this property, only used in classic theme - sectionIdx: Type.Optional(Type.Number()), variant: Type.Union([Type.Literal("side"), Type.Literal("top")], { title: "Infocards variant", description: "The variant of the infocards component to use", @@ -66,4 +64,6 @@ export const InfoCardsSchema = Type.Object( ) export type SingleCardProps = Static -export type InfoCardsProps = Static +export type InfoCardsProps = Static & { + sectionIdx?: number // TODO: Remove this property, only used in classic theme +} diff --git a/packages/components/src/interfaces/complex/InfoCols.ts b/packages/components/src/interfaces/complex/InfoCols.ts index 41970d8f6..c575e9301 100644 --- a/packages/components/src/interfaces/complex/InfoCols.ts +++ b/packages/components/src/interfaces/complex/InfoCols.ts @@ -41,8 +41,6 @@ export const InfoBoxSchema = Type.Object({ export const InfoColsSchema = Type.Object( { type: Type.Literal("infocols", { default: "infocols" }), - // TODO: Remove this property, only used in classic theme - sectionIdx: Type.Optional(Type.Number()), title: Type.String({ title: "Infocols title", description: "The title of the Infocols component", @@ -84,5 +82,6 @@ export const InfoColsSchema = Type.Object( ) export type InfoColsProps = Static & { + sectionIdx?: number // TODO: Remove this property, only used in classic theme LinkComponent?: any // Next.js link } diff --git a/packages/components/src/interfaces/complex/Infobar.ts b/packages/components/src/interfaces/complex/Infobar.ts index 496006175..aa5a26ef5 100644 --- a/packages/components/src/interfaces/complex/Infobar.ts +++ b/packages/components/src/interfaces/complex/Infobar.ts @@ -4,18 +4,10 @@ import { Type } from "@sinclair/typebox" export const InfobarSchema = Type.Object( { type: Type.Literal("infobar", { default: "infobar" }), - // TODO: Remove this property, only used in classic theme - sectionIdx: Type.Optional(Type.Number()), title: Type.String({ title: "Infobar title", description: "The title of the infobar", }), - subtitle: Type.Optional( - Type.String({ - title: "Infobar subtitle", - description: "The subtitle of the infobar", - }), - ), description: Type.Optional( Type.String({ title: "Infobar content", @@ -53,5 +45,7 @@ export const InfobarSchema = Type.Object( ) export type InfobarProps = Static & { + sectionIdx?: number // TODO: Remove this property, only used in classic theme + subtitle?: string // Subtitle that is only used in the classic theme LinkComponent?: any // Next.js link } diff --git a/packages/components/src/interfaces/complex/Infopic.ts b/packages/components/src/interfaces/complex/Infopic.ts index 7eaeccf03..bfab5ff05 100644 --- a/packages/components/src/interfaces/complex/Infopic.ts +++ b/packages/components/src/interfaces/complex/Infopic.ts @@ -4,18 +4,10 @@ import { Type } from "@sinclair/typebox" export const InfopicSchema = Type.Object( { type: Type.Literal("infopic", { default: "infopic" }), - // TODO: Remove this property, only used in classic theme - sectionIndex: Type.Optional(Type.Number()), title: Type.String({ title: "Infopic title", description: "The title of the Infopic component", }), - subtitle: Type.Optional( - Type.String({ - title: "Infopic subtitle", - description: "The subtitle of the Infopic component", - }), - ), description: Type.Optional( Type.String({ title: "Infopic description", @@ -65,4 +57,7 @@ export const InfopicSchema = Type.Object( }, ) -export type InfopicProps = Static +export type InfopicProps = Static & { + sectionIndex?: number // TODO: Remove this property, only used in classic theme + subtitle?: string // Subtitle that is only used in the classic theme +}