mirror of
https://github.com/supabase/supabase.git
synced 2026-06-08 10:33:55 +08:00
support multiple columns on featured grid in go pages (#43717)
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES/NO ## What kind of change does this PR introduce? Bug fix, feature, docs update, ... ## What is the current behavior? Please link any relevant issues here. ## What is the new behavior? Feel free to include screenshots if it includes visual changes. ## Additional context Add any other context or screenshots.
This commit is contained in:
@@ -27,6 +27,7 @@ const page: GoPageInput = {
|
||||
type: 'feature-grid',
|
||||
title: 'Your cloud, operated by Supabase',
|
||||
description: 'Get the full power of Supabase deployed inside your own infrastructure.',
|
||||
columns: 2,
|
||||
items: [
|
||||
{
|
||||
title: 'Control where your data goes',
|
||||
|
||||
@@ -207,6 +207,10 @@ export const featureGridSectionSchema = z.object({
|
||||
type: z.literal('feature-grid'),
|
||||
title: z.string().optional(),
|
||||
description: z.string().optional(),
|
||||
columns: z
|
||||
.union([z.literal(1), z.literal(2), z.literal(3)])
|
||||
.optional()
|
||||
.default(3),
|
||||
items: z.array(featureGridItemSchema).min(1).max(6),
|
||||
})
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ import { cn } from 'ui'
|
||||
import type { GoFeatureGridSection } from '../schemas'
|
||||
|
||||
export default function FeatureGridSection({ section }: { section: GoFeatureGridSection }) {
|
||||
const { items } = section
|
||||
const hasSecondRow = items.length > 3
|
||||
const { items, columns = 3 } = section
|
||||
const hasSecondRow = items.length > columns
|
||||
|
||||
return (
|
||||
<div className="max-w-[80rem] mx-auto px-8">
|
||||
@@ -19,12 +19,17 @@ export default function FeatureGridSection({ section }: { section: GoFeatureGrid
|
||||
</div>
|
||||
)}
|
||||
<div className="border border-muted rounded-xl overflow-hidden">
|
||||
<div className="grid grid-cols-1 md:grid-cols-3">
|
||||
<div
|
||||
className={cn(
|
||||
'grid grid-cols-1',
|
||||
columns === 1 ? 'md:grid-cols-1' : columns === 2 ? 'md:grid-cols-2' : 'md:grid-cols-3'
|
||||
)}
|
||||
>
|
||||
{items.map((item, i) => {
|
||||
const col = i % 3
|
||||
const row = Math.floor(i / 3)
|
||||
const isLastCol = col === 2 || i === items.length - 1
|
||||
const isLastRow = !hasSecondRow || row === 1
|
||||
const col = i % columns
|
||||
const row = Math.floor(i / columns)
|
||||
const isLastCol = col === columns - 1 || i === items.length - 1
|
||||
const isLastRow = !hasSecondRow || row === Math.floor((items.length - 1) / columns)
|
||||
|
||||
return (
|
||||
<div
|
||||
|
||||
Reference in New Issue
Block a user