From 1585505c3b98bd10a5256625aea26491060c9a5a Mon Sep 17 00:00:00 2001 From: Jake Coble Date: Thu, 5 Dec 2024 11:07:00 -0500 Subject: [PATCH] Add missing components --- src/components/organisms/bookGrid.tsx | 40 +++++++++++++++++++++++ src/components/organisms/bookList.tsx | 38 +++++++++++++++++++++ src/components/organisms/bookSelector.tsx | 9 +++++ src/components/organisms/chapterGrid.tsx | 29 ++++++++++++++++ 4 files changed, 116 insertions(+) create mode 100644 src/components/organisms/bookGrid.tsx create mode 100644 src/components/organisms/bookList.tsx create mode 100644 src/components/organisms/bookSelector.tsx create mode 100644 src/components/organisms/chapterGrid.tsx diff --git a/src/components/organisms/bookGrid.tsx b/src/components/organisms/bookGrid.tsx new file mode 100644 index 000000000..57352341a --- /dev/null +++ b/src/components/organisms/bookGrid.tsx @@ -0,0 +1,40 @@ +import clsx from 'clsx'; +import React from 'react'; + +import { PassageNavigationFragment } from './__generated__/passageNavigation'; +import ChapterGrid from './chapterGrid'; +import styles from './passageNavigation.module.scss'; + +type Props = { + books: Array; + selectedBook: string | number | null; + selectBook: (id: string | number | null) => void; +}; + +export default function BookGrid({ books, selectedBook, selectBook }: Props) { + return ( + + ); +} diff --git a/src/components/organisms/bookList.tsx b/src/components/organisms/bookList.tsx new file mode 100644 index 000000000..a7ab35609 --- /dev/null +++ b/src/components/organisms/bookList.tsx @@ -0,0 +1,38 @@ +import clsx from 'clsx'; +import React from 'react'; + +import { PassageNavigationFragment } from './__generated__/passageNavigation'; +import ChapterGrid from './chapterGrid'; +import styles from './passageNavigation.module.scss'; + +type Props = { + books: Array; + selectedBook: string | number | null; + selectBook: (id: string | number | null) => void; +}; + +export default function BookList({ books, selectedBook, selectBook }: Props) { + return ( +
    + {books.map((book) => { + const chapters = book.recordings.nodes; + + return ( + <> +
  • + +
  • + {book.id === selectedBook && chapters && ( + + )} + + ); + })} +
+ ); +} diff --git a/src/components/organisms/bookSelector.tsx b/src/components/organisms/bookSelector.tsx new file mode 100644 index 000000000..b069fd9c0 --- /dev/null +++ b/src/components/organisms/bookSelector.tsx @@ -0,0 +1,9 @@ +import React from 'react'; + +import { PassageNavigationFragment } from './__generated__/passageNavigation'; + +type Props = { + books: Array; +}; + +export default function BookSelector({ books }: Props) {} diff --git a/src/components/organisms/chapterGrid.tsx b/src/components/organisms/chapterGrid.tsx new file mode 100644 index 000000000..99d02d770 --- /dev/null +++ b/src/components/organisms/chapterGrid.tsx @@ -0,0 +1,29 @@ +import React from 'react'; + +import Link from '~components/atoms/linkWithoutPrefetch'; + +import { PassageNavigationFragment } from './__generated__/passageNavigation'; +import styles from './passageNavigation.module.scss'; + +type Chapter = NonNullable[0]; + +type Props = { + chapters: Array; +}; + +export default function ChapterGrid({ chapters }: Props) { + return ( +
  • +
      + {chapters?.map((chapter) => { + const n = Number(chapter.title.split(' ').pop()); + return ( +
    • + {n} +
    • + ); + })} +
    +
  • + ); +}