From c5e45baff75e3dcdc766ea468039f71a3246d094 Mon Sep 17 00:00:00 2001 From: Danny White <3104761+dnywh@users.noreply.github.com> Date: Fri, 13 Nov 2026 11:50:23 +1100 Subject: [PATCH] fix(ui-patterns): keep admonition action surfaces opaque (#52348) ## Problem Default buttons inside Admonition actions are translucent in the following circumstances: - Light mode: button hover - Dark mode: static button This means they show the alert surface (yellow, red, grey, etc) unintentionally. ## Solution Give each independent action its own FloatingPlate, with transparent gaps between buttons. Explicit groups share one plate; fragments are flattened. Full-width groups retain responsive sizing, while single buttons stay snug. | Before | After | | --- | --- | | CleanShot 2026-10-27 at 15 32
14@2x | CleanShot 2026-10-27 at 15 32
30@2x | ## Review instructions 1. Open [Admonition examples](https://design-system-git-dnywh-fix-admonition-floating-plate-supabase.vercel.app/design-system/docs/fragments/admonition) and find the examples with action buttons. 2. Light mode: hover the default action buttons. 3. Dark mode: just compare against the [production design system](https://supabase.com/design-system/docs/fragments/admonition), statically. Notice the buttons retain their standard fill. --- .../default/example/admonition-responsive.tsx | 7 +++++- .../ui-patterns/src/Admonition/Admonition.tsx | 25 ++++++++++++++++--- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/apps/design-system/registry/default/example/admonition-responsive.tsx b/apps/design-system/registry/default/example/admonition-responsive.tsx index 2e488553f54..524ea8ec715 100644 --- a/apps/design-system/registry/default/example/admonition-responsive.tsx +++ b/apps/design-system/registry/default/example/admonition-responsive.tsx @@ -8,7 +8,12 @@ export default function AdmonitionDemo() { layout="responsive" title="Disk management has moved" description="Disk management is now handled alongside Project Compute on the Compute and Disk page." - actions={} + actions={ + <> + + + + } /> ) } diff --git a/packages/ui-patterns/src/Admonition/Admonition.tsx b/packages/ui-patterns/src/Admonition/Admonition.tsx index a7f3f6ba2ab..6f6b68646e5 100644 --- a/packages/ui-patterns/src/Admonition/Admonition.tsx +++ b/packages/ui-patterns/src/Admonition/Admonition.tsx @@ -1,5 +1,5 @@ -import { forwardRef } from 'react' -import { Alert, AlertDescription, AlertTitle, cn } from 'ui' +import { Children, forwardRef, Fragment, isValidElement, type ReactNode } from 'react' +import { Alert, AlertDescription, AlertTitle, cn, FloatingPlate } from 'ui' import { TYPE_LABEL, TYPE_TO_VARIANT } from './Admonition.constants' import type { AdmonitionLayout, AdmonitionProps, AdmonitionType } from './Admonition.types' @@ -15,6 +15,25 @@ const admonitionBodyClassName = [ '[&_ul>li]:relative [&_ul>li]:before:absolute [&_ul>li]:before:left-[-1rem] [&_ul>li]:before:top-2.5 [&_ul>li]:before:h-0.5 [&_ul>li]:before:w-2 [&_ul>li]:before:rounded [&_ul>li]:before:bg-border-strong [&_ul>li]:before:content-[""]', ].join(' ') +const ActionPlates = ({ children, layout }: { children: ReactNode; layout: AdmonitionLayout }) => + Children.map(children, (action) => { + if (action === null || action === undefined) return null + if (isValidElement<{ children?: ReactNode }>(action) && action.type === Fragment) { + return {action.props.children} + } + return ( + .w-full]:w-full', + layout === 'responsive' && 'has-[>.w-full]:w-full @lg:has-[>.w-full]:w-auto' + )} + > + {action} + + ) + }) + export const Admonition = forwardRef< React.ComponentRef, Omit< @@ -114,7 +133,7 @@ export const Admonition = forwardRef< layout === 'responsive' && 'mt-3 items-start @md:mt-0 @md:items-center' )} > - {actions} + {actions} )}