Files
supabase/apps/docs/components/Feedback/FeedbackModal.tsx
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

129 lines
3.8 KiB
TypeScript

import { zodResolver } from '@hookform/resolvers/zod'
import { SubmitHandler, useForm } from 'react-hook-form'
import {
Button,
Dialog,
DialogContent,
DialogFooter,
DialogHeader,
DialogSection,
DialogSectionSeparator,
DialogTitle,
Form,
FormControl,
FormField,
Input,
Textarea,
} from 'ui'
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
import * as z from 'zod'
const formSchema = z.object({
page: z.string(),
title: z.string().min(1, 'Required'),
comment: z.string().min(1, 'Required'),
})
export type FeedbackFields = z.infer<typeof formSchema>
type FeedbackModalProps = {
visible: boolean
page: string
onCancel: () => void
onSubmit: (values: FeedbackFields) => void
}
function FeedbackModal({ visible, page, onCancel, onSubmit }: FeedbackModalProps) {
const form = useForm<FeedbackFields>({
defaultValues: { page, title: '', comment: '' },
resolver: zodResolver(formSchema),
})
const formId = 'feedback-form'
const { reset } = form
const { isSubmitting } = form.formState
const handleCancel = () => {
reset()
onCancel()
}
const handleSubmit: SubmitHandler<FeedbackFields> = (values) => {
onSubmit(values)
reset()
}
return (
<Dialog open={visible} onOpenChange={() => onCancel()}>
<DialogContent>
<DialogHeader>
<DialogTitle>Leave a comment</DialogTitle>
</DialogHeader>
<DialogSectionSeparator />
<Form {...form}>
<form id={formId} onSubmit={form.handleSubmit(handleSubmit)}>
<DialogSection className="space-y-4">
<input type="hidden" id="page" {...form.register('page')} />
<FormField
control={form.control}
name="title"
render={({ field }) => (
<FormItemLayout layout="vertical" label="Title">
<FormControl className="col-span-6">
<Input {...field} />
</FormControl>
</FormItemLayout>
)}
/>
<FormField
control={form.control}
name="comment"
render={({ field }) => (
<FormItemLayout layout="vertical" label="Comment" afterLabel="(not anonymous)">
<FormControl className="col-span-6">
<Textarea {...field} rows={4} className="resize-none" />
</FormControl>
</FormItemLayout>
)}
/>
<div className="flex gap-2 text-xs text-foreground-light leading-relaxed">
<span className="shrink-0 mt-0.5">💡</span>
<div>
<strong>Need help or support?</strong> This feedback form is for documentation
improvements only. For technical support, please submit a{' '}
<a
href="https://supabase.com/dashboard/support/new"
target="_blank"
rel="noopener noreferrer"
className="text-primary hover:underline"
>
support request
</a>
.
</div>
</div>
</DialogSection>
</form>
</Form>
<DialogFooter>
<div className="flex items-center justify-end gap-2">
<Button type="reset" onClick={handleCancel} disabled={isSubmitting}>
Cancel
</Button>
<Button
variant="primary"
type="submit"
form={formId}
loading={isSubmitting}
disabled={isSubmitting}
>
Submit feedback
</Button>
</div>
</DialogFooter>
</DialogContent>
</Dialog>
)
}
export { FeedbackModal }