From a338535c3d3b5fd4cf0f71c635ccf44d63201b04 Mon Sep 17 00:00:00 2001 From: anamontiaga Date: Wed, 4 Oct 2023 12:37:22 +0200 Subject: [PATCH] multiselects --- src/components/ui/multiselect.tsx | 15 +++--- src/containers/stories-page/list/index.tsx | 59 +++++++++++++++++++--- tailwind.config.js | 3 ++ 3 files changed, 62 insertions(+), 15 deletions(-) diff --git a/src/components/ui/multiselect.tsx b/src/components/ui/multiselect.tsx index 1e6d9b61..bfd280b3 100644 --- a/src/components/ui/multiselect.tsx +++ b/src/components/ui/multiselect.tsx @@ -2,13 +2,11 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react' import { Listbox, Transition } from '@headlessui/react'; import { HiCheck } from 'react-icons/hi'; +import { HiChevronDown } from 'react-icons/hi2'; -import Icon from 'components/icon'; import Loading from 'components/loading'; import { cn } from 'utils/cn'; -import ARROW_FILLED_DOWN_SVG from 'svgs/ui/arrow-filled-down.svg?sprite'; - export interface MultiSelectProps { id: string | number; className?: string; @@ -91,7 +89,7 @@ export const MultiSelect = (props: MultiSelectProps): JSX.Element => { }, [onSelect]); return ( -
+
{ {SELECTED} @@ -120,9 +117,9 @@ export const MultiSelect = (props: MultiSelectProps): JSX.Element => { iconClassName="w-3 h-3" /> - {!loading && open && } + {!loading && open && } {!loading && !open && ( - + )} @@ -138,7 +135,7 @@ export const MultiSelect = (props: MultiSelectProps): JSX.Element => { > {(batchSelectionActive || clearSelectionActive) && (
diff --git a/src/containers/stories-page/list/index.tsx b/src/containers/stories-page/list/index.tsx index 55bab966..03e38550 100644 --- a/src/containers/stories-page/list/index.tsx +++ b/src/containers/stories-page/list/index.tsx @@ -3,7 +3,6 @@ import React from 'react'; import { motion } from 'framer-motion'; import useBreakpoint from 'use-breakpoint'; -import Hero from 'containers/home/common/hero'; import StoryCard from 'containers/home/stories/list/story-card'; import SampleComposition from 'containers/home/stories/samples/sample-composition'; import Card from 'containers/home/stories/samples/sample-composition/sample-card'; @@ -12,6 +11,7 @@ import Media from 'containers/media'; import Wrapper from 'containers/wrapper'; import Button from 'components/button'; +import MultiSelect from 'components/ui/multiselect'; import { IN_VIEW_PROPS } from 'constants/motion'; import { BREAKPOINTS } from 'styles/styles.config'; @@ -20,16 +20,63 @@ import { STORIES } from './constants'; const List = () => { const { minWidth } = useBreakpoint(BREAKPOINTS, 'md'); + const STORY_TYPE_OPTIONS = [ + { value: 'Factsheets', label: 'Factsheets' }, + { value: 'News', label: 'News' }, + { value: 'Stories from the ground', label: 'Stories from the ground' }, + ]; + + const MEDIA_TYPE_OPTIONS = [ + { value: 'Article', label: 'Article' }, + { value: 'Clip', label: 'Clip' }, + { value: 'Video', label: 'Video' }, + ]; + + const COUNTRY_OPTIONS = [ + { value: 'Dominican Republic', label: 'Dominican Republic' }, + { value: 'Ghana', label: 'Ghana' }, + { value: 'Panama', label: 'Panama' }, + { value: 'Tanzania', label: 'Tanzania' }, + ]; + return ( <> -
+
-
- -
-
+
+

Filter by:

+
+
+ setFilters({ ...filters, pathways: v })} + /> +
+
+ setFilters({ ...filters, pathways: v })} + /> +
+
+ setFilters({ ...filters, pathways: v })} + /> +
+
+
{STORIES.map((s) => (
diff --git a/tailwind.config.js b/tailwind.config.js index caaf8f86..357dfe26 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -88,6 +88,9 @@ module.exports = { 200: '#FBE4C9', 400: '#F0B884', }, + cream: { + 400: '#F9F7F3', + }, forest: { 200: '#C1ECD2', 400: '#60CBA5',