From d23fcafc94d71ce0577f772cfd7a7e7deffc9f64 Mon Sep 17 00:00:00 2001 From: Ashley Date: Tue, 12 Nov 2024 13:36:27 -0500 Subject: [PATCH] Cookbook Landing Page Front End (#53073) --- src/landings/components/CategoryLanding.tsx | 41 +++++----- .../components/CookBookArticleCard.tsx | 82 +++++++++++++++++++ src/landings/components/CookBookFilter.tsx | 60 ++++++++++++++ 3 files changed, 161 insertions(+), 22 deletions(-) create mode 100644 src/landings/components/CookBookArticleCard.tsx create mode 100644 src/landings/components/CookBookFilter.tsx diff --git a/src/landings/components/CategoryLanding.tsx b/src/landings/components/CategoryLanding.tsx index 206aba4933..70e36ac760 100644 --- a/src/landings/components/CategoryLanding.tsx +++ b/src/landings/components/CategoryLanding.tsx @@ -1,16 +1,20 @@ import { useRouter } from 'next/router' import cx from 'classnames' +import { CookBookArticleCard } from './CookBookArticleCard' +import { CookBookFilter } from './CookBookFilter' -import { useCategoryLandingContext } from 'src/frame/components/context/CategoryLandingContext' +//import { useTranslation } from 'src/languages/components/useTranslation' import { DefaultLayout } from 'src/frame/components/DefaultLayout' import { ArticleTitle } from 'src/frame/components/article/ArticleTitle' import { Lead } from 'src/frame/components/ui/Lead' +import { useCategoryLandingContext } from 'src/frame/components/context/CategoryLandingContext' import { ClientSideRedirects } from 'src/rest/components/ClientSideRedirects' import { RestRedirect } from 'src/rest/components/RestRedirect' import { Breadcrumbs } from 'src/frame/components/page-header/Breadcrumbs' export const CategoryLanding = () => { const router = useRouter() + //const { t } = useTranslation('toc') const { title, intro, tocItems } = useCategoryLandingContext() // tocItems contains directories and its children, we only want the child articles @@ -28,38 +32,31 @@ export const CategoryLanding = () => { {title} - {intro && {intro}}

Spotlight

-
-
Spotlight 1
-
Spotlight 2
-
Spotlight 3
+
+ + +
-
-
+
+

Explore {onlyFlatItems.length} prompt articles

-
Searchbar
-
Category
-
Complexity
-
Industry
-
Reset
+
+ +
-
- {/* TODO: replace with card components */} +
    {onlyFlatItems.map((item, index) => ( -
    -
    -
    {item.title}
    -
    {item.intro}
    -
    -
    +
  • + +
  • ))} -
+
diff --git a/src/landings/components/CookBookArticleCard.tsx b/src/landings/components/CookBookArticleCard.tsx new file mode 100644 index 0000000000..f89bdd2824 --- /dev/null +++ b/src/landings/components/CookBookArticleCard.tsx @@ -0,0 +1,82 @@ +import { Label, LabelGroup } from '@primer/react' +import { BugIcon } from '@primer/octicons-react' + +type Props = { + title?: string + icon?: string + url?: string + description?: string + tags?: string[] + spotlight?: boolean + image?: string + complexity?: string +} + +const defaultProps = { + title: 'Article Name', + description: + 'Man bun letterpress put a bird on it la croix offal, meh grailed hot chicken kombucha gochujang messenger bag fit before they sold out lyft.', + tags: ['Tag Example', 'Tag Example'], + icon: 'bugicon', +} + +function setIcon(icon: string) { + switch (icon) { + case 'bugicon': + return + case 'none': + return null + default: + return null + } +} + +function setImage(image: string) { + return ( + //
+ image ? ( +
+ ) : null + //
+ ) +} +const spotlightClasses = 'd-flex flex-column align-items-center' +export const CookBookArticleCard = ({ + title = defaultProps.title, + icon = defaultProps.icon, + tags = defaultProps.tags, + description = defaultProps.description, + image = '', + spotlight = false, +}: Props) => { + return ( +
+
+ {spotlight ? setImage(image) : null} + {spotlight ? setIcon('none') : setIcon(icon)} +
+

{title}

+
{description}
+ + {tags.map((tag, index) => ( + //fix this to have unique keys + ))} + +
+
+
+ ) +} diff --git a/src/landings/components/CookBookFilter.tsx b/src/landings/components/CookBookFilter.tsx new file mode 100644 index 0000000000..82c1c6c985 --- /dev/null +++ b/src/landings/components/CookBookFilter.tsx @@ -0,0 +1,60 @@ +import { TextInput, ActionMenu, ActionList, Button } from '@primer/react' +import { SearchIcon } from '@primer/octicons-react' + +export const CookBookFilter = () => { + return ( + <> +
+ +
+
+ + + Category + + + + Item 1 + Item 2 + Item 3 + + + + + + + Complexity + + + + Item 1 + Item 2 + Item 3 + + + + + + + Industry + + + + Item 1 + Item 2 + Item 3 + + + + +
+ + ) +}