-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make all options in filter sidebar collapsible
- Loading branch information
Showing
6 changed files
with
256 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
...yberstorm-remix/app/commonComponents/PackageSearch/FilterMenus/CollapsibleMenu.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |
31 changes: 31 additions & 0 deletions
31
apps/cyberstorm-remix/app/commonComponents/PackageSearch/FilterMenus/CollapsibleMenu.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<details className={styles.root} open={defaultOpen}> | ||
<summary className={styles.header}> | ||
{headerTitle} | ||
<Icon inline> | ||
<FontAwesomeIcon icon={faCaretDown} /> | ||
</Icon> | ||
</summary> | ||
{children} | ||
</details> | ||
); | ||
}; | ||
|
||
CollapsibleMenu.displayName = "CollapsibleMenu"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.