Repository navigation
Revert "chore(studio + design-system): more flexible Admonition" - #45535
Conversation
…)" This reverts commit 5bfbae2.
|
Issue reopened: DEPR-551 Ship more flexible Admonition |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
📝 WalkthroughWalkthroughThis PR refactors the ChangesAdmonition Component Refactor & Migration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/ui-patterns/src/admonition.tsx`:
- Around line 137-167: The current rendering drops title when label exists and
drops description when no label/title; update the Admonition rendering so
AlertTitle_Shadcn_ renders both label and title (e.g., render label and title
separately inside the title block instead of choosing one), and ensure
AlertDescription_Shadcn_ renders description independently of the label/title
branch (so the description is shown in both the labeled branch and the fallback
children-only branch); adjust usage of childProps.title/childProps.description
and the conditional checks around {label || title} and {description} so title
and description never get silently omitted.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: bb738899-8044-42dd-a9e0-d081562a1a66
📒 Files selected for processing (23)
apps/design-system/__registry__/index.tsxapps/design-system/content/docs/fragments/admonition.mdxapps/design-system/registry/default/example/admonition-description-only.tsxapps/design-system/registry/default/example/admonition-success.tsxapps/design-system/registry/examples.tsapps/design-system/styles/globals.cssapps/design-system/tailwind.config.jsapps/studio/components/interfaces/Auth/Users/UserOverview.tsxapps/studio/components/interfaces/Database/Publications/PublicationsTables.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationPanelFields.tsxapps/studio/components/interfaces/Database/RestoreToNewProject/RestoreToNewProject.tsxapps/studio/components/interfaces/Integrations/Queues/SingleQueue/QueueSettings.tsxapps/studio/components/interfaces/Integrations/templates/StripeSyncEngine/StripeSyncSettingsPage.tsxapps/studio/components/interfaces/OrganizationInvite/OrganizationInvite.tsxapps/studio/components/interfaces/Settings/API/PostgrestConfig.tsxapps/studio/components/interfaces/Settings/Addons/IPv4SidePanel.tsxapps/studio/components/interfaces/Settings/Database/JitDatabaseAccess/JitDbAccessRuleSheet.tsxapps/studio/components/interfaces/Settings/General/DashboardPreferences.tsxapps/studio/components/interfaces/Support/ProjectAndPlanInfo.tsxapps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/ApiAccessToggle.tsxapps/studio/pages/cli/login.tsxpackages/ui-patterns/src/admonition.tsxpackages/ui/src/components/shadcn/ui/alert.tsx
💤 Files with no reviewable changes (4)
- apps/design-system/registry/default/example/admonition-success.tsx
- apps/design-system/registry/examples.ts
- apps/design-system/registry/default/example/admonition-description-only.tsx
- apps/design-system/registry/index.tsx
| {label || title ? ( | ||
| <div> | ||
| {(label || title) && ( | ||
| <AlertTitle_Shadcn_ | ||
| {...childProps.title} | ||
| className={cn( | ||
| 'text mt-0.5 flex gap-3 text-sm !font-medium', | ||
| !label && 'flex-col', | ||
| childProps.title?.className | ||
| )} | ||
| > | ||
| {label || title} | ||
| </AlertTitle_Shadcn_> | ||
| )} | ||
| <AlertTitle_Shadcn_ | ||
| {...childProps.title} | ||
| className={cn( | ||
| 'text mt-0.5 flex gap-3 text-sm', | ||
| !label && 'flex-col', | ||
| childProps.title?.className | ||
| )} | ||
| > | ||
| {label || title} | ||
| </AlertTitle_Shadcn_> | ||
| {description && ( | ||
| <AlertDescription_Shadcn_ | ||
| {...childProps.description} | ||
| className={cn( | ||
| admonitionBodyClassName, | ||
| !label && !title && 'my-0.5', | ||
| childProps.description?.className | ||
| )} | ||
| > | ||
| <AlertDescription_Shadcn_ className={childProps.description?.className}> | ||
| {description} | ||
| </AlertDescription_Shadcn_> | ||
| )} | ||
| {/* // children is to handle Docs and MDX issues with children and <p> elements */} | ||
| {children && ( | ||
| <AlertDescription_Shadcn_ | ||
| {...childProps.description} | ||
| className={cn(admonitionBodyClassName, childProps?.description?.className)} | ||
| className={cn('', childProps?.description?.className)} | ||
| > | ||
| {children} | ||
| </AlertDescription_Shadcn_> | ||
| )} | ||
| </div> | ||
| ) : ( | ||
| <div className={cn('text my-0.5', admonitionBodyClassName)}>{children}</div> | ||
| <div className="text my-0.5 [&_p]:mt-0 [&_p]:mb-1.5 [&_p:last-child]:mb-0"> | ||
| {children} | ||
| </div> |
There was a problem hiding this comment.
Accepted prop combinations lose content in this branch.
Line 147 drops title whenever label is also set, and Line 165 drops description entirely when no label/title is provided. Since the public props allow all three independently, this will silently render incomplete or empty admonitions for valid call sites.
Suggested fix
- {label || title ? (
+ {label || title || description ? (
<div>
- <AlertTitle_Shadcn_
- {...childProps.title}
- className={cn(
- 'text mt-0.5 flex gap-3 text-sm',
- !label && 'flex-col',
- childProps.title?.className
- )}
- >
- {label || title}
- </AlertTitle_Shadcn_>
+ {(label || title) && (
+ <AlertTitle_Shadcn_
+ {...childProps.title}
+ className={cn(
+ 'text mt-0.5 flex gap-3 text-sm',
+ !label && 'flex-col',
+ childProps.title?.className
+ )}
+ >
+ {label && <span>{label}</span>}
+ {title && <span>{title}</span>}
+ </AlertTitle_Shadcn_>
+ )}
{description && (
- <AlertDescription_Shadcn_ className={childProps.description?.className}>
+ <AlertDescription_Shadcn_
+ {...childProps.description}
+ className={childProps.description?.className}
+ >
{description}
</AlertDescription_Shadcn_>
)}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| {label || title ? ( | |
| <div> | |
| {(label || title) && ( | |
| <AlertTitle_Shadcn_ | |
| {...childProps.title} | |
| className={cn( | |
| 'text mt-0.5 flex gap-3 text-sm !font-medium', | |
| !label && 'flex-col', | |
| childProps.title?.className | |
| )} | |
| > | |
| {label || title} | |
| </AlertTitle_Shadcn_> | |
| )} | |
| <AlertTitle_Shadcn_ | |
| {...childProps.title} | |
| className={cn( | |
| 'text mt-0.5 flex gap-3 text-sm', | |
| !label && 'flex-col', | |
| childProps.title?.className | |
| )} | |
| > | |
| {label || title} | |
| </AlertTitle_Shadcn_> | |
| {description && ( | |
| <AlertDescription_Shadcn_ | |
| {...childProps.description} | |
| className={cn( | |
| admonitionBodyClassName, | |
| !label && !title && 'my-0.5', | |
| childProps.description?.className | |
| )} | |
| > | |
| <AlertDescription_Shadcn_ className={childProps.description?.className}> | |
| {description} | |
| </AlertDescription_Shadcn_> | |
| )} | |
| {/* // children is to handle Docs and MDX issues with children and <p> elements */} | |
| {children && ( | |
| <AlertDescription_Shadcn_ | |
| {...childProps.description} | |
| className={cn(admonitionBodyClassName, childProps?.description?.className)} | |
| className={cn('', childProps?.description?.className)} | |
| > | |
| {children} | |
| </AlertDescription_Shadcn_> | |
| )} | |
| </div> | |
| ) : ( | |
| <div className={cn('text my-0.5', admonitionBodyClassName)}>{children}</div> | |
| <div className="text my-0.5 [&_p]:mt-0 [&_p]:mb-1.5 [&_p:last-child]:mb-0"> | |
| {children} | |
| </div> | |
| {label || title || description ? ( | |
| <div> | |
| {(label || title) && ( | |
| <AlertTitle_Shadcn_ | |
| {...childProps.title} | |
| className={cn( | |
| 'text mt-0.5 flex gap-3 text-sm', | |
| !label && 'flex-col', | |
| childProps.title?.className | |
| )} | |
| > | |
| {label && <span>{label}</span>} | |
| {title && <span>{title}</span>} | |
| </AlertTitle_Shadcn_> | |
| )} | |
| {description && ( | |
| <AlertDescription_Shadcn_ | |
| {...childProps.description} | |
| className={childProps.description?.className} | |
| > | |
| {description} | |
| </AlertDescription_Shadcn_> | |
| )} | |
| {/* // children is to handle Docs and MDX issues with children and <p> elements */} | |
| {children && ( | |
| <AlertDescription_Shadcn_ | |
| {...childProps.description} | |
| className={cn('', childProps?.description?.className)} | |
| > | |
| {children} | |
| </AlertDescription_Shadcn_> | |
| )} | |
| </div> | |
| ) : ( | |
| <div className="text my-0.5 [&_p]:mt-0 [&_p]:mb-1.5 [&_p:last-child]:mb-0"> | |
| {children} | |
| </div> | |
| )} |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/ui-patterns/src/admonition.tsx` around lines 137 - 167, The current
rendering drops title when label exists and drops description when no
label/title; update the Admonition rendering so AlertTitle_Shadcn_ renders both
label and title (e.g., render label and title separately inside the title block
instead of choosing one), and ensure AlertDescription_Shadcn_ renders
description independently of the label/title branch (so the description is shown
in both the labeled branch and the fallback children-only branch); adjust usage
of childProps.title/childProps.description and the conditional checks around
{label || title} and {description} so title and description never get silently
omitted.
🎭 Playwright Test ResultsDetails
Skipped testsFeatures › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled |
MildTomato
left a comment
There was a problem hiding this comment.
approving revert. no preview checked
Braintrust eval reportNo experiments to report |
## What kind of change does this PR introduce? Feature and design-system update. Resolves DEPR-551. This is a narrower redo of #45302 after the revert in #45535. ## What is the current behaviour? The reverted implementation made Admonition more flexible, but it also changed Studio callsites, touched shared Alert styling, renamed the design-system Tailwind config, and changed Docs-facing content/API assumptions in a way that broke production docs static generation. ## What is the new behaviour? Admonition now supports description-only content, children-only content, optional `title`, legacy `label`, and `type="success"` without touching `apps/docs/content/**` or shared Alert styling. `title` wins over `label` when both are provided. The runtime component props stay backwards-compatible for existing MDX and Studio usage, while `AdmonitionStrictProps` captures the stricter new-usage contract for tests and future callsites. The design-system docs and registry include description-only and success examples, and the Admonition tests cover the rendering paths that broke production previously. | After | | --- | | <img width="1668" height="1768" alt="CleanShot 2026-05-06 at 17 35 13@2x" src="https://github.com/user-attachments/assets/1c00ea7f-e3ca-45eb-8af9-3536b657c341" /> | ## Additional context These things that were in #45302 have been left out (unless checked): - [ ] Studio callsite rewrites from title/label to description - [ ] Shared Alert text-colour changes - [ ] Design-system Tailwind config rename - [ ] Design-system global CSS changes - [ ] Any docs content migration or label deprecation - [ ] Any production docs workaround <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added success admonition variant with dedicated styling and icon. * Introduced description-only admonition example. * **Documentation** * Expanded admonition guidance on title vs description usage and best practices. * Added example sections showcasing description-only and success variants. * **Tests** * Added comprehensive tests covering admonition variants and rendering/precedence behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
## What kind of change does this PR introduce? Docs update. Related to DEPR-551. ## What is the current behavior? Docs MDX still uses the legacy `label` prop for Admonitions, even though #45618 added `title` and kept `label` only as a backwards-compatible alias after #45302 was reverted in #45535. ## What is the new behavior? Migrates Docs-owned Admonitions from `label=` to `title=` without changing rendered copy, component APIs, Studio callsites, design-system examples, or the legacy `label` alias. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Standardized admonition headings across the docs by switching how admonition headings are provided (preserving all visible guidance and examples). Content and instructions remain unchanged; this ensures consistent rendering of callouts and improves uniformity across guides and reference pages. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/supabase/supabase/pull/46053?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Chris Chinchilla <[email protected]>
## What kind of change does this PR introduce? Chore. Follow-up to DEPR-551, #45302, #45535, and #45618. ## What is the current behaviour? Some short Studio Admonitions still put their entire message in `title` or legacy `label`, so body-copy callouts render as headings. ## What is the new behaviour? Moves selected single-message Studio Admonitions to `description`, keeping the follow-up deliberately limited to Studio callsites. This PR does not touch Docs content, shared Alert styling, ui-patterns, design-system registry/docs, or Tailwind config. | Before | After | | --- | --- | | <img width="1818" height="388" alt="Image" src="https://github.com/user-attachments/assets/283a1853-348a-4d74-a408-013957350e5e" /> | <img width="1380" height="462" alt="Image" src="https://github.com/user-attachments/assets/e5761e8e-3697-423b-805b-45110205099a" /> | | <img width="1640" height="716" alt="CleanShot 2026-04-28 at 15 17 25@2x" src="https://github.com/user-attachments/assets/a5be4d5f-2bf7-4dc2-b396-56129fe64ec9" /> | <img width="1630" height="716" alt="CleanShot 2026-04-28 at 15 16 00@2x" src="https://github.com/user-attachments/assets/0d589252-aaf8-4efc-9d81-15ec4f99ec61" /> | <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Style** * Refined message displays and admonition styling across settings, database, dashboard, and admin interfaces for improved visual consistency and clarity. * **UI Updates** * Updated search input layouts and form element styling in publications tables and other admin pages. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/supabase/supabase/pull/46049?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
## What kind of change does this PR introduce? Bug fix. Follow-up to DEPR-551, #45302, #45535, #45618, and stacked on #46049. ## What is the current behaviour? Warning and destructive Alert variants do not explicitly own their foreground text colour. In muted parent contexts, nested Admonition content can inherit lighter text styling. ## What is the new behaviour? Warning and destructive Alert variants now include `text-foreground`, just like the default counterpart. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Style** * Updated styling for alert components with destructive and warning variants. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/supabase/supabase/pull/46050?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Reverts #45302
The original PR has broken the build on production. We will try this, and later retake the original changes if needed.
Summary by CodeRabbit
Refactor
successvariant typeChores
Style
Documentation