Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: uniform card and panel padding-x (#41237)

Francesco Sansalvadore263730a8b8bb
diff --git a/apps/studio/components/interfaces/Database/Roles/RoleRow.tsx b/apps/studio/components/interfaces/Database/Roles/RoleRow.tsx
index b4d03690567..87622057466 100644
--- a/apps/studio/components/interfaces/Database/Roles/RoleRow.tsx
+++ b/apps/studio/components/interfaces/Database/Roles/RoleRow.tsx
@@ -93,7 +93,7 @@ export const RoleRow = ({ role, disabled = false, onSelectDelete }: RoleRowProps
<button
id="collapsible-trigger"
type="button"
- className="group flex w-full items-center justify-between rounded py-3 px-4 md:px-6 text-foreground"
+ className="group flex w-full items-center justify-between rounded py-3 px-[var(--card-padding-x)] text-foreground"
onClick={(event: any) => {
if (event.target.id === 'collapsible-trigger') setIsExpanded(!isExpanded)
}}
diff --git a/apps/studio/components/interfaces/Database/Roles/RolesList.tsx b/apps/studio/components/interfaces/Database/Roles/RolesList.tsx
index a84ba3267b0..85740250253 100644
--- a/apps/studio/components/interfaces/Database/Roles/RolesList.tsx
+++ b/apps/studio/components/interfaces/Database/Roles/RolesList.tsx
@@ -186,7 +186,7 @@ export const RolesList = () => {
<div className="space-y-4">
<div>
- <div className="bg-surface-100 border border-default px-4 md:px-6 py-3 rounded-t flex items-center space-x-4">
+ <div className="bg-surface-100 border border-default px-[var(--card-padding-x)] py-3 rounded-t flex items-center space-x-4">
<p className="text-sm text-foreground-light">Roles managed by Supabase</p>
<Badge variant="success">Protected</Badge>
</div>
@@ -204,7 +204,7 @@ export const RolesList = () => {
</div>
<div>
- <div className="bg-surface-100 border border-default px-4 md:px-6 py-3 rounded-t">
+ <div className="bg-surface-100 border border-default px-[var(--card-padding-x)] py-3 rounded-t">
<p className="text-sm text-foreground-light">Other database roles</p>
</div>
diff --git a/apps/studio/components/interfaces/DiskManagement/DiskManagementForm.tsx b/apps/studio/components/interfaces/DiskManagement/DiskManagementForm.tsx
index 587a6f0840e..17366836588 100644
--- a/apps/studio/components/interfaces/DiskManagement/DiskManagementForm.tsx
+++ b/apps/studio/components/interfaces/DiskManagement/DiskManagementForm.tsx
@@ -441,7 +441,7 @@ export function DiskManagementForm() {
open={advancedSettingsOpen}
onOpenChange={() => setAdvancedSettingsOpenState((prev) => !prev)}
>
- <CollapsibleTrigger_Shadcn_ className="px-8 py-3 w-full border flex items-center gap-6 rounded-t data-[state=closed]:rounded-b group justify-between">
+ <CollapsibleTrigger_Shadcn_ className="px-[var(--card-padding-x)] py-3 w-full border flex items-center gap-6 rounded-t data-[state=closed]:rounded-b group justify-between">
<div className="flex flex-col items-start">
<span className="text-sm text-foreground">Advanced disk settings</span>
<span className="text-sm text-foreground-light text-left">
@@ -462,11 +462,11 @@ export function DiskManagementForm() {
)}
>
<div className="flex flex-col gap-y-8 py-8">
- <div className="px-8 flex flex-col gap-y-8">
+ <div className="px-[var(--card-padding-x)] flex flex-col gap-y-8">
<AutoScaleFields form={form} />
</div>
<Separator />
- <div className="px-8 flex flex-col gap-y-8">
+ <div className="px-[var(--card-padding-x)] flex flex-col gap-y-8">
<NoticeBar
type="default"
visible={disableIopsThroughputConfig}
diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/BillingEmail.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/BillingEmail.tsx
index a2eb98849a5..8fa0edae540 100644
--- a/apps/studio/components/interfaces/Organization/BillingSettings/BillingEmail.tsx
+++ b/apps/studio/components/interfaces/Organization/BillingSettings/BillingEmail.tsx
@@ -117,7 +117,7 @@ const BillingEmail = () => {
<form id={FORM_ID} onSubmit={form.handleSubmit(onUpdateOrganizationEmail)}>
<FormPanel
footer={
- <div className="flex py-4 px-8">
+ <div className="flex py-4 px-[var(--card-padding-x)]">
<FormActions
form={FORM_ID}
isSubmitting={isUpdating}
diff --git a/apps/studio/components/interfaces/Organization/SSO/SSOConfig.tsx b/apps/studio/components/interfaces/Organization/SSO/SSOConfig.tsx
index aeec264cca6..da606e0cd4f 100644
--- a/apps/studio/components/interfaces/Organization/SSO/SSOConfig.tsx
+++ b/apps/studio/components/interfaces/Organization/SSO/SSOConfig.tsx
@@ -180,7 +180,7 @@ export const SSOConfig = () => {
<Form_Shadcn_ {...form}>
<form id={FORM_ID} onSubmit={form.handleSubmit(onSubmit)}>
<Card>
- <CardContent className="py-8">
+ <CardContent>
<FormField_Shadcn_
control={form.control}
name="enabled"
diff --git a/apps/studio/components/interfaces/Settings/API/PostgrestConfig.tsx b/apps/studio/components/interfaces/Settings/API/PostgrestConfig.tsx
index 29c7fd44ccf..cbc8668829d 100644
--- a/apps/studio/components/interfaces/Settings/API/PostgrestConfig.tsx
+++ b/apps/studio/components/interfaces/Settings/API/PostgrestConfig.tsx
@@ -216,7 +216,7 @@ export const PostgrestConfig = () => {
render={({ field }) => (
<FormItem_Shadcn_ className="w-full">
<FormItemLayout
- className="w-full px-8 py-8"
+ className="w-full px-[var(--card-padding-x)] py-4"
layout="flex"
label="Enable Data API"
description="When enabled you will be able to use any Supabase client library and PostgREST endpoints with any schema configured below."
@@ -279,7 +279,7 @@ export const PostgrestConfig = () => {
description="The schemas to expose in your API. Tables, views and stored procedures in
these schemas will get API endpoints."
layout="horizontal"
- className="px-8 py-8"
+ className="px-[var(--card-padding-x)] py-4"
>
{isLoadingSchemas ? (
<div className="col-span-12 flex flex-col gap-2 lg:col-span-7">
@@ -358,7 +358,7 @@ export const PostgrestConfig = () => {
render={({ field }) => (
<FormItem_Shadcn_ className="w-full">
<FormItemLayout
- className="w-full px-8 py-8"
+ className="w-full px-[var(--card-padding-x)] py-4"
layout="horizontal"
label="Extra search path"
description="Extra schemas to add to the search path of every request."
@@ -409,7 +409,7 @@ export const PostgrestConfig = () => {
render={({ field }) => (
<FormItem_Shadcn_ className="w-full">
<FormItemLayout
- className="w-full px-8 py-8"
+ className="w-full px-[var(--card-padding-x)] py-4"
layout="horizontal"
label="Max rows"
description="The maximum number of rows returned from a view, table, or stored procedure. Limits payload size for accidental or malicious requests."
@@ -436,7 +436,7 @@ export const PostgrestConfig = () => {
render={({ field }) => (
<FormItem_Shadcn_ className="w-full">
<FormItemLayout
- className="w-full px-8 py-8"
+ className="w-full px-[var(--card-padding-x)] py-4"
layout="horizontal"
label="Pool size"
description="Number of maximum connections to keep open in the Data API server's database pool. Unset to let it be configured automatically based on compute size."
diff --git a/apps/studio/components/interfaces/Settings/General/CustomDomainConfig/CustomDomainsConfigureHostname.tsx b/apps/studio/components/interfaces/Settings/General/CustomDomainConfig/CustomDomainsConfigureHostname.tsx
index f04b1e9d179..7106ee78bcc 100644
--- a/apps/studio/components/interfaces/Settings/General/CustomDomainConfig/CustomDomainsConfigureHostname.tsx
+++ b/apps/studio/components/interfaces/Settings/General/CustomDomainConfig/CustomDomainsConfigureHostname.tsx
@@ -66,7 +66,7 @@ const CustomDomainsConfigureHostname = () => {
<FormPanel
disabled={!canConfigureCustomDomain}
footer={
- <div className="flex py-4 px-8">
+ <div className="flex py-4 px-[var(--card-padding-x)]">
<FormActions
form={FORM_ID}
isSubmitting={isCheckingRecord || isCreating}
diff --git a/apps/studio/components/interfaces/Settings/General/General.tsx b/apps/studio/components/interfaces/Settings/General/General.tsx
index f1900b6662a..8b70571f408 100644
--- a/apps/studio/components/interfaces/Settings/General/General.tsx
+++ b/apps/studio/components/interfaces/Settings/General/General.tsx
@@ -101,7 +101,7 @@ export const General = () => {
<FormPanel
disabled={!canUpdateProject}
footer={
- <div className="flex py-4 px-8">
+ <div className="flex py-4 px-[var(--card-padding-x)]">
<FormActions
form={formId}
isSubmitting={isUpdating}
@@ -139,7 +139,7 @@ export const General = () => {
)}
<div className="mt-6" id="restart-project">
<FormPanel>
- <div className="flex flex-col px-8 py-4">
+ <div className="flex flex-col py-4 px-[var(--card-padding-x)]">
<div className="flex flex-col @lg:flex-row @lg:justify-between @lg:items-center gap-4">
<div>
<p className="text-sm">
@@ -155,7 +155,7 @@ export const General = () => {
</div>
</div>
<div
- className="flex w-full flex-col @lg:flex-row @lg:justify-between @lg:items-center gap-4 px-8 py-4"
+ className="flex w-full flex-col @lg:flex-row @lg:justify-between @lg:items-center gap-4 px-[var(--card-padding-x)] py-4"
id="pause-project"
>
<div>
diff --git a/apps/studio/components/ui/Forms/FormSection.tsx b/apps/studio/components/ui/Forms/FormSection.tsx
index 714ee501fb0..3a6356d2281 100644
--- a/apps/studio/components/ui/Forms/FormSection.tsx
+++ b/apps/studio/components/ui/Forms/FormSection.tsx
@@ -16,7 +16,7 @@ export const FormSection = ({
className?: string
}) => {
const classes = [
- 'grid grid-cols-12 gap-6 px-4 md:px-8 py-4 md:py-8',
+ 'grid grid-cols-12 gap-6 px-[var(--card-padding-x)] py-4 md:py-8',
`${disabled ? ' opacity-30' : ' opacity-100'}`,
`${className}`,
]
diff --git a/apps/studio/components/ui/Panel.tsx b/apps/studio/components/ui/Panel.tsx
index dfe3ad4cc68..b8959cde67f 100644
--- a/apps/studio/components/ui/Panel.tsx
+++ b/apps/studio/components/ui/Panel.tsx
@@ -34,7 +34,7 @@ function Panel(props: PropsWithChildren<PanelProps>) {
{props.title && (
<div
className={cn(
- 'bg-surface-100 border-b border-default flex items-center px-4 py-4',
+ 'bg-surface-100 border-b border-default flex items-center px-[var(--card-padding-x)] py-4',
props.titleClasses
)}
>
@@ -54,13 +54,13 @@ function Panel(props: PropsWithChildren<PanelProps>) {
}
function Content({ children, className }: { children: ReactNode; className?: string | false }) {
- return <div className={cn('px-4 py-4', className)}>{children}</div>
+ return <div className={cn('px-[var(--card-padding-x)] py-4', className)}>{children}</div>
}
function Footer({ children, className }: { children: ReactNode; className?: string }) {
return (
<div className={cn('bg-surface-100 border-t border-default', className)}>
- <div className="flex h-12 items-center px-4">{children}</div>
+ <div className="flex h-12 items-center px-[var(--card-padding-x)]">{children}</div>
</div>
)
}
@@ -95,7 +95,7 @@ const PanelNotice = forwardRef<
ref={ref}
{...props}
className={cn(
- 'relative px-4 py-5 bg-studio flex flex-col lg:flex-row lg:justify-between gap-6 overflow-hidden lg:items-center',
+ 'relative px-[var(--card-padding-x)] py-5 bg-studio flex flex-col lg:flex-row lg:justify-between gap-6 overflow-hidden lg:items-center',
layout === 'vertical' && '!flex-col !items-start gap-y-2',
className
)}
diff --git a/packages/ui/build/css/source/global.css b/packages/ui/build/css/source/global.css
index fec2248841c..8a8d1d26779 100644
--- a/packages/ui/build/css/source/global.css
+++ b/packages/ui/build/css/source/global.css
@@ -126,6 +126,10 @@
--icon-md: 18px;
--iconwidth-default: 1px;
--panel: 2px;
+ --padding-x-sm: 1rem; /* px-4 */
+ --padding-x-md: 1.5rem; /* px-6 */
+ --card-padding-x: var(--padding-x-sm);
+ --card-padding-x-md: var(--padding-x-md);
--datatable-headericon: 16px;
--datatable-rowheight: 28px;
--options-icon: 18px;
diff --git a/packages/ui/src/components/shadcn/ui/card.tsx b/packages/ui/src/components/shadcn/ui/card.tsx
index e72a26a4066..19db1bd8de6 100644
--- a/packages/ui/src/components/shadcn/ui/card.tsx
+++ b/packages/ui/src/components/shadcn/ui/card.tsx
@@ -20,7 +20,10 @@ const CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDiv
({ className, ...props }, ref) => (
<div
ref={ref}
- className={cn('flex flex-col space-y-1.5 py-4 px-6 border-b', className)}
+ className={cn(
+ 'flex flex-col space-y-1.5 py-4 px-[var(--card-padding-x)] border-b',
+ className
+ )}
{...props}
/>
)
@@ -44,14 +47,22 @@ CardDescription.displayName = 'CardDescription'
const CardContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
({ className, ...props }, ref) => (
- <div ref={ref} className={cn('py-4 px-6 border-b last:border-none', className)} {...props} />
+ <div
+ ref={ref}
+ className={cn('py-4 px-[var(--card-padding-x)] border-b last:border-none', className)}
+ {...props}
+ />
)
)
CardContent.displayName = 'CardContent'
const CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
({ className, ...props }, ref) => (
- <div ref={ref} className={cn(' flex items-center py-4 px-6', className)} {...props} />
+ <div
+ ref={ref}
+ className={cn('flex items-center py-4 px-[var(--card-padding-x)]', className)}
+ {...props}
+ />
)
)
CardFooter.displayName = 'CardFooter'