diff --git a/src/components/node/stanford-news/card.tsx b/src/components/node/stanford-news/card.tsx index c9bb5fc0..3bf21f6f 100644 --- a/src/components/node/stanford-news/card.tsx +++ b/src/components/node/stanford-news/card.tsx @@ -31,14 +31,14 @@ const StanfordNewsCard = ({node, h3Heading, ...props}: Props) => { )}
- + {node.title} {node.suNewsTopics?.[0]?.name && ( -
{node.suNewsTopics[0].name}
+
{node.suNewsTopics[0].name}
)}
diff --git a/src/components/patterns/elements/select-list.tsx b/src/components/patterns/elements/select-list.tsx index 2e35cca0..a657ba83 100644 --- a/src/components/patterns/elements/select-list.tsx +++ b/src/components/patterns/elements/select-list.tsx @@ -30,6 +30,7 @@ interface Props { multiple?: boolean disabled?: boolean value?: SelectValue + emptyLabel?: string } interface OptionProps { @@ -103,7 +104,7 @@ function CustomOption(props: OptionProps) { ) } -const SelectList = ({options, label, multiple, ariaLabelledby, ...props}: Props) => { +const SelectList = ({options, label, multiple, ariaLabelledby, emptyLabel, ...props}: Props) => { const labelId = useId() const labeledBy = ariaLabelledby ?? labelId const wrapperRef = useRef(null) @@ -171,6 +172,12 @@ const SelectList = ({options, label, multiple, ariaLabelledby, ...props}: Props) aria-labelledby={labeledBy} > + {emptyLabel && !multiple && ( + + {emptyLabel} + + )} + {options.map(option => { return ( diff --git a/src/components/views/stanford-news/filtering-news-card-view.client.tsx b/src/components/views/stanford-news/filtering-news-card-view.client.tsx index 6cadeb27..a64072e3 100644 --- a/src/components/views/stanford-news/filtering-news-card-view.client.tsx +++ b/src/components/views/stanford-news/filtering-news-card-view.client.tsx @@ -6,9 +6,8 @@ import {useCounter} from "usehooks-ts" import useServerAction from "@/lib/hooks/useServerAction" import ToggleOption from "@/components/patterns/toggle-option" import SelectList from "@/components/patterns/elements/select-list" -import {ArrowPathIcon, XMarkIcon} from "@heroicons/react/20/solid" -import {MagnifyingGlassIcon} from "@heroicons/react/24/solid" -import {SelectOptionDefinition, SelectValue} from "@mui/base/useSelect" +import {ArrowPathIcon, XMarkIcon, MagnifyingGlassIcon} from "@heroicons/react/20/solid" +import {SelectOptionDefinition} from "@mui/base/useSelect" type Props = HTMLAttributes & { /** @@ -74,69 +73,76 @@ const FilteringNewsCardViewClient = ({children, totalItems, loadPage, typeOption )}
e.preventDefault()}> -
- + Filter news +
+
+ - +
+ - {titleFilter && ( - - )} + {titleFilter && ( + + )} - -
+ +
+
-
- Filter by speciality - onDateChange("now - 30 days")} - first - > - Last 30 days - - onDateChange("now - 12 months")} - > - Last 12 months - - onDateChange(undefined)} last> - All News - -
+
+ Filter by speciality + onDateChange("now - 30 days")} + first + > + Last 30 days + + onDateChange("now - 12 months")} + > + Last 12 months + + onDateChange(undefined)} last> + All News + +
-
- onTypeChange(value as string)} />
@@ -146,7 +152,7 @@ const FilteringNewsCardViewClient = ({children, totalItems, loadPage, typeOption