Skip to content

Commit

Permalink
refactor(RichText): replace custom PortableTextBlock with proper type…
Browse files Browse the repository at this point in the history
… from sanity
  • Loading branch information
mathiazom committed Sep 18, 2024
1 parent 6e08318 commit a016ce0
Showing 1 changed file with 1 addition and 23 deletions.
24 changes: 1 addition & 23 deletions src/components/richText/RichText.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use client";

import { PortableText, PortableTextReactComponents } from "@portabletext/react";
import { PortableTextObject } from "@sanity/types";
import { ReactNode } from "react";
import { PortableTextBlock } from "sanity";

import Text from "src/components/text/Text";
import textStyles from "src/components/text/text.module.css";
Expand All @@ -11,28 +11,6 @@ import { getReactNodeTextContent } from "src/utils/reactNode";

import styles from "./richText.module.css";

type Children = {
_type: string;
marks: string[];
text: string;
_key: string;
};

export type RichTextType = "h1" | "h2" | "h3" | "normal" | "blockquote";

export type PortableTextBlock = {
children?: Children[];
_type: string;
style?: RichTextType;
_key: string;
asset?: {
_ref: string;
_type: string;
};
alt?: string;
markDefs?: PortableTextObject[];
};

const formatId = (children: ReactNode): string => {
const text = getReactNodeTextContent(children);

Expand Down

0 comments on commit a016ce0

Please sign in to comment.