diff --git a/apps/cyberstorm-remix/app/commonComponents/PackageSearch/FilterMenus/CategoryMenu.tsx b/apps/cyberstorm-remix/app/commonComponents/PackageSearch/FilterMenus/CategoryMenu.tsx index 75e17ab3a..4b24faf4d 100644 --- a/apps/cyberstorm-remix/app/commonComponents/PackageSearch/FilterMenus/CategoryMenu.tsx +++ b/apps/cyberstorm-remix/app/commonComponents/PackageSearch/FilterMenus/CategoryMenu.tsx @@ -23,44 +23,40 @@ export const CategoryMenu = (props: Props) => { const toggleCategory = (id: string) => setCategories(toggle(categories, id)); - return ( -
-

Categories

- - {categories.length ? ( -
    - {categories.map((c) => ( -
  1. -
  2. + -
  3. - ))} -
- ) : ( -

No categories

- )} -
- ); + + + + + + + {c.name} + + + ))} + + ); + } else { + return

No categories

; + } }; CategoryMenu.displayName = "CategoryMenu"; diff --git a/apps/cyberstorm-remix/app/commonComponents/PackageSearch/FilterMenus/CollapsibleMenu.module.css b/apps/cyberstorm-remix/app/commonComponents/PackageSearch/FilterMenus/CollapsibleMenu.module.css new file mode 100644 index 000000000..3004478a4 --- /dev/null +++ b/apps/cyberstorm-remix/app/commonComponents/PackageSearch/FilterMenus/CollapsibleMenu.module.css @@ -0,0 +1,95 @@ +.root { + display: flex; + flex-direction: column; + font-size: var(--font-size--m); +} + +.header, +.empty { + padding: var(--space--8) var(--space--12); + font-weight: var(--font-weight-boldest); + font-size: var(--font-size--l); +} + +.header { + display: flex; + justify-content: space-between; +} + +.list { + list-style: none; +} + +.label { + display: flex; + gap: var(--gap--12); + align-items: center; + padding: var(--space--8) var(--space--12); + border-radius: var(--border-radius--8); + color: var(--color-text--secondary); + font-weight: var(--font-weight-bold); + cursor: pointer; + transition: var(--animation-length-xs); + user-select: none; + + --mark-color: var(--color-purple--6); +} + +.label:hover { + background-color: var(--color-surface--4); + + --mark-color: var(--color-purple--2); +} + +.checkbox { + width: var(--space--18); + height: var(--space--18); + border-radius: var(--border-radius--2); + background-color: var(--mark-color); + transition: ease-out var(--animation-length-xs); +} + +.label:hover .checkbox { --mark-color: #4343a3; } + +.label.include, +.label.include .checkbox { + color: var(--color-highlight); + + --mark-color: var(--color-highlight); +} + +.label.exclude, +.label.exclude .checkbox { + color: var(--color-danger); + + --mark-color: var(--color-danger); +} + +.icon { + height: var(--space--16); + color: var(--color-surface--0); +} + +.radio { + display: flex; + align-items: center; + justify-content: center; + width: var(--space--16); + height: var(--space--16); + border: var(--space--2) solid var(--color-surface--7); + border-radius: var(--border-radius--8); + background-color: transparent; + transition: ease-out var(--animation-length-xs); +} + +.radio.radioSelected { + border-color: var(--mark-color); +} + +.radioIndicator { + display: block; + width: var(--space--6); + height: var(--space--6); + border-radius: 50%; + background-color: var(--mark-color); +} diff --git a/apps/cyberstorm-remix/app/commonComponents/PackageSearch/FilterMenus/CollapsibleMenu.tsx b/apps/cyberstorm-remix/app/commonComponents/PackageSearch/FilterMenus/CollapsibleMenu.tsx new file mode 100644 index 000000000..76e30be37 --- /dev/null +++ b/apps/cyberstorm-remix/app/commonComponents/PackageSearch/FilterMenus/CollapsibleMenu.tsx @@ -0,0 +1,31 @@ +import { PropsWithChildren } from "react"; +import { faCaretDown } from "@fortawesome/free-solid-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import styles from "./CollapsibleMenu.module.css"; +import { Icon } from "@thunderstore/cyberstorm"; + +interface Props extends PropsWithChildren { + headerTitle: string; + defaultOpen?: boolean; +} + +/** + * Wrapper for making a menu collapsible + */ +export const CollapsibleMenu = (props: Props) => { + const { headerTitle, defaultOpen, children } = props; + + return ( +
+ + {headerTitle} + + + + + {children} +
+ ); +}; + +CollapsibleMenu.displayName = "CollapsibleMenu"; diff --git a/apps/cyberstorm-remix/app/commonComponents/PackageSearch/FilterMenus/OthersMenu.tsx b/apps/cyberstorm-remix/app/commonComponents/PackageSearch/FilterMenus/OthersMenu.tsx index 55863b205..a05a294e8 100644 --- a/apps/cyberstorm-remix/app/commonComponents/PackageSearch/FilterMenus/OthersMenu.tsx +++ b/apps/cyberstorm-remix/app/commonComponents/PackageSearch/FilterMenus/OthersMenu.tsx @@ -24,35 +24,31 @@ export const OthersMenu = (props: Props) => { ]; return ( -
-

Other filters

- -
    - {filters.map(([checked, setChecked, label]) => ( -
  1. -
  2. + -
  3. - ))} -
-
+ + + + + + + {label} + + + ))} + ); }; diff --git a/apps/cyberstorm-remix/app/commonComponents/PackageSearch/FilterMenus/SectionMenu.tsx b/apps/cyberstorm-remix/app/commonComponents/PackageSearch/FilterMenus/SectionMenu.tsx index 5638c6b40..24200b314 100644 --- a/apps/cyberstorm-remix/app/commonComponents/PackageSearch/FilterMenus/SectionMenu.tsx +++ b/apps/cyberstorm-remix/app/commonComponents/PackageSearch/FilterMenus/SectionMenu.tsx @@ -17,37 +17,29 @@ interface Props { export const SectionMenu = (props: Props) => { const { allSections, selected, setSelected } = props; - if (!allSections.length) { - return null; - } - return ( -
-

Sections

- - - {allSections.map((s) => ( - -
+ + + {s.name} + + ))} + ); }; diff --git a/apps/cyberstorm-remix/app/commonComponents/PackageSearch/PackageSearch.tsx b/apps/cyberstorm-remix/app/commonComponents/PackageSearch/PackageSearch.tsx index 4bf0ba466..10d7155ba 100644 --- a/apps/cyberstorm-remix/app/commonComponents/PackageSearch/PackageSearch.tsx +++ b/apps/cyberstorm-remix/app/commonComponents/PackageSearch/PackageSearch.tsx @@ -20,6 +20,7 @@ import { useNavigation, useSearchParams } from "@remix-run/react"; import { StalenessIndicator } from "@thunderstore/cyberstorm/src/components/StalenessIndicator/StalenessIndicator"; import { PackageCount } from "./PackageCount"; import { PackageOrder, PackageOrderOptions } from "./PackageOrder"; +import { CollapsibleMenu } from "./FilterMenus/CollapsibleMenu"; const PER_PAGE = 20; @@ -184,47 +185,61 @@ export function PackageSearch(props: Props) { />
-
-
-

Updated

- setUpdatedAfter(e.target.value)} - /> - setUpdatedBefore(e.target.value)} - /> -
-
-

Created

- setCreatedAfter(e.target.value)} +
+ +
+

Updated

+ setUpdatedAfter(e.target.value)} + /> + setUpdatedBefore(e.target.value)} + /> +
+
+

Created

+ setCreatedAfter(e.target.value)} + /> + setCreatedBefore(e.target.value)} + /> +
+
+ + {allSections.length > 0 ? ( + + + + ) : null} + + + - setCreatedBefore(e.target.value)} + + + + -
- - - - - +