Skip to content

Commit c4a3267

Browse files
committed
wip?
1 parent 66ce7b4 commit c4a3267

File tree

9 files changed

+26
-56
lines changed

9 files changed

+26
-56
lines changed

src/app/components/language-selector/language-selector.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ export function LanguageSelectorWrapper({children}: React.PropsWithChildren<Reco
6868
}
6969

7070
export default function LanguageSelector({
71-
LeadIn, otherLocales, LinkPresentation=LanguageLink, addPolish=false
71+
LeadIn, otherLocales=[], LinkPresentation=LanguageLink, addPolish=false
7272
}: {
7373
LeadIn: () => React.JSX.Element;
74-
otherLocales: string[];
75-
LinkPresentation: LinkPresentationType;
74+
otherLocales?: string[];
75+
LinkPresentation?: LinkPresentationType;
7676
addPolish?: boolean;
7777
}) {
7878
if (addPolish) {

src/app/pages/a-page-template/a-page-template.scss

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/app/pages/a-page-template/a-page-template.tsx

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/app/pages/press/page-context.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@ type FeaturedInRollup = {
77
image: string;
88
};
99

10-
// This will need more filling in as other components move to TSX
10+
export type TestimonialData = {
11+
image: {
12+
title: string;
13+
file: string;
14+
},
15+
testimonial: string;
16+
};
17+
1118
type PressPageData = {
1219
meta: object;
1320
title: string;
@@ -55,6 +62,7 @@ type PressPageData = {
5562
author: string;
5663
};
5764
};
65+
testimonials: [TestimonialData[]]
5866
};
5967

6068
function useContextValue() {

src/app/pages/press/testimonials/testimonials.tsx

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
11
import React from 'react';
2-
import usePageContext from '../page-context';
2+
import usePageContext, {TestimonialData} from '../page-context';
33
import ClippedImage from '~/components/clipped-image/clipped-image';
44
import Carousel from '~/components/carousel/carousel';
55
import './testimonials.scss';
66

7-
type ImageData = {
8-
file: string;
9-
title: string;
10-
};
11-
12-
type TestimonialData = {
13-
image?: ImageData;
14-
testimonial: string;
15-
description: string;
16-
};
17-
187
function Card({data}: {data: TestimonialData}) {
198
const {image, testimonial} = data;
209

@@ -31,14 +20,19 @@ function Card({data}: {data: TestimonialData}) {
3120
}
3221

3322
export default function Testimonials() {
34-
const {testimonials: [testimonials]} = usePageContext();
23+
const ctx = usePageContext();
24+
25+
if (!ctx) {
26+
return null;
27+
}
28+
const {testimonials: [testimonials]} = ctx;
3529

3630
return (
3731
<div className='content-block'>
3832
<h2>Making an impact</h2>
3933
<Carousel atATime={2} hoverTextThing='testimonials'>
4034
{testimonials.map((c: TestimonialData) => (
41-
<Card data={c} key={c.description} />
35+
<Card data={c} key={c.image.file} />
4236
))}
4337
</Carousel>
4438
</div>

src/app/pages/subjects/new/context.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ type SubjectsPageData = {
2626
translations: Array<{value: LocaleEntry[]}>;
2727
books?: {
2828
bookState: string;
29+
subjects: string[];
2930
}[];
3031
aboutBlurbs?: ReturnType<typeof aboutBlurbs>;
3132
heading: string;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import LanguageSelectorSection from './language-selector-section';
2+
3+
export default LanguageSelectorSection;

src/app/pages/subjects/new/subjects.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {AllSubjectsAboutOpenStax} from './about-openstax';
99
import LoadSubject from './specific/specific';
1010
import './subjects.scss';
1111

12-
const importLanguageSelector = () => import('./language-selector-section.js');
12+
const importLanguageSelector = () => import('./import-language-selector-section.js');
1313
const importSubjectsListing = () => import('./import-subjects-listing.js');
1414
const importTutorAd = () => import('./import-tutor-ad.js');
1515
const importInfoBoxes = () => import('./import-info-boxes.js');

src/app/pages/subjects/new/use-categorized-books.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function useCategorizedBooks(): CategorizedBooks {
2323
}
2424
};
2525

26-
for (const book of books) {
26+
for (const book of books ?? []) {
2727
book.subjects.forEach((cmsCategory: string) => {
2828
if (!(cmsCategory in result)) {
2929
result[cmsCategory] = [] as CategoryWithBooks;

0 commit comments

Comments
 (0)