Skip to content

Tailwind header mvp#590

Closed
beetz12 wants to merge 2 commits intohackgvl:developfrom
beetz12:tailwind_header_mvp
Closed

Tailwind header mvp#590
beetz12 wants to merge 2 commits intohackgvl:developfrom
beetz12:tailwind_header_mvp

Conversation

@beetz12
Copy link

@beetz12 beetz12 commented Jul 12, 2025

Summary

Begin incremental migration from Bootstrap 4 to Tailwind CSS by converting the navigation header component.
This establishes the foundation for coexistence between both frameworks while maintaining pixel-perfect
visual compatibility.

Approach

This PR implements an incremental migration strategy that allows Bootstrap and Tailwind to coexist safely:

  • Prefix-based isolation: All Tailwind classes use tw- prefix to avoid naming conflicts
  • Load order management: Bootstrap loads first, then Tailwind, with strategic !important overrides
  • Component-by-component conversion: Start with navbar, then systematically convert other components
  • Visual parity requirement: Each converted component must look identical to its Bootstrap counterpart

Changes Made

Infrastructure Setup

  • ✅ Installed Tailwind CSS with PostCSS configuration
  • ✅ Added tw- prefix to prevent Bootstrap conflicts
  • ✅ Created /resources/css/app.css with custom component layer
  • ✅ Updated Vite asset loading order in app.blade.php

Navbar Component Migration

  • ✅ Converted /resources/views/layouts/top-nav.blade.php from Bootstrap to Tailwind classes
  • ✅ Created comprehensive Tailwind component classes matching Bootstrap navbar behavior:
    • .tw-navbar, .tw-navbar-expand-md, .tw-navbar-dark
    • .tw-container-fluid, .tw-navbar-brand, .tw-navbar-toggler
    • .tw-navbar-nav, .tw-nav-link, .tw-btn-outline-* variants
  • ✅ Maintained responsive behavior and mobile menu functionality
  • ✅ Preserved exact visual styling including colors, spacing, and typography
  • ✅ Fixed CSS specificity issues and vertical alignment

Visual Refinements

  • ✅ Enhanced icon-to-text spacing in navigation links
  • ✅ Adjusted button heights to match Bootstrap dimensions
  • ✅ Fine-tuned green button background color for brand consistency

Files Modified

  • package.json & yarn.lock - Added Tailwind dependencies
  • tailwind.config.js - Tailwind configuration with tw- prefix
  • postcss.config.js - PostCSS configuration
  • resources/css/app.css - New Tailwind CSS with custom components
  • resources/views/layouts/app.blade.php - Updated asset loading order
  • resources/views/layouts/top-nav.blade.php - Converted Bootstrap classes to Tailwind

Testing

  • Navbar renders identically to Bootstrap version
  • Mobile responsive behavior works correctly
  • All navigation links and buttons function properly
  • No visual regressions in other components using Bootstrap
  • Build process completes successfully

Migration Guide for Other Components

For developers continuing this migration, follow this systematic approach:

  1. Pre-Migration Setup

Ensure latest changes are pulled

git pull origin develop
npm install

  1. Component Selection Strategy

Recommended conversion order:

  1. ✅ Navbar (completed)

  2. 🔄 Footer components

  3. 🔄 Button components across pages

  4. 🔄 Form components

  5. 🔄 Card/panel layouts

  6. 🔄 Grid system usage

  7. 🔄 Modal dialogs

  8. 🔄 Typography utilities

  9. Migration Process for Each Component

Step 1: Analyze Bootstrap Usage

Find Bootstrap classes in target component

grep -r "class.*(btn|card|form|modal)" resources/views/target-component/

Step 2: Create Tailwind Equivalents

  • Add new component classes to resources/css/app.css within @layer components
  • Use tw- prefix for all class names
  • Match exact CSS properties from Bootstrap source

Step 3: Update Template Files

  • Replace Bootstrap classes with Tailwind equivalents
  • Test visual parity in browser
  • Check responsive behavior

Step 4: Build and Verify

npm run build

Test component thoroughly

Compare with Bootstrap version

  1. Key Considerations

CSS Specificity:

  • Use !important when Bootstrap styles override Tailwind
  • Maintain CSS load order: Bootstrap first, then Tailwind

Responsive Design:

  • Bootstrap uses md, lg breakpoints - match with Tailwind media queries
  • Test all breakpoints thoroughly

Component Dependencies:

  • Some Bootstrap components rely on JavaScript - ensure functionality preserved
  • Update any custom CSS that targets Bootstrap classes

Color Consistency:

  • Use exact hex values from Bootstrap variables
  • Test color contrast and accessibility
  1. Quality Checklist

Before marking component complete:

  • Visual appearance matches Bootstrap exactly
  • Responsive behavior preserved
  • No console errors or warnings
  • Build process succeeds
  • Manual testing on mobile/desktop
  • No regressions in other components
  1. Final Cleanup (Future PR)

Once all components converted:

  • Remove Bootstrap dependencies
  • Clean up unused CSS
  • Remove tw- prefixes if desired
  • Update build configuration

@beetz12 beetz12 temporarily deployed to preview-pr-590 July 12, 2025 04:40 — with GitHub Actions Inactive
@allella allella requested a review from zach2825 July 13, 2025 14:27
@bogdankharchenko
Copy link
Collaborator

@beetz12

  1. Do we want to do a 1:1 port of bootstrap to tailwind or should this just be a design change?
  • I'm only saying this because we can potentially just do a design swap with tailwind in one shot rather than converting 1:1 and then changing a design later. I don't see immediate benefit of just going to tailwind from bootstrap
  1. Use tailwind classes only, no need for custom css file we need to maintain.
  2. Also, be sure to check the mobile/tablet views.

@allella thoughts?

@bogdankharchenko bogdankharchenko marked this pull request as draft July 14, 2025 14:58
@allella
Copy link
Member

allella commented Jul 14, 2025

@bogdankharchenko one of the motivators for an upgrade is we get a ton of deprecation errors now on deploy. It makes it rather difficult to catch other errors with pages of warnings.

We could upgrade to a newer Bootstrap, which would likely be much easier, but the lean was heavy to adopting Tailwind in this thread from earlier conversations.

We don't have anybody readily committing to a re-design, so I'd say we could go in the middle and upgrade to Tailwind and not be terribly concerned if the conversion or someone's preference causes the final result to not be 100% the same.

If we have someone we think would commit to helping with a design refresh, then I'd think we'd want to bring them on board right away instead of losing momentum on this PR and David's work.

@bogdankharchenko bogdankharchenko marked this pull request as ready for review July 14, 2025 16:13
@bogdankharchenko
Copy link
Collaborator

@bogdankharchenko one of the motivators for an upgrade is we get a ton of deprecation errors now on deploy. It makes it rather difficult to catch other errors with pages of warnings.

We could upgrade to a newer Bootstrap, which would likely be much easier, but the lean was heavy to adopting Tailwind in this thread from earlier conversations.

We don't have anybody readily committing to a re-design, so I'd say we could go in the middle and upgrade to Tailwind and not be terribly concerned if the conversion or someone's preference causes the final result to not be 100% the same.

If we have someone we think would commit to helping with a design refresh, then I'd think we'd want to bring them on board right away instead of losing momentum on this PR and David's work.

Got it, OK! That's fine!

@allella
Copy link
Member

allella commented Jul 14, 2025

@beetz12 @zach2825

Bogdan's questions do bring up the point if we can remove some of the custom classes and inherit more "stock" Tailwind in some areas.

As long as things aren't getting crapped up in a notable way, we probably don't care about small margin / padding differences, style differences on corners and buttons and such.

@beetz12
Copy link
Author

beetz12 commented Jul 15, 2025

@allella @bogdankharchenko That's a great question, Bogdan. If we've been thinking about a design change anyway, then this would be a perfect opportunity to redo both the design and the CSS framework at the same time.

It would take a substantial amount of time to just switch from Bootstrap to Tailwind while preserving the existing style exactly as it is. And you're right about the mobile display issues - I was only focused on desktop initially because I wanted to get some feedback first. If we didn't want to go with this approach, then there'd be no need to spend additional time making it look good on mobile.

I actually like the one-shot redesign approach you suggested, Bogdan. I could potentially commit to helping with a redesign if we decide to go that route. If we did, do we still want to stay with the existing framework (Laravel, etc.)? We could also use this as an opportunity to switch to a pure JavaScript framework like React or Next.js, which would allow more new folks to contribute since many developers are familiar with JavaScript.

Regarding Jim's suggestion about removing custom classes and inheriting more "stock" Tailwind - this would be challenging since Bootstrap provides pre-styled components (navbars, cards, grids) that look good out of the box, while Tailwind is utility-first with minimal default styling. Without explicitly adding Tailwind utility classes, elements would likely revert to basic HTML styling - navigation would break into vertical lists, grid layouts would collapse, and components would lose their styling. We'd essentially need to rebuild the visual design with Tailwind utilities to maintain the current look.

What do you think? Should we pivot toward a full redesign, or continue with the incremental migration?

@allella
Copy link
Member

allella commented Jul 16, 2025

I have no experience with Tailwind, but it sounds from the prior conversation that people were imaging we'd use Tailwind with a component library like daisyUI or Flowbit.

If that isn't appealing to folks, then we could shift to the other idea of upgrading to the latest Bootstrap.

As for a redesign or switching to a JS framework, I think those are bigger conversations that may be best for the next in-person HG Labs meeting.

@bogdankharchenko
Copy link
Collaborator

@beetz12 take a look at this branch locally: https://github.com/bogdankharchenko/hackgreenville-com/tree/laravel-inertia-tailwind-css

Inertia + react -- we should discuss this design at some point!

@allella
Copy link
Member

allella commented Oct 18, 2025

David has been traveling and busy on a project, but I would like to revisit this Tailwind migration when he frees up.

The old version of Bootstrap, combined with our old server, is making for a lot of annoying deprecation warnings when we do deploys.

@beetz12
Copy link
Author

beetz12 commented Oct 21, 2025

Hi Jim, I will have some time at the end of this week. Besides resolving the current conflict, do you have any questions or concerns that you'd like to discuss?

@allella
Copy link
Member

allella commented Oct 21, 2025

@beetz12 Having a solid front-end developer, like Zach, take a look would be nice. Perhaps we can find some more reviewers at HG Nights.

I trust the regular contributors can figure it out, but as far as I know we're all more backend and not working with Tailwind every day.

@beetz12
Copy link
Author

beetz12 commented Oct 21, 2025

Yes, agreed. It would definitely be good get some additional frontend devs to review it. I wouldn't expect anything less for changes of this size. I do also want to mention that Code Rabbit code reports also provide a nice summary about the changes and it can identify many vulnerabilities. Not saying that this is a replacement for actual dev review, but it's an good additional safety check.

You know what's strange, previously I thought CodeRabbit was integrated into this repo and provided a report, but I can't find it now.

Copy link
Collaborator

@zach2825 zach2825 left a comment

Choose a reason for hiding this comment

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

I ran this command. There are only a few remaining bootstrap classes still used. Could you factor these out, too? Thank you for your work, it's looking very good so far.

The command I ran

grep -rn --include="*.blade.php" -E '\b(container|container-fluid|row|col-[a-z0-9-]+|btn|btn-[a-z-]+|navbar|navbar-[a-z-]+|nav-link|card|card-[a-z-]+|alert|alert-[a-z-]+|badge|form-control|form-group|form-label|modal|modal-[a-z-]+|dropdown|dropdown-[a-z-]+|table|table-[a-z-]+|pagination|breadcrumb|jumbotron|list-group|list-group-item|input-group|text-(center|right|left|muted|primary|success|danger|warning|info)|d-flex|justify-content-[a-z-]+|align-items-[a-z-]+|[mp][tblrxy]?-[0-9]|w-[0-9]+|h-[0-9]+)\b' resources/views/ 

It's a Linux command that searches through all blade files for a bootstrap class pattern. I used an AI to create the pattern, and it looks complete.

There are ~367 references, but it's all just search-and-replace.

Heres an example of the mapping I'm talking about

Bootstrap Class Purpose Tailwind Equivalent(s) Notes
container Fixed-width responsive wrapper max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 Adjust max-w-* as needed
container-fluid Full-width container w-full px-4 sm:px-6 lg:px-8 Full width with padding
row Flex row wrapper flex flex-wrap -mx-4 Negative margins for columns
col-md-6 50% width on md+ screens w-full md:w-1/2 px-4 Responsive layout
col-md-4 33% width on md+ screens w-full md:w-1/3 px-4 Common grid pattern
col-md-3 25% width on md+ screens w-full md:w-1/4 px-4 Quarter width
card Card container bg-white rounded-lg shadow p-4 Customize spacing as needed
card-body Inner card content p-4 Often merged into card
card-header Card header section border-b pb-2 mb-2 font-semibold Optional styling
btn Base button inline-flex items-center px-4 py-2 rounded Base button style
btn-primary Primary button bg-blue-600 text-white hover:bg-blue-700 Replace colors to suit theme
text-center Center text text-center Same naming
d-flex Display flex flex Direct mapping
justify-content-between Space between items justify-between Direct mapping
align-items-center Vertically center items-center Direct mapping

@@ -0,0 +1,4304 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove the package-lock.json file. This project has been using yarn.. So if you could remove this file and run yarn upgrade, that should apply the same updates.

"devDependencies": {
"@tailwindcss/postcss": "^4.1.11",
"autoprefixer": "^10.4.21",
"bootstrap": "^4.0.0",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you remove Bootstrap and all related packages such as bootstrap-switch and bootstrap-datepicker, and replace them with different packages compatible with Tailwind?

Copy link
Author

Choose a reason for hiding this comment

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

@zach2825 thanks for the review! However, this is the PR where I only migrated the header and footer to tailwind so naturally you'll still find bootstrap references. You may want to review this other PR: #601

@beetz12
Copy link
Author

beetz12 commented Nov 26, 2025

Closing this review due to a newer more complete tailwind migration #601

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.

4 participants