Skip to content

minor fixes to drawer and modal#1724

Merged
shinokada merged 2 commits intothemesberg:mainfrom
jjagielka:minortweaks
Aug 17, 2025
Merged

minor fixes to drawer and modal#1724
shinokada merged 2 commits intothemesberg:mainfrom
jjagielka:minortweaks

Conversation

@jjagielka
Copy link
Copy Markdown
Contributor

@jjagielka jjagielka commented Aug 17, 2025

📑 Description

Fixes:

  • passing classes to Dialog for Drawer and Modal
  • tweak to Avatar stacked layout
  • example for drawer rewritten to use more components

Status

  • Not Completed
  • Completed

✅ Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation and api-check directory as required
  • All the tests and check have passed by running pnpm check && pnpm test:e2e
  • My pull request is based on the latest commit (not the npm version).
  • I have checked the page with https://validator.unl.edu/

ℹ Additional Information

Summary by CodeRabbit

  • New Features
    • Drawer supports form mode with a configurable form container via a classes prop and a dedicated form prop.
  • Bug Fixes
    • Stacked avatars no longer shift the first item; spacing now applies only to subsequent items.
    • Modal no longer exposes the outsideclose prop; Drawer and Modal consistently forward styling classes to their inner dialogs.
  • Documentation
    • Drawer docs updated with a form-based example using form primitives and avatar previews.
  • Refactor
    • Drawer typing expanded to include dialog-related class options.

@vercel
Copy link
Copy Markdown

vercel bot commented Aug 17, 2025

@jjagielka is attempting to deploy a commit to the Themesberg Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Aug 17, 2025

Walkthrough

Applies Tailwind not-first to avatar stacked spacing, forwards classes from Drawer to Dialog and extends DrawerVariants to include Dialog classes, explicitly forwards classes from Modal to Dialog, and updates Drawer docs to showcase form-mode and Flowbite Svelte form primitives.

Changes

Cohort / File(s) Summary of Changes
Avatar theming
src/lib/avatar/theme.ts
Changed stacked variant from "border-2 -ms-4 ..." to "border-2 not-first:-ms-4 ..." so the negative margin applies only to non-first avatars.
Drawer implementation & types
src/lib/drawer/Drawer.svelte, src/lib/drawer/theme.ts
Drawer.svelte no longer destructures classes and now forwards it via ...restProps; DrawerVariants type expanded to include Classes<typeof dialog>.
Modal prop forwarding
src/lib/modal/Modal.svelte
Removed outsideclose prop from Modal public API and explicitly passes {classes} to inner Dialog before spreading restProps.
Dialog logic
src/lib/dialog/Dialog.svelte
Removed commented conditional; active outside-close logic uses outsideclose && !clickedInContent to cancel on outside-content clicks.
Docs (Drawer example)
src/routes/docs/components/drawer.md
Reworked Drawer example to form-mode using Flowbite Svelte Label, Input, Textarea, Avatar, etc.; adds form and classes.form usage and updates imports and structure.

Sequence Diagram(s)

sequenceDiagram
  participant App
  participant Drawer
  participant Dialog

  App->>Drawer: open, form, classes, other props
  Drawer->>Dialog: forward props (including classes via ...restProps)
  Dialog-->>Drawer: rendered dialog UI
  Drawer-->>App: drawer with form content
Loading
sequenceDiagram
  participant App
  participant Modal
  participant Dialog

  App->>Modal: props (classes, transitionParams, ...)
  Modal->>Dialog: pass {classes} then ...restProps
  Dialog-->>Modal: rendered modal UI
  Modal-->>App: modal content
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Dialog #1723 — Adjusts dialog outside-close logic and how drawers/modal propagate dismissal-related props; strongly related to Dialog/Drawer changes.
  • Modal #1668 — Modifies Modal public API (adds/removes props like form, focustrap) overlapping with this PR’s Modal prop changes.
  • fix: double close button in docs #1717 — Updates Drawer docs/examples similar to the Drawer docs rework here.

Poem

I hop in stacks, first one stays straight,
The rest lean close — a tiny trait.
Drawers send classes down the line,
Modals pass them — all align.
Docs now form, and guests arrive — hooray, we celebrate! 🐇✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between bba71a7 and eb1fb4b.

📒 Files selected for processing (2)
  • src/lib/dialog/Dialog.svelte (0 hunks)
  • src/lib/modal/Modal.svelte (2 hunks)
💤 Files with no reviewable changes (1)
  • src/lib/dialog/Dialog.svelte
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/lib/modal/Modal.svelte
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Playwright and Lint
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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
Copy Markdown
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: 1

🧹 Nitpick comments (2)
src/lib/drawer/theme.ts (1)

5-5: Type surface broadened to include dialog classes — aligns with extend(Dialog)

Including Classes ensures Drawer’s classes can target Dialog’s slots (e.g., form). This matches the runtime behavior of extending Dialog. If tailwind-variants’ extend already merges slots in the resulting type, this may be redundant but is harmless and clarifies intent.

Consider adding a short comment noting why both Classes and Classes are intersected, for future maintainers.

src/routes/docs/components/drawer.md (1)

195-199: Docs: Great demo of form mode and classes.form; small a11y tweak

Consider wiring aria-labelledby to the heading for consistent labeling (as shown in the default example).

Apply this diff:

-<Drawer form bind:open={open4} classes={{ form: "space-y-6 mb-6" }}>
-  <h5 class="mb-6 inline-flex items-center text-base font-semibold text-gray-500 uppercase dark:text-gray-400">
+<Drawer form bind:open={open4} aria-labelledby="drawer-form-title" classes={{ form: "space-y-6 mb-6" }}>
+  <h5 id="drawer-form-title" class="mb-6 inline-flex items-center text-base font-semibold text-gray-500 uppercase dark:text-gray-400">
📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between bc902da and bba71a7.

📒 Files selected for processing (5)
  • src/lib/avatar/theme.ts (1 hunks)
  • src/lib/drawer/Drawer.svelte (1 hunks)
  • src/lib/drawer/theme.ts (1 hunks)
  • src/lib/modal/Modal.svelte (1 hunks)
  • src/routes/docs/components/drawer.md (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/lib/drawer/theme.ts (2)
src/lib/theme/themeUtils.ts (1)
  • Classes (14-16)
src/lib/dialog/theme.ts (1)
  • dialog (6-21)
🔇 Additional comments (9)
src/lib/avatar/theme.ts (1)

18-18: Confirm Tailwind’s not-first Variant Support

The CSS class (not-first:-ms-4) is correct for skipping the first avatar and providing RTL-friendly spacing, but we still need to verify that your Tailwind setup supports the not-first variant (added in v3.3+).

Please confirm by checking both:

  • Your Tailwind dependency version in package.json
  • Existence of a tailwind.config.js (or .ts) where variants aren’t restricted

You can run:

# 1. Check Tailwind version in package.json
rg -nP '"(?:tailwindcss)"\s*:\s*"[0-9]+\.[0-9]+\.[0-9]+"' package.json

# 2. Locate your Tailwind config file
fd 'tailwind.config.*' -t f -d 3

If your version is ≥3.3 and your config doesn’t disable the not-first variant, you’re all set. Otherwise, please upgrade Tailwind or enable the variant in your config.

src/lib/drawer/Drawer.svelte (3)

10-10: Good change: stop destructuring classes so it forwards to Dialog via restProps

This enables consumers to style Dialog slots (e.g., form) through Drawer without changing Drawer’s own API surface.


38-38: Correctly deriving styling from modal while still forwarding it

Using modal: restProps.modal lets Drawer’s theme add the non-modal base classes while still forwarding modal to Dialog via restProps. Nicely done.


51-51: Props forwarding ensures form and classes reach Dialog

Forwarding ...restProps means features like form mode and classes={{ form: "…" }} work without Drawer needing to re-declare them.

src/routes/docs/components/drawer.md (5)

185-185: Docs: Avatar import addition is consistent with the new example

Bringing in Avatar matches the new stacked avatars section and the updated stacked spacing.


199-207: Docs: Using Label + Input/Textarea reads well and matches Flowbite Svelte patterns

The grouped Label usage and required fields are clear. No issues spotted.


208-215: Docs: Inline “right” snippet in Input is a nice touch

Good illustration of input adornments with a small action button.


216-220: Docs: Stacked Avatars now align visually with the new not-first:-ms-4 behavior

Example effectively demonstrates the updated stacked spacing.


221-223: Docs: Submit CTA in form mode showcases dialog-form behavior

Clear and consistent with the example’s intent.

@shinokada shinokada merged commit c36f667 into themesberg:main Aug 17, 2025
1 of 2 checks passed
@jjagielka jjagielka deleted the minortweaks branch August 17, 2025 10:55
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