in website/src/components/gallery/ShowcaseLeftFilters/index.tsx [24:160]
function ShowcaseFilterViewAll({
tags,
number,
activeTags,
selectedCheckbox,
setSelectedCheckbox,
location,
readSearchTags,
replaceSearchTags,
}: {
tags: TagType[];
number: string;
activeTags: TagType[];
selectedCheckbox: TagType[];
setSelectedCheckbox: React.Dispatch<React.SetStateAction<TagType[]>>;
location;
readSearchTags: (search: string) => TagType[];
replaceSearchTags: (search: string, newTags: TagType[]) => string;
}) {
const [openItems, setOpenItems] = React.useState(["0"]);
const handleToggle: AccordionToggleEventHandler<string> = (event, data) => {
setOpenItems(data.openItems);
};
const { colorMode } = useColorMode();
const chevronDownSmall =
colorMode != "dark" ? (
<img src={useBaseUrl("/img/smallChevron.svg")} />
) : (
<img src={useBaseUrl("/img/smallChevronDark.svg")} />
);
const chevronUpSmall =
colorMode != "dark" ? (
<img
style={{ transform: "rotate(180deg)" }}
src={useBaseUrl("/img/smallChevron.svg")}
/>
) : (
<img
style={{ transform: "rotate(180deg)" }}
src={useBaseUrl("/img/smallChevronDark.svg")}
/>
);
let value = number + "2";
return (
<>
{tags.slice(0, 6).map((tag, index) => {
const tagObject = Tags[tag];
const key = `showcase_checkbox_key_${tag}`;
const id = `showcase_checkbox_id_${tag}`;
return index == tags.length - 1 ? (
<div
key={key}
className={styles.checkboxListItem}
style={{ marginBottom: "7px" }}
>
<ShowcaseTagSelect
id={id}
tag={tag}
label={tagObject.label}
activeTags={activeTags}
selectedCheckbox={selectedCheckbox}
setSelectedCheckbox={setSelectedCheckbox}
location={location}
readSearchTags={readSearchTags}
replaceSearchTags={replaceSearchTags}
/>
</div>
) : (
<div key={key} className={styles.checkboxListItem}>
<ShowcaseTagSelect
id={id}
tag={tag}
label={tagObject.label}
activeTags={activeTags}
selectedCheckbox={selectedCheckbox}
setSelectedCheckbox={setSelectedCheckbox}
location={location}
readSearchTags={readSearchTags}
replaceSearchTags={replaceSearchTags}
/>
</div>
);
})}
{tags.length > 5 ? (
<Accordion
openItems={openItems}
onToggle={handleToggle}
multiple
collapsible
>
<AccordionItem value={value} style={{ padding: "0px" }}>
<AccordionPanel style={{ margin: "0px" }}>
{tags.slice(6, tags.length).map((tag) => {
const tagObject = Tags[tag];
const key = `showcase_checkbox_key_${tag}`;
const id = `showcase_checkbox_id_${tag}`;
return (
<div key={key} className={styles.checkboxListItem}>
<ShowcaseTagSelect
id={id}
tag={tag}
label={tagObject.label}
activeTags={activeTags}
selectedCheckbox={selectedCheckbox}
setSelectedCheckbox={setSelectedCheckbox}
location={location}
readSearchTags={readSearchTags}
replaceSearchTags={replaceSearchTags}
/>
</div>
);
})}
</AccordionPanel>
<AccordionHeader
inline={true}
expandIconPosition="end"
expandIcon={
openItems.includes(value) ? chevronUpSmall : chevronDownSmall
}
>
<div
style={{
fontSize: "12px",
}}
className={styles.color}
>
View All
</div>
</AccordionHeader>
</AccordionItem>
</Accordion>
) : null}
</>
);
}