Files
supabase/apps/studio/components/interfaces/QueryPerformance/QueryPanel.tsx
T
Danny White ec53175b8a refactor(ui): rename text-brand to text-primary (#50564)
## What kind of change does this PR introduce?

Refactor. Follow-up to #49871.

## What is the current behavior?

Branded (green) text still uses the `text-brand` classname while the
colour comes from `--primary`.

## What is the new behavior?

**Rename-only:** `text-brand` → `text-primary` across callsites and
docs. Leftover `bg-brand` / `border-brand` alias to `brand-default`. No
intentional colour changes in this PR.

This better matches how we treat our green in other components and
props, like `variant="primary"` for green buttons.

## To test

On light mode: smoke-test that branded text still looks like #49871
(readable green, not the bright fill).

-
[Homepage](https://zone-www-dot-com-git-dnywh-depr-316-text-brand-de2380-supabase.vercel.app/):
“Scale to millions” uses `text-primary`
- [Docs
homepage](https://docs-git-dnywh-depr-316-text-brand-to-primary-supabase.vercel.app/docs):
branded links like “More on self-hosting” are still readable
- [Typography
docs](https://design-system-git-dnywh-depr-316-text-brand-to-primary-supabase.vercel.app/design-system/docs/typography):
documents `text-primary`
- [Colour
usage](https://design-system-git-dnywh-depr-316-text-brand-to-primary-supabase.vercel.app/design-system/docs/color-usage):
`text-primary` is visibly darker than `bg-brand-default` _on light mode_
- [Studio auth
providers](https://studio-staging-git-dnywh-depr-316-text-brand-to-60fa6c-supabase.vercel.app/dashboard/project/_/auth/providers):
enabled provider badge text readable; status dot stays bright green

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Style**
* Updated branded text, link hover states, icons, badges, indicators,
and highlighted content across the Design System, Docs, Studio, Learn,
UI Library, and marketing experiences to use the primary theme color.
* Updated syntax highlighting and table-of-contents styling for
consistent primary-color presentation.
  * Refined brand color fallback behavior for bright fills and borders.

* **Documentation**
* Updated color-usage and typography guidance to recommend the primary
text utility.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-22 16:19:03 +10:00

94 lines
3.1 KiB
TypeScript

import { InformationCircleIcon } from '@heroicons/react/16/solid'
import { ArrowDown, ArrowUp } from 'lucide-react'
import { PropsWithChildren } from 'react'
import { cn, Tooltip, TooltipContent, TooltipTrigger } from 'ui'
export const QueryPanelContainer = ({
children,
className,
}: PropsWithChildren<{ className?: string }>) => (
<div className={cn('flex flex-col gap-y-0 py-4', className)}>{children}</div>
)
export const QueryPanelSection = ({
children,
className,
}: PropsWithChildren<{ className?: string }>) => (
<div className={cn('px-6 flex flex-col gap-y-0', className)}>{children}</div>
)
export const QueryPanelScoreSection = ({
className,
name,
description,
before: rawBefore,
after: rawAfter,
hideArrowMarkers = false,
}: {
className?: string
name: string
description: string
before?: number
after?: number
hideArrowMarkers?: boolean
}) => {
const before = rawBefore !== undefined ? Number(rawBefore) : undefined
const after = rawAfter !== undefined ? Number(rawAfter) : undefined
return (
<div className={cn('py-4 px-4 flex', className)}>
<div className="flex gap-x-2 w-48">
<span className="text-sm">{name}</span>
<Tooltip>
<TooltipTrigger asChild className="mt-1">
<InformationCircleIcon className="transition text-foreground-muted w-3 h-3 data-[state=delayed-open]:text-foreground-light" />
</TooltipTrigger>
<TooltipContent side="top" className="w-52 text-center">
{description}
</TooltipContent>
</Tooltip>
</div>
<div className="flex flex-col gap-y-1">
<div className="flex gap-x-2 text-sm">
<span className="text-foreground-light w-20">Currently:</span>
<span
className={cn(
'font-mono',
before !== undefined && after !== undefined && before !== after
? 'text-foreground-light'
: ''
)}
>
{before}
</span>
</div>
{before !== undefined && after !== undefined && before !== after && (
<div className="flex items-center gap-x-2 text-sm">
<span className="text-foreground-light w-20">With index:</span>
<span className="font-mono">{after}</span>
{before !== undefined && !hideArrowMarkers && (
<div className="flex items-center gap-x-1">
{after > before ? (
<ArrowUp size={14} className="text-warning" />
) : (
<ArrowDown size={14} className="text-primary" />
)}
{before !== 0 && !isNaN(before) && isFinite(before) && (
<span
className={cn(
'font-mono tracking-tighter',
after > before ? 'text-warning' : 'text-primary'
)}
>
{(((before - after) / before) * 100).toFixed(2)}%
</span>
)}
</div>
)}
</div>
)}
</div>
</div>
)
}