diff --git a/src/components/Button.tsx b/src/components/Button.tsx new file mode 100644 index 0000000..31ae773 --- /dev/null +++ b/src/components/Button.tsx @@ -0,0 +1,18 @@ +type ButtonProps = { + className?: string; + children: React.ReactChild | React.ReactChild[]; +}; + +export default function Button(props: ButtonProps): JSX.Element { + return ( +
+ {props.children} +
+ ); +} diff --git a/src/components/Chip.tsx b/src/components/Chip.tsx new file mode 100644 index 0000000..11cb5be --- /dev/null +++ b/src/components/Chip.tsx @@ -0,0 +1,18 @@ +type ChipProps = { + className?: string; + children: React.ReactChild | React.ReactChild[]; +}; + +export default function Chip(props: ChipProps): JSX.Element { + return ( +
+ {props.children} +
+ ); +} diff --git a/src/components/HorizontalLine.tsx b/src/components/HorizontalLine.tsx new file mode 100644 index 0000000..6a31f67 --- /dev/null +++ b/src/components/HorizontalLine.tsx @@ -0,0 +1,17 @@ +type HorizontalLineProps = { + className?: string; +}; + +export default function HorizontalLine( + props: HorizontalLineProps +): JSX.Element { + return ( +
+ ); +} diff --git a/src/components/PanelComponents/PanelHeader.tsx b/src/components/PanelComponents/PanelHeader.tsx index 480e2db..25e4df1 100644 --- a/src/components/PanelComponents/PanelHeader.tsx +++ b/src/components/PanelComponents/PanelHeader.tsx @@ -1,3 +1,5 @@ +import HorizontalLine from "components/HorizontalLine"; + type NavOptionProps = { icon?: string; title: string; @@ -14,7 +16,7 @@ export default function PanelHeader(props: NavOptionProps): JSX.Element { )}

{props.title}

{props.description ?

{props.description}

: ""} -
+ ); } diff --git a/src/components/PanelComponents/ReturnButton.tsx b/src/components/PanelComponents/ReturnButton.tsx index fcdfd44..c23a3ae 100644 --- a/src/components/PanelComponents/ReturnButton.tsx +++ b/src/components/PanelComponents/ReturnButton.tsx @@ -1,3 +1,4 @@ +import Button from "components/Button"; import Link from "next/link"; type ReturnButtonProps = { @@ -8,7 +9,7 @@ type ReturnButtonProps = { export default function ReturnButton(props: ReturnButtonProps): JSX.Element { return ( - + ); } diff --git a/src/components/Panels/MainPanel.tsx b/src/components/Panels/MainPanel.tsx index 5e8b80a..2039e35 100644 --- a/src/components/Panels/MainPanel.tsx +++ b/src/components/Panels/MainPanel.tsx @@ -2,31 +2,37 @@ import Link from "next/link"; import NavOption from "components/PanelComponents/NavOption"; import SVG from "components/SVG"; import { useRouter } from "next/router"; +import Button from "components/Button"; +import HorizontalLine from "components/HorizontalLine"; export default function MainPanel(): JSX.Element { const router = useRouter(); return ( -
+
-
- + +
- -
+
+
- + {router.locale ? ( + + ) : ( + "" + )}

Accord’s Library

-
+ -
+ @@ -57,7 +63,7 @@ export default function MainPanel(): JSX.Element { -
+

diff --git a/src/components/Panels/SubPanel.tsx b/src/components/Panels/SubPanel.tsx index 8bf6a77..2c9b96b 100644 --- a/src/components/Panels/SubPanel.tsx +++ b/src/components/Panels/SubPanel.tsx @@ -4,7 +4,7 @@ type SubPanelProps = { export default function SubPanel(props: SubPanelProps): JSX.Element { return ( -

+
{props.children}
); diff --git a/src/graphql/operation.graphql b/src/graphql/operation.graphql index 4b601c5..c5344cb 100644 --- a/src/graphql/operation.graphql +++ b/src/graphql/operation.graphql @@ -103,9 +103,7 @@ query getLibraryItemsPreview($language_code: String) { } query getLibraryItemsSlugs { - libraryItems( - pagination: { limit: -1 } - ) { + libraryItems(pagination: { limit: -1 }) { data { attributes { slug @@ -114,7 +112,6 @@ query getLibraryItemsSlugs { } } - query getLibraryItem($slug: String, $language_code: String) { libraryItems(filters: { slug: { eq: $slug } }) { data { @@ -305,12 +302,45 @@ query getLibraryItem($slug: String, $language_code: String) { } categories { data { + id attributes { name short } } } + scan_set { + data { + id + attributes { + slug + } + } + } + text_set { + data { + id + attributes { + slug + } + } + } + audio_set { + data { + id + attributes { + slug + } + } + } + video_set { + data { + id + attributes { + slug + } + } + } range { __typename ... on ComponentRangePageRange { diff --git a/src/graphql/operations-types.ts b/src/graphql/operations-types.ts index 7a62b6f..3a0f6f5 100644 --- a/src/graphql/operations-types.ts +++ b/src/graphql/operations-types.ts @@ -460,6 +460,7 @@ export type GetLibraryItemQuery = { __typename: "CategoryRelationResponseCollection"; data: Array<{ __typename: "CategoryEntity"; + id: string; attributes: { __typename: "Category"; name: string; @@ -467,6 +468,38 @@ export type GetLibraryItemQuery = { }; }>; }; + scan_set: { + __typename: "ScanSetEntityResponse"; + data: { + __typename: "ScanSetEntity"; + id: string; + attributes: { __typename: "ScanSet"; slug: string }; + }; + }; + text_set: { + __typename: "TextSetEntityResponse"; + data: { + __typename: "TextSetEntity"; + id: string; + attributes: { __typename: "TextSet"; slug: string }; + }; + }; + audio_set: { + __typename: "AudioSetEntityResponse"; + data: { + __typename: "AudioSetEntity"; + id: string; + attributes: { __typename: "AudioSet"; slug: string }; + }; + }; + video_set: { + __typename: "VideoSetEntityResponse"; + data: { + __typename: "VideoSetEntity"; + id: string; + attributes: { __typename: "VideoSet"; slug: string }; + }; + }; range: Array< | { __typename: "ComponentRangePageRange"; @@ -488,4 +521,4 @@ export type GetLibraryItemQuery = { }; }>; }; -}; +}; \ No newline at end of file diff --git a/src/graphql/operations.ts b/src/graphql/operations.ts index 219b447..9a8ec10 100644 --- a/src/graphql/operations.ts +++ b/src/graphql/operations.ts @@ -5,6 +5,10 @@ import { GetChronologyItemsQueryVariables, GetErasQuery, GetErasQueryVariables, + GetLibraryContentQuery, + GetLibraryContentQueryVariables, + GetLibraryContentsSlugsQuery, + GetLibraryContentsSlugsQueryVariables, GetLibraryItemQuery, GetLibraryItemQueryVariables, GetLibraryItemsPreviewQuery, @@ -77,4 +81,4 @@ export async function getLibraryItem( ): Promise { const query = getQueryFromOperations("getLibraryItem"); return await graphQL(query, JSON.stringify(variables)); -} +} \ No newline at end of file diff --git a/src/pages/chronology/overview.tsx b/src/pages/chronology/overview.tsx index 6e0d5d9..058464e 100644 --- a/src/pages/chronology/overview.tsx +++ b/src/pages/chronology/overview.tsx @@ -10,6 +10,7 @@ import { import { getEras, getChronologyItems } from "graphql/operations"; import NavOption from "components/PanelComponents/NavOption"; import ReturnButton from "components/PanelComponents/ReturnButton"; +import HorizontalLine from "components/HorizontalLine"; interface Props { chronologyItems: GetChronologyItemsQuery; @@ -41,7 +42,7 @@ export default function ChronologyOverview(props: Props): JSX.Element { <> -
+ {props.chronologyEras.chronologyEras.data.map((era) => ( { + if ( + a.attributes.range[0].__typename === "ComponentRangePageRange" && + b.attributes.range[0].__typename === "ComponentRangePageRange" + ) { + return ( + a.attributes.range[0].starting_page - + b.attributes.range[0].starting_page + ); + } + return 0; + }); + return ( <> -
+ @@ -92,7 +107,7 @@ export default function Library(props: Props): JSX.Element { href={`/library/${libraryItem.attributes.subitem_of.data[0].attributes.slug}`} passHref > - +
) : ( "" )} -
+

{libraryItem.attributes.title}

{libraryItem.attributes.subtitle ? (

@@ -225,21 +240,42 @@ export default function Library(props: Props): JSX.Element {
{libraryItem.attributes.contents.data.map((content) => (
-

{content.attributes.title[0].title}

-

-

-

- {content.attributes.range[0].__typename === - "ComponentRangePageRange" - ? content.attributes.range[0].starting_page - : ""} -

- +
+ +

{content.attributes.title[0].title}

+
+
+ {content.attributes.categories.data.map((category) => ( + + {category.attributes.short} + + ))} +
+

+

+ {content.attributes.range[0].__typename === + "ComponentRangePageRange" + ? content.attributes.range[0].starting_page + : ""} +

+ + {content.attributes.type.data.attributes.slug} + +
+
+ + subdirectory_arrow_right + + + + + + +
))}
@@ -279,7 +315,6 @@ export const getStaticPaths: GetStaticPaths = async () => { const data = await getLibraryItemsSlugs({}); const paths: Path[] = []; data.libraryItems.data.map((item) => { - console.log(item.attributes.slug); paths.push({ params: { slug: item.attributes.slug } }); }); return { diff --git a/src/tailwind.css b/src/tailwind.css index 884355e..95e43c0 100644 --- a/src/tailwind.css +++ b/src/tailwind.css @@ -8,14 +8,6 @@ @apply p-0 m-0 bg-light text-black; } - hr { - @apply h-0 w-full my-8 border-t-[3px] border-dotted border-black; - } - - button { - @apply grid place-content-center place-items-center border-[1px] border-dark text-dark rounded-full cursor-pointer px-4 py-2 transition-colors hover:text-light hover:bg-dark; - } - * { @apply box-border font-body font-medium scroll-smooth; }