Skip to content

Investigate migrating XBuilder frontend styling to Tailwind CSS#2986

Draft
nighca wants to merge 1 commit intogoplus:devfrom
nighca:issue-2981
Draft

Investigate migrating XBuilder frontend styling to Tailwind CSS#2986
nighca wants to merge 1 commit intogoplus:devfrom
nighca:issue-2981

Conversation

@nighca
Copy link
Collaborator

@nighca nighca commented Mar 26, 2026

close #2981

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses the investigation into adopting Tailwind CSS for the XBuilder frontend. It includes a comprehensive assessment document that evaluates the feasibility and impact of such a migration, ultimately recommending a cautious, incremental hybrid strategy. The changes also lay the groundwork for this strategy by integrating Tailwind CSS into the build system and refactoring a selection of UI components to utilize Tailwind's utility-first approach, thereby providing a practical pilot for future adoption.

Highlights

  • Tailwind CSS Migration Assessment: A new document has been added detailing an investigation into migrating XBuilder frontend styling to Tailwind CSS. The assessment concludes that a full migration is not a good near-term tradeoff, recommending an incremental hybrid approach instead.
  • Tailwind CSS Integration: Tailwind CSS and its Vite plugin have been added as development dependencies, and the necessary configurations have been applied in vite.config.ts and main.ts to integrate Tailwind into the spx-gui project.
  • Component Styling Refactoring: Several Vue components and pages, including CenteredWrapper.vue, CourseSeriesItem.vue, TutorialsBanner.vue, and various sign-in and tutorial pages, have been refactored to replace scoped SCSS with Tailwind utility classes, demonstrating the recommended hybrid approach.
  • Custom Tailwind Utilities and Theme Mapping: A new tailwind.css file has been introduced to define custom Tailwind utilities and map existing UI design tokens, ensuring consistency with the project's current styling system.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request integrates Tailwind CSS into the spx-gui frontend, including adding new dependencies, configuring Vite, and introducing a dedicated tailwind.css file for custom theme variables and utilities. Several Vue components have been refactored to replace their SCSS styling with Tailwind utility classes. The review feedback highlights opportunities to improve the Tailwind implementation by adopting more idiomatic practices, such as using responsive utility classes directly in templates for dynamic widths and refining the Tailwind theme variable definitions for font sizes and line-heights to align with standard conventions.

Comment on lines 1 to +33
<script setup lang="ts">
import { computed } from 'vue'
import { useResponsive } from '@/components/ui'

// different size of centered-content for different pages
type Size = 'medium' | 'large'

withDefaults(
const props = withDefaults(
defineProps<{
size?: Size
}>(),
{
size: 'medium'
}
)
</script>

<style scoped lang="scss">
@import '@/components/ui/responsive';
const isDesktopLarge = useResponsive('desktop-large')

.centered {
position: relative;
margin-left: auto;
margin-right: auto;
const width = computed(() => {
if (props.size === 'large') return isDesktopLarge.value ? '1492px' : '1240px'
return isDesktopLarge.value ? '1240px' : '988px'
})

&.size-medium {
width: 988px;
@include responsive(desktop-large) {
width: 1240px;
}
}
const centeredStyle = computed(() => ({
width: width.value
}))
</script>

&.size-large {
width: 1240px;
@include responsive(desktop-large) {
width: 1492px;
}
}
}
</style>
<template>
<section class="relative mx-auto self-center" :style="centeredStyle">
<slot></slot>
</section>
</template>

Choose a reason for hiding this comment

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

medium

While this refactoring successfully removes the SCSS, it introduces styling logic into the <script> section and uses inline styles. A more idiomatic Tailwind CSS approach would be to use responsive utility classes directly in the template.

This would involve:

  1. Defining your custom desktop-large breakpoint in your Tailwind configuration (tailwind.css or tailwind.config.js).
  2. Using dynamic classes in the template to apply the correct widths based on screen size and the size prop.

This keeps your styling declarative and closer to the HTML structure, which is one of the main benefits of Tailwind CSS.

Here's how you could configure the breakpoint in tailwind.css:

@theme {
  /* ... other theme settings */
  --breakpoint-desktop-large: 1680px;
}

And here is a suggested implementation for this component:

<script setup lang="ts">
import { computed } from 'vue'

// different size of centered-content for different pages
type Size = 'medium' | 'large'

const props = withDefaults(
  defineProps<{ 
    size?: Size
  }>(),
  {
    size: 'medium'
  }
)

const sizeClasses = computed(() => {
  if (props.size === 'large') {
    return 'w-[1240px] desktop-large:w-[1492px]'
  }
  return 'w-[988px] desktop-large:w-[1240px]'
})
</script>

<template>
  <section class="relative mx-auto self-center" :class="sizeClasses">
    <slot></slot>
  </section>
</template>

Comment on lines +16 to +19
--text-ui-15: 15px;
--text-ui-15--line-height: 1.5;
--text-ui-20: 20px;
--text-ui-20--line-height: 1.5;

Choose a reason for hiding this comment

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

medium

The theme variables for font sizes should be prefixed with --font-size-, not --text-. Also, defining line-height separately with a --text-*-line-height variable is not a standard Tailwind practice and likely won't work as expected. It's better to define the font size and its default line-height together in a tuple.

This makes your utility classes more concise. Instead of needing to add a separate class for line-height, you can just use text-ui-15 and have both properties applied.

Suggested change
--text-ui-15: 15px;
--text-ui-15--line-height: 1.5;
--text-ui-20: 20px;
--text-ui-20--line-height: 1.5;
--font-size-ui-15: [15px, 1.5];
--font-size-ui-20: [20px, 1.5];

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.

Investigate migrating XBuilder frontend styling to Tailwind CSS

1 participant