Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Upgrade to Bootstrap 5. #925

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

refactor: Upgrade to Bootstrap 5. #925

wants to merge 8 commits into from

Conversation

darkobits
Copy link
Member

@darkobits darkobits commented Mar 19, 2024

🏗️ Migrate to Bootstrap 5

This PR upgrades the website from Bootstrap 4 to Bootstrap 5, resulting in a minor but much-needed UI refresh. This has also allowed us to remove a lot of our custom CSS. I've also done some general housekeeping, and added some extra goodies.

Major Changes

  • Lots of UI polish and pruning of custom CSS wherever possible.
    • Switched to a beautiful new off-canvas nav menu for mobile devices. ✨
    • Added localization to search results count and pack view counts.
    • Several tweaks to top-level layout to ensure the site looks great on mobile devices with "exotic" viewports, especially in standalone mode.
  • Reduce reliance on external CDNs for dependencies; we now only need to connect to signalstickers.org and signal.org.
  • Dropped react-switch; Bootstrap 5 has a native component for this.
  • We now use the prefers-color-scheme selector to set the initial value for dark/light mode.
  • Removed the Back button from sticker pack detail pages.
    • It did not reliably return the user to their previous scroll position in search results, which could be quite frustrating.
    • It's not necessary when using a browser, the back button (or related keyboard shortcut) works fine.
    • In standalone/PWA mode, devices have swipe gestures to navigate forwards/backwards that functionally act the same as a back button, correctly restoring scroll position.

Notable Changes in Bootstrap 5

For a full list of changes in version 5, check out the migration guide. Some noteworthy updates are:

  • Several utility classes have been renamed to use logical property names instead of directional names with the addition of RTL support. This means left and right are now start and end respectively. (read more)
  • .form-row and .form-group have been dropped in favor of using grid classes for layout. This change allowed us to remove two layers of nested elements on each form control on our forms.
  • Bootstrap 5 no longer requires jQuery, so this dependency has been dropped. 🧹

Other Refactoring

  • Improved Search
    • By taking advantage of some advanced Fuse.js features, we now only need to create a single Fuse.js instance rather than one for each attribute we want to search on.
    • Fixed an issue where it was previously not possible to search for falsy values on boolean attributes like original, animated, and editorschoice.
    • Sorting search results by Relevance uses their Fuse.js result score.
    • Search results may now be sorted by Latest, Trending, and Most Viewed.
    • Search result count is now computed after NSFW packs are filtered (or not).
    • Fixed Search is unexpectedly verbatim #916
  • Form submit handlers are now async, removing the need to explicitly call setSubmitting.
  • We now use Formik's status to track when to show field errors and to store API errors.
  • Sort order and NSFW settings are now persisted to Local Storage.
  • Resolved several security vulnerabilities by upgrading dependencies. This branch now passes npm audit with 0 vulnerabilities. 🔒
  • Fix Fix spelling error of personnal #856

🌎 A preview of these changes is available here.

@darkobits darkobits force-pushed the bootstrap-5 branch 6 times, most recently from 85a3d5e to 0bcd42c Compare March 21, 2024 10:21
@darkobits darkobits force-pushed the bootstrap-5 branch 11 times, most recently from 07fe119 to ad84442 Compare March 28, 2024 04:30
@darkobits darkobits linked an issue Apr 1, 2024 that may be closed by this pull request
@darkobits darkobits force-pushed the bootstrap-5 branch 2 times, most recently from be50397 to 4bb6054 Compare April 3, 2024 07:26
Base automatically changed from vite-migration to master April 4, 2024 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Search is unexpectedly verbatim
1 participant