Skip to content

Add custom Tailwind themes and a styled Button component#667

Merged
aaronxsu merged 10 commits into
developfrom
feature/asu/frontend-themes
Jun 24, 2025
Merged

Add custom Tailwind themes and a styled Button component#667
aaronxsu merged 10 commits into
developfrom
feature/asu/frontend-themes

Conversation

@aaronxsu

@aaronxsu aaronxsu commented Jun 21, 2025

Copy link
Copy Markdown
Member

Overview

This PR:

  • adds project-specific VS code settings especially for tailwind css files
  • adds custom themes based on design tokens in Figma
  • creates a styled button component and puts examples on a components page
  • updates configs to allow absolute import paths

Checklist

  • fixup! commits have been squashed
  • CHANGELOG.md updated with summary of features or fixes, following
    Keep a Changelog guidelines
  • README.md updated if necessary to reflect the changes
  • Run ./scripts/format to lint, format, and fix the application source code.
  • CI passes after rebase

Demo

Screenshot 2025-06-21 at 5 26 51 PM

Notes

I initially just wanted to define the themes based on Figma design tokens, but then noticed that a good way to test how they work would be creating a styled component, so I took the button component card and included it in the same PR. Changes are separated by commits, so they should be handy to review.

Testing Instructions

Resolves #646
Resolves #647

@aaronxsu

Copy link
Copy Markdown
Member Author

In #648, I will add leftIcon, rightIcon, and label props to the Button component to parameterize it further.

@rachelekm rachelekm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice! This is looking really good! My only initial comment is to flesh out the button variants so they align with all button style and size types in the figma system design page.

orange: "bg-orange-200 text-orange-800 hover:bg-orange-300",
},
size: {
default: "h-9 px-5 py-2 min-w-9",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Instead of default, let's make these entries "large", "medium" and "small", using their respective figma sizing properties. And then for the defaultVariants let's set size to "small" to accomodate mobile-first.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

And then for the defaultVariants let's set size to "small" to accomodate mobile-first.

I thought about it in the first round of development. But after inspecting the buttons in the mobile v.s. desktop designs, I did not find a definitive answer to this. I think maybe setting default to medium makes more sense.

Sometimes a large button is used in the mobile view, for example the finish button; And Sometimes a medium button is used in the mobile view, for example the detail button. large and medium differ in height, x-axis padding, and font size.

Screenshot 2025-06-23 at 4 22 25 PM

Screenshot 2025-06-23 at 4 23 00 PM

@aaronxsu aaronxsu Jun 23, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good observation, medium as the default seems like the way to go!

variant: {
primary: "bg-teal-800 text-white hover:bg-teal-950",
outline: "border border-gray-300 bg-transparent hover:bg-gray-100",
orange: "bg-orange-200 text-orange-800 hover:bg-orange-300",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we also add the secondary style variant?

@aaronxsu aaronxsu Jun 23, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I was wondering about that too! I saw the secondary button in the button component list, but did not get any luck finding where it is actually used in the mobile or desktop design. So I ended up removing it. I could add secondary back though.

Edit: After a closer look, I found that the "+" and "-" buttons have the same styling as secondary- going to add it back now.

@aaronxsu aaronxsu Jun 23, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks! Even if not immediately used, because we're implementing a headless library it might be helpful to implement every variant from the design system page so that if we need to add any other small UI down the road we've already got some form of cohesive styling setup

Comment thread src/frontend/src/pages/Components.tsx Outdated
List all neighborhoods
</Button>
<Button variant="outline">
<ArrowLeftIcon className="font-normal h-[18px] w-[18px] text-black" />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I saw you took out the icon sizing in the button styles but I imagine this group of icon class names would be repeated often, do you feel like it's worth keeping out for now? Looks like this would also be handled in your work for #648 so feel free to ignore!

@aaronxsu aaronxsu Jun 23, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I removed the icon size button in 4b032b9 because it was a leftover from my experiments. In the mobile or desktop designs, the icon buttons seem to have the same styling as the small, medium, and large buttons. So I suspect we do not actually need a special size for icon buttons. Please correct me if this is not the case though. e.g. those arrow buttons next to "Continue" etc

Edit: Though the "X" button that closes or deletes some stuff seems to have its own styling like below:

Screenshot 2025-06-23 at 4 53 21 PM

Screenshot 2025-06-23 at 4 53 53 PM

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

How about this: let's add back icon and only for sizing. We will use outline variant for these X buttons, and then override the background or box shadow etc in the specific places where they are used.

@aaronxsu aaronxsu Jun 23, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for clarifying I misinterpreted that icon size config thinking it affected child component sizing like ArrowLeftIcon and ArrowRightIcon. I think having a separate icon variant makes sense though!

Comment thread .vscode/settings.json
"css.validate": false,
"less.validate": false,
"scss.validate": false
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice, this will be helpful! Maybe let's also add something like the below to the .gitignore so that if anyone has their own personal vs code settings it isn't accidentally committed:

.vscode/*
!.vscode/settings.json

@aaronxsu aaronxsu Jun 23, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Comment thread src/frontend/package.json
"react-aria-components": "^1.10.1",
"react-dom": "^19.1.0",
"react-router": "^7.6.2",
"tailwind-variants": "^1.0.0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I haven't used tailwind-variants before but this is interesting and seems really helpful. Interesting that it's made by HeroUI which is one of the component libraries we thought about using and is react-aria + tailwind under the hood!

{...props}
// composeRenderProps is a utility from React Aria Components
// merging a user's className with component-specific classes.
// This correctly handles all types and states.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cool!

components: "/src/components",
pages: "/src/pages",
},
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This will be helpful, thank you!

@aaronxsu

Copy link
Copy Markdown
Member Author

@rachelekm thanks for the review and the suggestions- they are great. I addressed them and update the components page to show different sizes and variants more explicitly. Please let me know if there is any question.

Screenshot 2025-06-23 at 5 00 48 PM

@aaronxsu aaronxsu requested a review from rachelekm June 23, 2025 21:04
@aaronxsu aaronxsu force-pushed the feature/asu/bootstrap-new-frontend branch from 0d9d762 to 66dd634 Compare June 23, 2025 21:08
Base automatically changed from feature/asu/bootstrap-new-frontend to develop June 23, 2025 21:13
@aaronxsu aaronxsu force-pushed the feature/asu/frontend-themes branch from 6a32ba2 to 682d1a4 Compare June 23, 2025 21:26
@aaronxsu

Copy link
Copy Markdown
Member Author

Oh, I saw this one: Compare favorites in the design system, but did not see it in the designs for mobile or desktop. Did I miss something? Or is it removed from the designs? (I vaguely recall a mention of it, but I am not certain

Screenshot 2025-06-23 at 5 50 33 PM

@rachelekm rachelekm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks really great, on the development side this is good to go!

Documenting that we just discussed this component in a huddle and it will be implemented in upcoming work for #648 since that already includes utilizing react-aria's ButtonGroup component:

Oh, I saw this one: Compare favorites in the design system, but did not see it in the designs for mobile or desktop. Did I miss something? Or is it removed from the designs? (I vaguely recall a mention of it, but I am not certain

Screenshot 2025-06-23 at 5 50 33 PM

@philippschmitt

Copy link
Copy Markdown
Collaborator

Alright, sorry for how long this took me but hopefully things will go more quickly now that I have the project set up. Looks good overall! I pushed a few small tweaks. Good to go from my POV.

@aaronxsu aaronxsu force-pushed the feature/asu/frontend-themes branch from f37c2e2 to f22ba16 Compare June 24, 2025 16:44
@aaronxsu

Copy link
Copy Markdown
Member Author

Thank you both for the reviews and the design tweaks. I squashed my fixup commits and added a changelog entry. Will merge pending CI.

@aaronxsu aaronxsu merged commit a14227e into develop Jun 24, 2025
6 checks passed
@aaronxsu aaronxsu deleted the feature/asu/frontend-themes branch June 24, 2025 16:49
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.

Create styled button component Create initial custom tailwind theme & starter page

3 participants