Custom Description
} + />, + ); + expect(screen.getByText("Custom Description")).toBeInTheDocument(); + }); +}); diff --git a/src/components/composite/Catalog/CatalogCard.tsx b/src/components/composite/Catalog/CatalogCard.tsx new file mode 100644 index 0000000..98badf4 --- /dev/null +++ b/src/components/composite/Catalog/CatalogCard.tsx @@ -0,0 +1,103 @@ +import { useMemo, useState, JSX } from "react"; +import { Button } from "react-aria-components"; + +import type { PressEvent } from "react-aria"; +import styles from "./CatalogCard.module.css"; +import { convertDateToUTCString, truncateText } from "../../../utils"; +import { BaseCatalog, IndicatorTag } from "./types"; + +export interface CatalogCardProps extends BaseCatalog { + onBrowsePress?: (e: PressEvent) => void; + maxDescriptionLength?: number; + renderDescription?: (description: string) => JSX.Element; +} + +const MAX_LENGTH = 250; + +const Tag = ({ indicatorTag }: { indicatorTag: IndicatorTag }) => ( ++ {description}{" "} + {initialDescription.length > maxDescriptionLength && ( + + )} +
+ ); + + return ( +{dateRange}
+{description}
+ ), + }, +}; diff --git a/src/stories/CatalogList.stories.tsx b/src/stories/CatalogList.stories.tsx new file mode 100644 index 0000000..7f2450b --- /dev/null +++ b/src/stories/CatalogList.stories.tsx @@ -0,0 +1,51 @@ +import type { Meta, StoryObj } from "@storybook/react"; + +import { CatalogList, type BaseCatalog } from "../components/composite/Catalog"; + +const meta = { + title: "Composite/CatalogList", + component: CatalogList, +} satisfies Meta