Skip to content

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

container queries basics (#34724)

Saxon Fletcher5fe1bdd54dff
diff --git a/apps/studio/components/interfaces/DiskManagement/fields/ComputeSizeField.tsx b/apps/studio/components/interfaces/DiskManagement/fields/ComputeSizeField.tsx
index d0902379a0f..18a55e76282 100644
--- a/apps/studio/components/interfaces/DiskManagement/fields/ComputeSizeField.tsx
+++ b/apps/studio/components/interfaces/DiskManagement/fields/ComputeSizeField.tsx
@@ -123,7 +123,7 @@ export function ComputeSizeField({ form, disabled }: ComputeSizeFieldProps) {
layout="horizontal"
label={'Compute size'}
id={field.name}
- className="md:flex lg:grid gap-4 lg:gap-2"
+ className="gap-5"
labelOptional={
<>
<BillingChangeBadge
@@ -159,7 +159,13 @@ export function ComputeSizeField({ form, disabled }: ComputeSizeFieldProps) {
</>
}
>
- <div className={!addonsError ? 'grid grid-cols-2 xl:grid-cols-3 flex-wrap gap-3' : ''}>
+ <div
+ className={
+ !addonsError
+ ? 'grid gap-4 grid-cols-[repeat(auto-fit,minmax(min(100%,13em),1fr))]'
+ : ''
+ }
+ >
{isLoading ? (
Array(10)
.fill(0)
diff --git a/apps/studio/components/interfaces/DiskManagement/fields/DiskSizeField.tsx b/apps/studio/components/interfaces/DiskManagement/fields/DiskSizeField.tsx
index 440f540fcb6..160445149b5 100644
--- a/apps/studio/components/interfaces/DiskManagement/fields/DiskSizeField.tsx
+++ b/apps/studio/components/interfaces/DiskManagement/fields/DiskSizeField.tsx
@@ -95,7 +95,7 @@ export function DiskSizeField({
const mainDiskUsed = Math.round(((diskUtil?.metrics.fs_used_bytes ?? 0) / GB) * 100) / 100
return (
- <div className="grid grid-cols-12 gap-5">
+ <div className="grid @xl:grid-cols-12 gap-5">
<div className="col-span-4">
<FormField_Shadcn_
name="totalSize"
diff --git a/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx b/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx
index 892ece793e8..7aa88abc93e 100644
--- a/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx
+++ b/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx
@@ -208,7 +208,7 @@ const ProjectLayout = forwardRef<HTMLDivElement, PropsWithChildren<ProjectLayout
className={cn('w-full xl:min-w-[600px] bg-dash-sidebar')}
>
<main
- className="h-full flex flex-col flex-1 w-full overflow-y-auto overflow-x-hidden"
+ className="h-full flex flex-col flex-1 w-full overflow-y-auto overflow-x-hidden @container [contain:layout]"
ref={ref}
>
{showPausedState ? (
diff --git a/apps/studio/components/layouts/Scaffold.tsx b/apps/studio/components/layouts/Scaffold.tsx
index 7021c6249df..457073a9cb5 100644
--- a/apps/studio/components/layouts/Scaffold.tsx
+++ b/apps/studio/components/layouts/Scaffold.tsx
@@ -1,11 +1,8 @@
import { forwardRef, HTMLAttributes } from 'react'
-
-import { useAiAssistantStateSnapshot } from 'state/ai-assistant-state'
import { cn } from 'ui'
export const MAX_WIDTH_CLASSES = 'mx-auto w-full max-w-[1200px]'
-export const PADDING_CLASSES = 'px-6 lg:px-14 xl:px-24 2xl:px-32'
-// const PADDING_CLASSES = 'px-10'
+export const PADDING_CLASSES = 'px-4 @lg:px-6 @xl:px-12 @2xl:px-20 @3xl:px-24'
export const MAX_WIDTH_CLASSES_COLUMN = 'min-w-[420px]'
/**
@@ -25,8 +22,6 @@ export const ScaffoldContainer = forwardRef<
size?: 'small' | 'default' | 'large' | 'full'
}
>(({ className, bottomPadding, size = 'default', ...props }, ref) => {
- const snap = useAiAssistantStateSnapshot()
-
const maxWidthClass = {
small: 'max-w-[768px]',
default: 'max-w-[1200px]',
@@ -43,7 +38,6 @@ export const ScaffoldContainer = forwardRef<
maxWidthClass,
PADDING_CLASSES,
bottomPadding && 'pb-16',
- snap.open ? 'xl:px-6' : '',
className
)}
/>
diff --git a/apps/studio/package.json b/apps/studio/package.json
index 314e696dbe9..32281717a57 100644
--- a/apps/studio/package.json
+++ b/apps/studio/package.json
@@ -133,6 +133,7 @@
"@aws-sdk/client-secrets-manager": "^3.410.0",
"@radix-ui/react-use-escape-keydown": "^1.0.3",
"@supabase/postgres-meta": "^0.64.4",
+ "@tailwindcss/container-queries": "^0.1.1",
"@testing-library/dom": "^9.3.3",
"@testing-library/jest-dom": "^6.4.6",
"@testing-library/react": "^14.0.0",
diff --git a/apps/studio/tailwind.config.js b/apps/studio/tailwind.config.js
index ee13f7833a8..a14ec73922e 100644
--- a/apps/studio/tailwind.config.js
+++ b/apps/studio/tailwind.config.js
@@ -9,6 +9,7 @@ module.exports = config({
'./../../packages/ui-patterns/**/*.{tsx,ts,js}',
'!./../../packages/ui-patterns/node_modules/**/*', // ignore node_modules rule
],
+ plugins: [require('@tailwindcss/container-queries')],
theme: {
extend: {
fontSize: {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index da8dceb9e32..b620cecc15c 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -335,7 +335,7 @@ importers:
version: 1.0.1
next:
specifier: 'catalog:'
next-mdx-remote:
specifier: ^4.4.1
@@ -854,6 +854,9 @@ importers:
'@supabase/postgres-meta':
specifier: ^0.64.4
+ '@tailwindcss/container-queries':
+ specifier: ^0.1.1
'@testing-library/dom':
specifier: ^9.3.3
version: 9.3.4
@@ -1277,7 +1280,7 @@ importers:
version: 1.2.0
next:
specifier: 'catalog:'
next-contentlayer2:
specifier: 0.5.3
@@ -1531,7 +1534,7 @@ importers:
version: 0.7.12
'@vercel/flags':
specifier: ^2.6.0
api-types:
specifier: workspace:*
version: link:../api-types
@@ -1546,7 +1549,7 @@ importers:
version: 4.17.21
next:
specifier: 'catalog:'
next-themes:
specifier: ^0.3.0
@@ -1824,7 +1827,7 @@ importers:
version: 0.436.0([email protected])
next:
specifier: 'catalog:'
next-themes:
specifier: ^0.3.0
@@ -1978,7 +1981,7 @@ importers:
version: 0.33.0
next:
specifier: 'catalog:'
next-themes:
specifier: '*'
@@ -2087,7 +2090,7 @@ importers:
version: link:../api-types
next-router-mock:
specifier: ^0.9.13
typescript:
specifier: ~5.5.0
version: 5.5.2
@@ -8819,6 +8822,7 @@ packages:
resolution: {integrity: sha512-t0q23FIpvHDTtnORW+bDJziGsal5uh9RJTJ1fyH8drd4lICOoXhJ5pLMUZ5C0VQei6dNmwTzzoTRgMkO9JgHEQ==}
peerDependencies:
eslint: '>= 5'
+ bundledDependencies: []
resolution: {integrity: sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==}
@@ -21514,14 +21518,6 @@ snapshots:
react: 18.2.0
react-dom: 18.2.0([email protected])
- dependencies:
- jose: 5.2.1
- optionalDependencies:
- react: 18.2.0
- react-dom: 18.2.0([email protected])
-
dependencies:
'@mapbox/node-pre-gyp': 2.0.0([email protected])([email protected])
@@ -27744,7 +27740,7 @@ snapshots:
'@contentlayer2/utils': 0.5.3
react: 18.2.0
react-dom: 18.2.0([email protected])
transitivePeerDependencies:
@@ -27773,14 +27769,9 @@ snapshots:
react: 18.2.0
- dependencies:
- react: 18.2.0
-
dependencies:
react: 18.2.0
react-dom: 18.2.0([email protected])
@@ -28137,7 +28128,7 @@ snapshots:
dependencies:
mitt: 3.0.1
dependencies: