Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11,740 changes: 5,049 additions & 6,691 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
"@solidjs/testing-library": "^0.8.10",
"@testing-library/jest-dom": "^6.6.2",
"@testing-library/user-event": "^14.5.2",
"@vitest/ui": "3.0.5",
"@vitest/ui": "^3.2.6",
"jsdom": "^25.0.1",
"solid-js": "^1.9.3",
"typescript": "^5.6.3",
"vinxi": "^0.5.7",
"vite": "^6.0.0",
"vite-plugin-pwa": "^1.0.2",
"vite-plugin-solid": "^2.11.6",
"vitest": "3.0.5",
"vitest": "^3.2.6",
"workbox-window": "^7.3.0"
},
"dependencies": {
Expand Down
89 changes: 0 additions & 89 deletions src/components/FilterDrawer/FilterDrawer.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -84,95 +84,6 @@
padding: var(--space-6);
}

.section {
margin-bottom: var(--space-6);
}

.section:last-child {
margin-bottom: 0;
}

.sectionTitle {
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--color-neutral-400);
margin: 0 0 var(--space-2) 0;
}

.checkboxGroup {
display: flex;
flex-direction: column;
gap: 0;
}

.checkboxLabel {
display: flex;
align-items: center;
gap: var(--space-3);
cursor: pointer;
padding: var(--space-2) var(--space-2);
margin: 0 calc(-1 * var(--space-2));
border-radius: var(--radius-md);
transition: background-color 0.15s;
}

.checkboxLabel:hover {
background-color: var(--color-neutral-50);
}

.checkbox {
appearance: none;
-webkit-appearance: none;
width: 18px;
height: 18px;
border: 1.5px solid var(--color-neutral-300);
border-radius: 4px;
cursor: pointer;
position: relative;
flex-shrink: 0;
transition: all 0.15s ease;
background-color: white;
}

.checkbox:hover {
border-color: var(--color-neutral-400);
}

.checkbox:checked {
background-color: var(--color-neutral-900);
border-color: var(--color-neutral-900);
}

.checkbox:checked::after {
content: "";
position: absolute;
left: 5px;
top: 2px;
width: 5px;
height: 9px;
border: solid white;
border-width: 0 2px 2px 0;
transform: rotate(45deg);
}

.checkbox:focus {
outline: none;
box-shadow: 0 0 0 2px var(--color-neutral-200);
}

.checkboxText {
font-size: var(--text-sm);
color: var(--color-neutral-700);
font-weight: 400;
line-height: 1.4;
}

.checkboxLabel:hover .checkboxText {
color: var(--color-neutral-900);
}

.footer {
padding: var(--space-6);
border-top: 1px solid var(--color-neutral-200);
Expand Down
100 changes: 14 additions & 86 deletions src/components/FilterDrawer/FilterDrawer.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Drawer from "@corvu/drawer";
import { type Component, For } from "solid-js";
import type { DifficultyFilter, DifficultyValue } from "~/constants/difficultyOptions";
import { difficultyOptions, tagOptions, timeOptions } from "~/constants/filterOptions";
import { strings } from "~/constants/strings";
import type { TagFilter, TagValue } from "~/constants/tagOptions";
import type { TimeFilter, TimeValue } from "~/constants/timeOptions";
import type { Component } from "solid-js";
import type { DifficultyFilter } from "~/constants/difficultyOptions.ts";
import { strings } from "~/constants/strings.ts";
import type { TagFilter } from "~/constants/tagOptions.ts";
import type { TimeFilter } from "~/constants/timeOptions.ts";
import FilterPanel from "../FilterPanel/FilterPanel.jsx";
import styles from "./FilterDrawer.module.css";

type FilterDrawerProps = {
Expand All @@ -20,30 +20,6 @@ type FilterDrawerProps = {
};

const FilterDrawer: Component<FilterDrawerProps> = (props) => {
const handleDifficultyToggle = (value: DifficultyValue) => {
const current = props.difficultyFilter;
const newFilter = current.includes(value)
? current.filter((v) => v !== value)
: [...current, value];
props.onDifficultyChange(newFilter as DifficultyFilter);
};

const handleTimeToggle = (value: TimeValue) => {
const current = props.timeFilter;
const newFilter = current.includes(value)
? current.filter((v) => v !== value)
: [...current, value];
props.onTimeChange(newFilter as TimeFilter);
};

const handleTagToggle = (value: TagValue) => {
const current = props.tagFilter;
const newFilter = current.includes(value)
? current.filter((v) => v !== value)
: [...current, value];
props.onTagChange(newFilter as TagFilter);
};

const hasAnyFilter = () =>
props.difficultyFilter.length > 0 || props.timeFilter.length > 0 || props.tagFilter.length > 0;

Expand All @@ -67,62 +43,14 @@ const FilterDrawer: Component<FilterDrawerProps> = (props) => {
</div>

<div class={styles.sections}>
<div class={styles.section}>
<h3 class={styles.sectionTitle}>{strings.filters.difficulty}</h3>
<div class={styles.checkboxGroup}>
<For each={difficultyOptions}>
{(option) => (
<label class={styles.checkboxLabel}>
<input
type="checkbox"
checked={props.difficultyFilter.includes(option.value)}
onChange={() => handleDifficultyToggle(option.value)}
class={styles.checkbox}
/>
<span class={styles.checkboxText}>{option.label}</span>
</label>
)}
</For>
</div>
</div>

<div class={styles.section}>
<h3 class={styles.sectionTitle}>{strings.filters.time}</h3>
<div class={styles.checkboxGroup}>
<For each={timeOptions}>
{(option) => (
<label class={styles.checkboxLabel}>
<input
type="checkbox"
checked={props.timeFilter.includes(option.value)}
onChange={() => handleTimeToggle(option.value)}
class={styles.checkbox}
/>
<span class={styles.checkboxText}>{option.label}</span>
</label>
)}
</For>
</div>
</div>

<div class={styles.section}>
<h3 class={styles.sectionTitle}>{strings.filters.tags}</h3>
<div class={styles.checkboxGroup}>
<For each={tagOptions}>
{(option) => (
<label class={styles.checkboxLabel}>
<input
type="checkbox"
checked={props.tagFilter.includes(option.value)}
onChange={() => handleTagToggle(option.value)}
class={styles.checkbox}
/>
<span class={styles.checkboxText}>{option.label}</span>
</label>
)}
</For>
</div>
</div>
<FilterPanel
difficultyFilter={props.difficultyFilter}
timeFilter={props.timeFilter}
tagFilter={props.tagFilter}
onDifficultyChange={props.onDifficultyChange}
onTimeChange={props.onTimeChange}
onTagChange={props.onTagChange}
/>
</div>

{hasAnyFilter() && (
Expand Down
91 changes: 91 additions & 0 deletions src/components/FilterPanel/FilterPanel.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
.panel {
display: flex;
flex-direction: column;
gap: var(--space-6);
}

.section {
display: flex;
flex-direction: column;
}

.sectionTitle {
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--color-neutral-400);
margin: 0 0 var(--space-2) 0;
}

.checkboxGroup {
display: flex;
flex-direction: column;
gap: 0;
}

.checkboxLabel {
display: flex;
align-items: center;
gap: var(--space-3);
cursor: pointer;
padding: var(--space-2) var(--space-2);
margin: 0 calc(-1 * var(--space-2));
border-radius: var(--radius-md);
transition: background-color 0.15s;
}

.checkboxLabel:hover {
background-color: var(--color-neutral-50);
}

.checkbox {
appearance: none;
-webkit-appearance: none;
width: 18px;
height: 18px;
border: 1.5px solid var(--color-neutral-300);
border-radius: 4px;
cursor: pointer;
position: relative;
flex-shrink: 0;
transition: all 0.15s ease;
background-color: white;
}

.checkbox:hover {
border-color: var(--color-neutral-400);
}

.checkbox:checked {
background-color: var(--color-neutral-900);
border-color: var(--color-neutral-900);
}

.checkbox:checked::after {
content: "";
position: absolute;
left: 5px;
top: 2px;
width: 5px;
height: 9px;
border: solid white;
border-width: 0 2px 2px 0;
transform: rotate(45deg);
}

.checkbox:focus {
outline: none;
box-shadow: 0 0 0 2px var(--color-neutral-200);
}

.checkboxText {
font-size: var(--text-sm);
color: var(--color-neutral-700);
font-weight: 400;
line-height: 1.4;
}

.checkboxLabel:hover .checkboxText {
color: var(--color-neutral-900);
}
Loading
Loading