button-component #29

Merged
stne3960 merged 22 commits from button-component into main 2025-12-12 11:52:31 +01:00
Owner

Button component.
Addressing issues #15 and #16

Button component. Addressing issues #15 and #16
stne3960 added 5 commits 2025-11-30 17:38:56 +01:00
stne3960 added the
Code Review
Design Review
labels 2025-11-30 17:43:50 +01:00
stne3960 added 1 commit 2025-12-01 10:47:48 +01:00
Merge branch 'main' into button-component
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 5m26s
617492a87f
stne3960 added 1 commit 2025-12-01 13:16:39 +01:00
Add component library to index, until routing is fixed
Some checks failed
Deploy to branch.dsv.su.se / deploy (pull_request) Failing after 33s
f2a5cd9d26
stne3960 added 1 commit 2025-12-01 13:18:14 +01:00
Remove import
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 4m4s
32376bf9ac
Author
Owner
Can be viewed on: https://studentportalen-button-component.branch.dsv.su.se/
Owner

Feedback:

  • Use correct font
  • cursor: pointer;-css on hover
  • There should be no "on click" styling - now the buttons get focus-styling when clicked.
  • The icon-only variant is missing. But maybe this should be a separate component? What do you think?
  • Focus-outline width (I updated Figma overview to include this)
Feedback: - [x] Use correct font - [x] `cursor: pointer;`-css on hover - [x] There should be no "on click" styling - now the buttons get focus-styling when clicked. - [x] The icon-only variant is missing. But maybe this should be a separate component? What do you think? - [x] Focus-outline width (I updated Figma overview to include this)
jare2473 requested review from jare2473 2025-12-02 10:00:43 +01:00
stne3960 added 2 commits 2025-12-02 13:44:01 +01:00
Add correct font
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 4m9s
5f9e62569d
stne3960 added 1 commit 2025-12-02 14:08:36 +01:00
Add text styles
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 5m42s
69cb86d417
stne3960 added 1 commit 2025-12-02 14:09:11 +01:00
Reconverted fonts
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 3m30s
f37e55f34d
jare2473 refused to review 2025-12-02 14:09:15 +01:00
stne3960 added 1 commit 2025-12-02 14:55:03 +01:00
Fix borders and text style, run prettier
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 3m27s
ed7fb36745
stne3960 requested review from jare2473 2025-12-02 15:01:20 +01:00
Owner

Looks good! I will make icon-only button as a separate component and issue.

Looks good! I will make icon-only button as a separate component and issue.
jare2473 approved these changes 2025-12-02 16:40:47 +01:00
stne3960 removed the
Design Review
label 2025-12-03 22:59:35 +01:00
stne3960 added 2 commits 2025-12-09 18:00:00 +01:00
Fix font issues
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 3m50s
eba4e13cc8
ansv7779 requested changes 2025-12-10 17:06:34 +01:00
Dismissed
ansv7779 left a comment
Owner

Functionally it looks good and does what one would expect when using it.

Couple of points about code clarity.

I also see we need to add a workflow for Prettier checking.

Functionally it looks good and does what one would expect when using it. Couple of points about code clarity. I also see we need to add a workflow for Prettier checking.
@ -0,0 +11,4 @@
const variantClasses: Record<ButtonVariant, string> = {
primary:
"bg-primary text-base-canvas border border-primary hover:bg-secondary hover:text-base-canvas hover:border hover:border-primary focus-visible:bg-base-canvas focus-visible:text-base-ink-strong focus-visible:border focus-visible:border-primary focus-visible:outline focus-visible:outline-[length:var(--border-width-lg)] focus-visible:outline-sky-100",
Owner

This is unwieldy. Any way to break it down or group them somehow? Like the border styles, focus styles, colors, and so on.

Is it necessary to repeat the prefix or can you do something like hover:[a, b, c] instead of hover:a hover:b hover:c?

This is unwieldy. Any way to break it down or group them somehow? Like the border styles, focus styles, colors, and so on. Is it necessary to repeat the prefix or can you do something like `hover:[a, b, c]` instead of `hover:a hover:b hover:c`?
stne3960 marked this conversation as resolved
@ -0,0 +46,4 @@
sizeClasses[size],
className,
]
.filter(Boolean)
Owner

What does this do? I assume it does some JavaScript type-coercion of strings/undefined/null to booleans but what about the empty string? Needs a clarification comment.

My initial read through of the code, none of the strings in the list should be null or undefined and joining an empty string shouldn't matter much.

What does this do? I assume it does some JavaScript type-coercion of strings/`undefined`/`null` to booleans but what about the empty string? Needs a clarification comment. My initial read through of the code, none of the strings in the list should be `null` or `undefined` and joining an empty string shouldn't matter much.
Author
Owner

You're right that the current implementation passes only non-empty strings, so .filter(Boolean) doesn't change behavior today.

The reason it's useful is as soon as someone adds conditional classes or optional props (e.g. isDisabled && "opacity-50 cursor-not-allowed"), it's easy for the array to end up containing false, undefined, or empty strings. Without filtering, those values can end up in the final className and produce a noisy DOM.

Using .filter(Boolean) keeps the class string clean no matter how the component evolves. I'll add a short comment explaining this so future contributors understand the intent.

You're right that the current implementation passes only non-empty strings, so `.filter(Boolean)` doesn't change behavior today. The reason it's useful is as soon as someone adds conditional classes or optional props (e.g. `isDisabled && "opacity-50 cursor-not-allowed"`), it's easy for the array to end up containing false, undefined, or empty strings. Without filtering, those values can end up in the final className and produce a noisy DOM. Using `.filter(Boolean)` keeps the class string clean no matter how the component evolves. I'll add a short comment explaining this so future contributors understand the intent.
stne3960 marked this conversation as resolved
@ -1,11 +1,259 @@
@import "tailwindcss";
Owner

Needs to be ran through Prettier.

Needs to be ran through Prettier.
stne3960 marked this conversation as resolved
@ -0,0 +2,4 @@
import Button from '../components/Button/Button';
export default function ComponentLibrary() {
const [darkMode, setDarkMode] = useState(() => {
Owner

This file needs to be ran through Prettier.

This file needs to be ran through Prettier.
stne3960 marked this conversation as resolved
@ -1,7 +1,8 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import { defineConfig } from 'vite';
Owner

This file needs to be ran through Prettier.

This file needs to be ran through Prettier.
stne3960 marked this conversation as resolved
stne3960 added 2 commits 2025-12-11 16:04:41 +01:00
Make class list more readable and add comment
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 3m51s
18275043d6
stne3960 added 1 commit 2025-12-11 16:29:57 +01:00
Tailwind 4 doesnt support tailwindcss-variant-group
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 5m53s
77f849b75c
stne3960 added 1 commit 2025-12-11 16:31:03 +01:00
Add comment
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 3m40s
102511f366
stne3960 added 2 commits 2025-12-11 17:41:16 +01:00
Use clsx for classes
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 3m44s
3368565fb1
stne3960 added 1 commit 2025-12-11 18:18:54 +01:00
Move dependencies
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 3m39s
Remove branch deployment from branch.dsv.su.se / cleanup (pull_request) Successful in 9s
4904694a6f
ansv7779 approved these changes 2025-12-12 10:31:29 +01:00
stne3960 merged commit 4dc1b3f4c2 into main 2025-12-12 11:52:31 +01:00
stne3960 deleted branch button-component 2025-12-12 11:52:32 +01:00
stne3960 referenced this issue from a commit 2025-12-12 11:52:32 +01:00
stne3960 removed the
Code Review
label 2025-12-16 17:59:52 +01:00
Sign in to join this conversation.
No Reviewers
No Milestone
No project
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DMC/studentportalen#29
No description provided.