Skip to content

Commit

Permalink
testimonalsSection --> testimonalsObject
Browse files Browse the repository at this point in the history
  • Loading branch information
anemne committed Sep 25, 2024
1 parent d966881 commit 0ed5f8c
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function ImageSectionComponentPreview({
{ initial: initialData },
);

const testimonialsSection = newData
const testimonials = newData
? (newData.sections.find(
(section, index) =>
section._type === "imageSection" && index === sectionIndex,
Expand All @@ -30,7 +30,7 @@ export default function ImageSectionComponentPreview({

return (
<Suspense>
<ImageSectionComponent section={testimonialsSection} />
<ImageSectionComponent section={testimonials} />
</Suspense>
);
}
4 changes: 2 additions & 2 deletions src/components/sections/testimonials/Testimonials.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
import { RichText } from "src/components/richText/RichText";
import Text from "src/components/text/Text";
import useTabs from "src/utils/hooks/useTabs";
import { TestimonialsSection } from "studio/lib/interfaces/pages";
import { TestimonialsObject } from "studio/lib/interfaces/pages";

import { RenderImage } from "./RenderAvatar";
import styles from "./testimonials.module.css";

interface TestimonialsProps {
testimonials: TestimonialsSection;
testimonials: TestimonialsObject;
}

export const Testimonials = ({ testimonials }: TestimonialsProps) => {
Expand Down
10 changes: 5 additions & 5 deletions src/components/sections/testimonials/TestimonialsPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useQuery } from "@sanity/react-loader";
import { Suspense } from "react";

import { PreviewProps } from "src/types/preview";
import { PageBuilder, TestimonialsSection } from "studio/lib/interfaces/pages";
import { PageBuilder, TestimonialsObject } from "studio/lib/interfaces/pages";
import { PAGE_QUERY } from "studio/lib/queries/page";

import { Testimonials } from "./Testimonials";
Expand All @@ -19,19 +19,19 @@ export default function TestimonialsPreview({
{ initial: initialData },
);

const testimonialsSection = newData
const testimonials = newData
? (newData.sections.find(
(section, index) =>
section._type === "testimonials" && index === sectionIndex,
) as TestimonialsSection)
) as TestimonialsObject)
: (initialData.data.sections.find(
(section, index) =>
section._type === "testimonials" && index === sectionIndex,
) as TestimonialsSection);
) as TestimonialsObject);

return (
<Suspense>
<Testimonials testimonials={testimonialsSection} />
<Testimonials testimonials={testimonials} />
</Suspense>
);
}
4 changes: 2 additions & 2 deletions src/components/sections/testimonials/mockData.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import alex from "src/stories/assets/alex.jpg";
import mika from "src/stories/assets/mika.jpg";
import vince from "src/stories/assets/vince.jpg";
import { TestimonialsSection } from "studio/lib/interfaces/pages";
import { TestimonialsObject } from "studio/lib/interfaces/pages";

export const testimonialsMockData: TestimonialsSection = {
export const testimonialsMockData: TestimonialsObject = {
_type: "testimonials",
_key: "b69121269c53",
basicTitle: "Take it from our customers",
Expand Down
10 changes: 5 additions & 5 deletions src/utils/renderSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
LogoSaladObject,
PageBuilder,
Section,
TestimonialsSection,
TestimonialsObject,
} from "studio/lib/interfaces/pages";

interface SectionRendererProps {
Expand Down Expand Up @@ -113,8 +113,8 @@ const renderCallToAction = (
);
};

const renderTestimonialsSection = (
section: TestimonialsSection,
const renderTestimonials = (
section: TestimonialsObject,
sectionIndex: number,
isDraftMode: boolean,
initialData: QueryResponseInitial<PageBuilder>,
Expand Down Expand Up @@ -211,8 +211,8 @@ const SectionRenderer = ({
initialData,
);
case "testimonials":
return renderTestimonialsSection(
section as TestimonialsSection,
return renderTestimonials(
section as TestimonialsObject,
sectionIndex,
isDraftMode,
initialData,
Expand Down
2 changes: 1 addition & 1 deletion studio/lib/interfaces/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export interface CallToActionObject {
callToActions?: ILink[];
}

export interface TestimonialsSection {
export interface TestimonialsObject {
_key: string;
_type: string;
basicTitle?: string;
Expand Down

0 comments on commit 0ed5f8c

Please sign in to comment.