Skip to content

Commit 45a6d70

Browse files
committed
Retire SinglerowCardSwiper
1 parent 8a7af51 commit 45a6d70

3 files changed

Lines changed: 21 additions & 68 deletions

File tree

src/components/BookGroup.tsx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@ import {
1515
IBasicBookInfo,
1616
} from "../connection/LibraryQueryHooks";
1717
import { BookCard, useBookCardSpec } from "./BookCard";
18-
import { SingleRowCardSwiper } from "./SingleRowCardSwiper";
1918
import { useResponsiveChoice } from "../responsiveUtilities";
2019
import { BookOrderingScheme } from "../model/ContentInterfaces";
20+
import { CardSwiperLazy } from "./CardSwiper";
2121

2222
interface IProps {
2323
title: string;
2424
order?: string;
2525
// I don't know... this could be "bookLimit" instead "rows". Have to think in terms
2626
// of mobile versus big screen.... hmmm...
27+
// Warning: if rows is 1 or unspecified, BookGroup shows a swiper row; this does not seem to be
28+
// working well at least in our stories, but it is not used in the real website as of Sep 2022.
2729
rows?: number;
2830

2931
contextLangIso?: string;
@@ -172,10 +174,24 @@ export const BookGroupInner: React.FunctionComponent<IProps> = (props) => {
172174
// );
173175
// }
174176

175-
// JH Jan 2020: I cannot find anywhere that this is showInOne Row is used.
176-
// It's also puzzling that it has to have its own CardSwiper implementation.
177+
// JT Sep 2022: showInOneRow is true only when BookGroup is either told to show exactly one row, or
178+
// not told how many rows to show. Currently this happens only in the various stories which were written
179+
// early on to test it; the only real use of BookGroup is in ByLanguageGroups, which passes 999.
180+
// When I tried the stories in Sep 2022, they were working very badly: showing a set of cards
181+
// with no spacing. I wanted to retire the obsolete SingleRowCardSwiper, so I switched this rather crudely
182+
// to use our current CardSwiperLazy. This looks a bit better but the book cards are not getting their
183+
// images. Since this currently only shows up in test stories that we don't seem to be using, I decided
184+
// not to try to fix it.
185+
const cardSpec = useBookCardSpec();
177186
const bookList = showInOneRow ? (
178-
<SingleRowCardSwiper wrapperRole="list">{cards}</SingleRowCardSwiper>
187+
<CardSwiperLazy
188+
data={cards}
189+
getReactElement={(x) => x}
190+
wrapperRole="list"
191+
cardSpec={cardSpec}
192+
>
193+
{cards}
194+
</CardSwiperLazy>
179195
) : (
180196
<div
181197
css={css`

src/components/ByLanguageGroups.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ export const ByLanguageGroups: React.FunctionComponent<{
4141
titlePrefix: string;
4242
collection: ICollection;
4343
reportBooksAndLanguages?: (bookCount: number, langCount: number) => void;
44-
rowsPerLanguage?: number;
4544
// Sometimes it's nice to drop English, in particular.
4645
excludeLanguages?: string[];
4746
}> = (props) => {
@@ -195,7 +194,7 @@ export const ByLanguageGroups: React.FunctionComponent<{
195194
}`}
196195
predeterminedBooks={books}
197196
contextLangIso={l.isoCode}
198-
rows={props.rowsPerLanguage ?? 999}
197+
rows={999}
199198
/>
200199
);
201200
})}

src/components/SingleRowCardSwiper.tsx

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

0 commit comments

Comments
 (0)