Skip to content

Commit

Permalink
feat: highlight active filters
Browse files Browse the repository at this point in the history
  • Loading branch information
fspoettel committed Jun 15, 2024
1 parent 98d7e49 commit fd21264
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/components/filters/primitives/filter-container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export function FilterContainer({
open={open}
sub={alwaysShowFilterString || !open ? filterString || "All" : undefined}
title={title}
variant={filterString && filterString !== "All" ? "active" : undefined}
>
{nonCollapsibleContent}
<CollapsibleContent>{children}</CollapsibleContent>
Expand Down
8 changes: 8 additions & 0 deletions src/components/ui/collapsible.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@
padding: 0.5rem;
border: 1px solid transparent;
border-radius: var(--rounded);

&.active {
border-color: var(--nord-6);
}
}

.collapsible[data-state="open"] {
border: 1px solid rgba(255, 255, 255, 0.05);

&.active {
border-color: var(--nord-6);
}
}

.collapsible > * + * {
Expand Down
4 changes: 3 additions & 1 deletion src/components/ui/collapsible.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type Props = Omit<CollapsibleProps, "title"> & {
sub?: React.ReactNode;
title: React.ReactNode;
header?: React.ReactNode;
variant?: "active";
};

export function Collapsible({
Expand All @@ -29,12 +30,13 @@ export function Collapsible({
sub,
title,
header,
variant,
...rest
}: Props) {
return (
<Root
{...rest}
className={clsx(css["collapsible"], className)}
className={clsx(css["collapsible"], variant && css[variant], className)}
onOpenChange={onOpenChange}
open={open}
>
Expand Down
3 changes: 3 additions & 0 deletions src/pages/deck-create/deck-create-choose-investigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Filters } from "@/components/filters/filters";
import { Button } from "@/components/ui/button";
import { ListLayout } from "@/layouts/list-layout";
import { useStore } from "@/store";
import { useDocumentTitle } from "@/utils/use-document-title";
import { useGoBack } from "@/utils/useBack";

import { DeckCollection } from "../browse/deck-collection/deck-collection";
Expand All @@ -16,6 +17,8 @@ function DeckCreateChooseInvestigator() {
const resetFilters = useStore((state) => state.resetFilters);
const setActiveList = useStore((state) => state.setActiveList);

useDocumentTitle("Choose investigator");

useEffect(() => {
setActiveList("create_deck");
return () => {
Expand Down
2 changes: 2 additions & 0 deletions src/pages/deck-create/deck-create.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@

.editor-nav {
padding: 0.25rem;
display: flex;
gap: 0.5rem;
}

.card-selections {
Expand Down
3 changes: 3 additions & 0 deletions src/pages/deck-create/deck-create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useEffect } from "react";
import { useParams } from "wouter";

import { useStore } from "@/store";
import { useDocumentTitle } from "@/utils/use-document-title";

import { DeckCreateInner } from "./deck-create-inner";

Expand All @@ -12,6 +13,8 @@ function DeckCreate() {
const destroy = useStore((state) => state.resetCreate);
const initialize = useStore((state) => state.initCreate);

useDocumentTitle("Create deck");

useEffect(() => {
initialize(code);
return () => {
Expand Down
6 changes: 4 additions & 2 deletions src/pages/deck-view/deck-view.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
grid-template-areas:
"header"
"sidebar"
"description"
"decklist";

padding-bottom: 1rem;
Expand All @@ -16,7 +15,6 @@
grid-template-columns: 24rem 1fr;
grid-template-areas:
"sidebar header"
"sidebar description"
"sidebar decklist";
grid-template-rows: min-content min-content 1fr;
}
Expand All @@ -36,6 +34,10 @@

.content {
grid-area: decklist;

& > * + * {
margin-top: 1rem;
}
}

.floating {
Expand Down
1 change: 0 additions & 1 deletion src/pages/deck-view/sidebar/sidebar.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
flex-flow: row wrap;
gap: 1rem;
list-style: none;
margin-top: 1rem;
}

.detail {
Expand Down

0 comments on commit fd21264

Please sign in to comment.