Skip to content

[BHO-94]: add Button and Filter components - #107

Merged
cheangie merged 6 commits into
mainfrom
cheangie/button-filter-components
Nov 22, 2026
Merged

cheangie merged 6 commits into
mainfrom
cheangie/button-filter-components

Conversation

@cheangie

@cheangie cheangie commented Nov 22, 2026 •

Copy link
Copy Markdown

ℹ️ Issue

Closes #94

Uses the tokens from #68 (merged in #72) and the Chakra setup from #99.

Figma: https://www.figma.com/design/MrZxYY9J7DP0w7RWuamueg/BHO (Buttons 156:1559, Filter 528:7117, filter bar 528:7052 / 531:16311)

📝 Description

Adds a shared Button and Filter in apps/frontend/src/components/, built on Chakra primitives and styled with the CSS variables in styles/tokens.css. Like #102 and #103 there is no custom Chakra theme.

Button (wraps Chakra's Button)

  • Variants are looks, not labels: primary (Upload, Re-Upload, Refresh, Download, Submit, Add Text, Source: All), secondary (Cancel, Close), dark (Clear Filters), link (Today's Entry), ghost (icon-only Open). Callers pass the label and icons
  • Sizes md (Figma's 40px) and sm
  • leftIcon / rightIcon (decorative, aria-hidden), loading / loadingText (disabled, aria-busy, width stays stable), disabled, hover / active / focus-visible styles
  • type defaults to "button"; type="submit" passes through
  • href renders a real <a>; asChild works with a router Link. Icon-only buttons must have an aria-label (enforced by the types)
  • Variant styles live in Button/variants.ts, one entry per look

Filter (built on Chakra's Select)

  • Controlled: options, value, onChange, plus label (wired to the trigger), icon, placeholder, size, disabled, width
  • Selected option is marked (aria-selected), trigger has aria-expanded; Enter / Space / Arrows open, arrows move, Enter selects, Escape closes (from Chakra)
  • Date filter works with preset ranges. A real date-range picker is out of scope; { value, label } is the hook so Filter won't need to change

Other changes

Where this differs from the handoff: the secondary border is 1.5px and the filter radius 10px, as Figma shows. Figma's link "Clicked" color is --sea-green-600.

🔎 Needs a decision or follow-up

Values with no token in tokens.css (named in variants.ts / Filter.tsx, not hard-coded around the code):

  • Inter font for button labels (not loaded, so Arial is used)
  • 4px button radius and --color-primary-hover: only in Add UploadFile, FileRejected, Subsection and FileItem components (#76) #103, read with fallbacks so this works before and after it merges
  • 40px / 54px heights, and the sm sizes (32px button, 40px filter), which are not in Figma
  • Focus ring (--sea-green-600, no Figma design)

✔️ Verification

Screen.Recording.2026-11-22.at.3.51.05.PM.mov
$ npx vitest run   # from apps/frontend

 ✓ src/components/Button/Button.spec.tsx  (17 tests)
 ✓ src/components/Filter/Filter.spec.tsx  (10 tests)
 (plus the existing specs)

 Test Files  7 passed (7)
      Tests  43 passed (43)
$ npx nx lint frontend
 NX   Successfully ran target lint for project frontend

$ npx tsc -p tsconfig.app.json --noEmit && npx tsc -p tsconfig.spec.json --noEmit
(no errors)

$ npx nx build frontend
 NX   Successfully ran target build for project frontend

Prettier is clean. To check it yourself: npx nx serve frontend, open http://localhost:4200/design and scroll to Buttons, Filters and Filter bar and compare with the Figma frames above.

@cheangie
cheangie requested a review from Rayna-Yu as a code owner November 22, 2026 20:51
github-actions Bot added a commit that referenced this pull request Nov 22, 2026

@naman0r naman0r left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be better to stack this PR on top of my PR, #101 , or wait for it to get merged

Comment thread apps/frontend/src/app.tsx Resolved
@cheangie

Copy link
Copy Markdown
Author

note to self: Resolve issues/comments once #101 is merged and pull from main

@Rayna-Yu
Rayna-Yu removed the request for review from devluharuwalla November 22, 2026 21:30
@cheangie
cheangie force-pushed the cheangie/button-filter-components branch from 74819b6 to 0d79d41 Compare November 22, 2026 21:32
@cheangie cheangie changed the title Add Button and Filter components (#94) [BHO-94]: add Button and Filter components Nov 22, 2026
Resolve components/index.ts by keeping the exports from #102 and from this PR.
@naman0r
naman0r self-requested a review November 22, 2026 21:55

@naman0r naman0r left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed merge conflicts and addressed my initial feedback, good to merge on my end 🚢

@Rayna-Yu Rayna-Yu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

github-actions Bot added a commit that referenced this pull request Nov 22, 2026
@cheangie
cheangie merged commit 1e8ec34 into main Nov 22, 2026
5 checks passed
github-actions Bot added a commit that referenced this pull request Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dev: Button and filter component (Frontend)

3 participants