Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/components/site/ComponentCatalogBrowser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ function countByCategory(items: { category: string }[]) {
return counts
}

function componentRequestUrl(repoUrl: string, component: UpcomingComponent) {
const params = new URLSearchParams({
area: 'New component',
proposal: `Ship ${component.title} (${component.slug}) as a Payload Components post component.`,
template: 'feature_request.yml',
title: `[feature] ${component.slug}`,
})

return `${repoUrl}/issues/new?${params.toString()}`
}

export function ComponentCatalogBrowser({
categories,
families,
Expand Down Expand Up @@ -273,7 +284,11 @@ export function ComponentCatalogBrowser({
) : null}
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">
{postsCards.map((component) => (
<UpcomingComponentCard key={component.slug} component={component} />
<UpcomingComponentCard
key={component.slug}
component={component}
requestHref={componentRequestUrl(githubRepoUrl, component)}
/>
))}
</div>
</div>
Expand Down
26 changes: 22 additions & 4 deletions src/components/site/ComponentGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,13 @@ function ComponentThumb({ muted = false, slug }: { muted?: boolean; slug: string
/* Cards */
/* ------------------------------------------------------------------ */

export function UpcomingComponentCard({ component }: { component: UpcomingComponent }) {
export function UpcomingComponentCard({
component,
requestHref,
}: {
component: UpcomingComponent
requestHref?: string
}) {
return (
<article className="flex flex-col overflow-hidden rounded-xl border border-dashed border-border bg-card/50">
<ComponentThumb muted slug={component.slug} />
Expand All @@ -154,9 +160,21 @@ export function UpcomingComponentCard({ component }: { component: UpcomingCompon
<p className="line-clamp-2 text-xs leading-5 text-muted-foreground">
{component.description}
</p>
<span className="mt-auto truncate pt-1 font-mono text-[10px] uppercase tracking-eyebrow text-muted-foreground">
{component.target}
</span>
<div className="mt-auto flex items-center justify-between gap-3 pt-1">
<span className="truncate font-mono text-[10px] uppercase tracking-eyebrow text-muted-foreground">
{component.target}
</span>
{requestHref ? (
<a
href={requestHref}
target="_blank"
rel="noreferrer"
className="shrink-0 text-xs font-medium text-foreground transition-colors hover:text-brand"
>
Request
</a>
) : null}
</div>
</div>
</article>
)
Expand Down
22 changes: 22 additions & 0 deletions tests/e2e/frontend.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
landingSections,
primaryInstallCommand,
terminalDemoLines,
upcomingComponents,
} from '../../src/lib/site'

const baseURL = `http://localhost:${process.env.E2E_PORT ?? '3100'}`
Expand Down Expand Up @@ -273,6 +274,27 @@ test.describe('Light shadcn frontend', () => {
await expect(page.locator('#hero-basic')).toBeHidden()
})

test('links upcoming components to prefilled request issues', async ({ page }) => {
const component = upcomingComponents.find((entry) => entry.slug === 'post-card')!

await page.goto(`${baseURL}/components?type=posts`)

const requestLink = page.getByRole('link', { name: 'Request' }).first()
await expect(requestLink).toBeVisible()
await expect(requestLink).toHaveAttribute(
'href',
new RegExp(
`/issues/new\\?${[
'area=New\\+component',
'proposal=Ship\\+Post\\+Card\\+%28post-card%29\\+as\\+a\\+Payload\\+Components\\+post\\+component\\.',
'template=feature_request\\.yml',
'title=%5Bfeature%5D\\+post-card',
].join('.*')}`,
),
)
await expect(page.getByText(component.title).first()).toBeVisible()
})

test('exposes every landing section, the catalog teaser, and the footer', async ({ page }) => {
await page.goto(baseURL)

Expand Down