Skip to content

[FIX] Fix sonner presentation #60

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

h3rmel
Copy link
Contributor

@h3rmel h3rmel commented May 13, 2025

Work on sonner styles to be properly presented on page:
image

Summary by CodeRabbit

  • New Features

    • Added dynamic theme support for toast notifications, adapting to the user's current theme preference.
  • Style

    • Improved toast notification styling with higher specificity and updated appearance.
    • Enhanced layout styling for the app body, including full width, smooth scrolling, and responsive sizing.
  • Chores

    • Added the next-themes package to support theme management.

Copy link

vercel bot commented May 13, 2025

@h3rmel is attempting to deploy a commit to the Retro UI Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented May 13, 2025

Walkthrough

The changes introduce dynamic theming support for toast notifications using the next-themes package, update Tailwind CSS utility classes for layout and toast styling, remove an unused icon import, and add a "use client"; directive to a preview component. No public API signatures were altered.

Changes

File(s) Change Summary
app/(docs)/docs/[[...slug]]/page.tsx Removed unused MoveRightIcon import from "lucide-react", retaining only MoveUpRightIcon.
app/layout.tsx Extended <body>'s className with additional Tailwind CSS utility classes for layout, positioning, and smooth scrolling.
components/retroui/Sonner.tsx Added dynamic theme support via next-themes, updated toast styling with !important classes, added className, removed unstyled.
package.json Added next-themes@^0.4.6 as a new dependency.
preview/components/sonner-style-default.tsx Added "use client"; directive at the top of the file.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Toaster (Sonner)
    participant ThemeProvider (next-themes)

    User->>Toaster: Triggers toast notification
    Toaster->>ThemeProvider: Requests current theme
    ThemeProvider-->>Toaster: Returns theme (system/light/dark)
    Toaster->>User: Displays toast with theme and updated styles
Loading

Poem

🐇
A theme now hops from dark to light,
Toasts appear with styling bright!
Classes stack with extra might,
Unused icons take their flight.
Logs and clients join the show—
In every change, the features grow!

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3d5d843 and 0c1cdfd.

📒 Files selected for processing (1)
  • preview/components/sonner-style-default.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • preview/components/sonner-style-default.tsx
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
preview/components/sonner-style-default.tsx (1)

8-8: Consider removing debug log statement.

The console.log("clicked"); statement appears to be for debugging purposes and may not be needed in production code.

-    console.log("clicked");
app/layout.tsx (1)

71-71: Enhanced body element with additional layout utilities.

The added Tailwind classes improve the layout and scrolling behavior:

  • w-full and size-full ensure proper width and dimensions
  • min-h-dvh sets minimum height to dynamic viewport height
  • overflow-x-hidden prevents horizontal overflow
  • relative sets positioning context for descendants
  • scroll-smooth adds smooth scrolling behavior
  • antialised improves text rendering (note: should be antialiased)

There's a typo in antialised - it should be antialiased:

- className={`${space.className} ${archivoBlack.variable} ${space.variable} ${spaceMono.variable} bg-background text-foreground w-full min-h-dvh overflow-x-hidden size-full relative antialised scroll-smooth`}
+ className={`${space.className} ${archivoBlack.variable} ${space.variable} ${spaceMono.variable} bg-background text-foreground w-full min-h-dvh overflow-x-hidden size-full relative antialiased scroll-smooth`}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 74e0d8b and 3d5d843.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (5)
  • app/(docs)/docs/[[...slug]]/page.tsx (1 hunks)
  • app/layout.tsx (1 hunks)
  • components/retroui/Sonner.tsx (1 hunks)
  • package.json (1 hunks)
  • preview/components/sonner-style-default.tsx (1 hunks)
🔇 Additional comments (12)
package.json (1)

37-37: Added next-themes dependency for dynamic theming support.

The addition of next-themes is appropriate for enabling dynamic theming capabilities, which will be used with the Sonner toast component.

app/(docs)/docs/[[...slug]]/page.tsx (1)

8-8: Removed unused icon import.

Good cleanup by removing the unnecessary MoveRightIcon import while keeping only the actively used MoveUpRightIcon.

preview/components/sonner-style-default.tsx (1)

1-2: Added client directive.

The "use client"; directive is necessary since this component uses client-side features (event handlers and toast notifications).

components/retroui/Sonner.tsx (9)

3-3: Good addition of theming support.

Adding the useTheme hook from next-themes is appropriate for enabling dynamic theme support for toast notifications.


9-10: Proper hook implementation with fallback.

The implementation correctly destructures the theme value with a sensible default fallback to "system" when undefined. This follows React hooks best practices.


13-14: Good theming implementation and class structure.

The theme is correctly passed to the Sonner component with proper type casting. The addition of "toaster group" class names creates the necessary structure for the group selectors used in the toast styling.


18-18: Style specificity improvement.

Adding ! prefixes (Tailwind's important flag) ensures these styles take precedence over default Sonner styles, fixing presentation issues. The group selectors are properly structured to target toast elements.


20-20: Consistent style enforcement for description text.

The important flags and group selectors ensure toast descriptions maintain consistent styling across different themes.


22-22: Action button styling consistency.

The styling ensures that action buttons maintain consistent appearance regardless of theme changes.


24-24: Cancel button styling consistency.

Similar to the action button, these changes ensure cancel buttons have consistent styling across themes.


25-25: Title text styling improvement.

The addition of !text-base ensures consistent title text size, which was likely one of the presentation issues being addressed.


27-27: Close button positioning fix.

The important flags ensure the close button positioning and styling is consistently applied across different theme contexts.

@ariflogs
Copy link
Member

Hi @h3rmel 👋
I left a comment on your code. can you please address that?

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.

2 participants