-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(website): restore blocks (#382)
- Loading branch information
1 parent
3587d92
commit a650a10
Showing
79 changed files
with
440 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Submodule plus
updated
from 65d1ea to 536f58
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,4 +39,7 @@ next-env.d.ts | |
styled-system | ||
styled-system-studio | ||
|
||
.velite | ||
.velite | ||
|
||
# Blocks | ||
src/components/blocks/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import type { Metadata } from 'next' | ||
import { notFound } from 'next/navigation' | ||
import { Container, Stack } from 'styled-system/jsx' | ||
import { BlockPlayground } from '~/components/examples/block-playground' | ||
import { PageHeader } from '~/components/page-header' | ||
import { blocks } from '.velite' | ||
|
||
interface Props { | ||
params: { | ||
id: string | ||
} | ||
} | ||
|
||
export default async function Page(props: Props) { | ||
const { params } = props | ||
const block = blocks.find((block) => block.id === params.id) | ||
|
||
if (!block) { | ||
return notFound() | ||
} | ||
|
||
return ( | ||
<Container py={{ base: '16', md: '24' }}> | ||
<Stack gap={{ base: '16', md: '24' }}> | ||
<PageHeader heading={block.name} description={block.description} subHeading="Blocks" /> | ||
{block.variants.map((variant) => ( | ||
<BlockPlayground key={variant.id} block={block} variant={variant} /> | ||
))} | ||
</Stack> | ||
</Container> | ||
) | ||
} | ||
|
||
export async function generateMetadata(props: Props): Promise<Metadata> { | ||
const { params } = props | ||
const block = blocks.find((block) => block.id === params.id) | ||
|
||
return block ? { title: block.name, description: block.description } : {} | ||
} | ||
|
||
export const generateStaticParams = () => | ||
['react', 'solid', 'vue'].flatMap((framework) => | ||
blocks.map((block) => ({ framework, id: block.id })), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import type { PropsWithChildren } from 'react' | ||
import { styled } from 'styled-system/jsx' | ||
|
||
export default function Layout(props: PropsWithChildren) { | ||
const { children } = props | ||
|
||
return <styled.main mt="16">{children}</styled.main> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { ImageIcon } from 'lucide-react' | ||
import type { Metadata } from 'next' | ||
import NextLink from 'next/link' | ||
import { Center, Container, Grid, GridItem, HStack, Stack } from 'styled-system/jsx' | ||
import { PageHeader } from '~/components/page-header' | ||
import { Card, Icon, Text } from '~/components/ui' | ||
import { blocks } from '.velite' | ||
|
||
export default async function Page() { | ||
return ( | ||
<Container py={{ base: '16', md: '24' }}> | ||
<Stack gap={{ base: '16', md: '24' }}> | ||
<PageHeader | ||
heading="Get started with Blocks" | ||
subHeading="Blocks" | ||
description="Explore our collection of building blocks to help you design and develop faster." | ||
/> | ||
<Grid gridTemplateColumns={{ base: '1', sm: '2', md: '3' }} gap="8"> | ||
{blocks.map((block) => ( | ||
<NextLink key={block.id} href={`blocks/${block.id}`}> | ||
<GridItem> | ||
<Card.Root boxShadow="sm" overflow="hidden"> | ||
<Card.Header pt="4" p="4"> | ||
<Center bg="bg.subtle" h="48" borderRadius="l2"> | ||
<Icon size="2xl" color="fg.disabled"> | ||
<ImageIcon /> | ||
</Icon> | ||
</Center> | ||
</Card.Header> | ||
<Card.Body> | ||
<HStack gap="2"> | ||
<Text size="lg" fontWeight="semibold"> | ||
{block.name} | ||
</Text> | ||
</HStack> | ||
<Text size="sm" color="fg.muted"> | ||
{block.variantCount} variant{block.variantCount > 1 ? 's' : ''} | ||
</Text> | ||
</Card.Body> | ||
</Card.Root> | ||
</GridItem> | ||
</NextLink> | ||
))} | ||
</Grid> | ||
</Stack> | ||
</Container> | ||
) | ||
} | ||
|
||
export const metadata: Metadata = { | ||
title: 'Blocks', | ||
description: 'Explore our collection of building blocks to help you design and develop faster.', | ||
} | ||
|
||
export const generateStaticParams = () => | ||
['react', 'solid', 'vue'].map((framework) => ({ framework })) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import type { PropsWithChildren } from 'react' | ||
import { styled } from 'styled-system/jsx' | ||
|
||
export default function Layout(props: PropsWithChildren) { | ||
const { children } = props | ||
return <styled.main mt="16">{children}</styled.main> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { HStack } from 'styled-system/jsx' | ||
import { Tabs } from '~/components/ui' | ||
import { CodePreview } from '../code-preview' | ||
import { DownloadButton } from './download-button' | ||
|
||
interface Props { | ||
files: { filename: string; content: string; html: string }[] | ||
} | ||
|
||
export const BlockCodePreview = (props: Props) => { | ||
const { files } = props | ||
return ( | ||
<Tabs.Root | ||
defaultValue={files[0]?.filename} | ||
borderRadius="l3" | ||
overflow="hidden" | ||
borderWidth="1px" | ||
size="sm" | ||
> | ||
<HStack | ||
justify="space-between" | ||
bg="gray.dark.1" | ||
boxShadow="0 -1px 0 0 inset var(--colors-gray-dark-4)" | ||
pe="1" | ||
> | ||
<Tabs.List pt="1.5" boxShadow="none" ps="4"> | ||
{files.map(({ filename }) => ( | ||
<Tabs.Trigger | ||
key={filename} | ||
value={filename} | ||
color="gray.dark.11" | ||
_selected={{ color: 'white' }} | ||
pb="2" | ||
> | ||
{filename} | ||
</Tabs.Trigger> | ||
))} | ||
<Tabs.Indicator bg="accent.default" /> | ||
</Tabs.List> | ||
<DownloadButton name="File" files={files} /> | ||
</HStack> | ||
{files.map(({ filename, content, html }) => ( | ||
<Tabs.Content key={filename} value={filename} p="0!"> | ||
<CodePreview code={content} html={html} /> | ||
</Tabs.Content> | ||
))} | ||
</Tabs.Root> | ||
) | ||
} |
Oops, something went wrong.