-
Notifications
You must be signed in to change notification settings - Fork 21
fix: demo css issues #67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
eec166b
chore: update copy-stack-src script and CSS imports in demo projects …
olliethedev 4cfa6df
fix: update key for UIBuilderPluginOverrides in demo project
olliethedev 029ee91
fix: update redirect and links in form-builder demo to point to new f…
olliethedev 778f889
fix: update key for AiChatPluginOverrides in layout to use hyphenated…
olliethedev 475e289
feat: add articles page and individual article view with dynamic meta…
olliethedev 8027bdb
feat: add 'Live Demo' link to the form-builder layout for enhanced na…
olliethedev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,82 @@ | ||
| import { myStack } from "@/lib/stack"; | ||
| import Link from "next/link"; | ||
| import { notFound } from "next/navigation"; | ||
| import type { Metadata } from "next"; | ||
|
|
||
| export const dynamic = "force-dynamic"; | ||
|
|
||
| type ArticleData = { | ||
| title: string; | ||
| summary: string; | ||
| body: string; | ||
| publishedAt?: string; | ||
| published: boolean; | ||
| }; | ||
|
|
||
| export async function generateMetadata({ | ||
| params, | ||
| }: { | ||
| params: Promise<{ slug: string }>; | ||
| }): Promise<Metadata> { | ||
| const { slug } = await params; | ||
| const item = await myStack.api.cms.getContentItemBySlug("article", slug); | ||
| if (!item) return { title: "Not Found" }; | ||
| const data = item.parsedData as ArticleData; | ||
| return { | ||
| title: data.title, | ||
| description: data.summary, | ||
| }; | ||
| } | ||
|
|
||
| export default async function ArticlePage({ | ||
| params, | ||
| }: { | ||
| params: Promise<{ slug: string }>; | ||
| }) { | ||
| const { slug } = await params; | ||
| const item = await myStack.api.cms.getContentItemBySlug("article", slug); | ||
|
|
||
| if (!item) notFound(); | ||
|
|
||
| const data = item.parsedData as ArticleData; | ||
|
|
||
| return ( | ||
| <div className="max-w-3xl mx-auto px-4 py-12"> | ||
| <Link | ||
| href="/pages/articles" | ||
| className="inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors mb-10" | ||
| > | ||
| ← All articles | ||
| </Link> | ||
|
|
||
| <article> | ||
| <header className="mb-8"> | ||
| <h1 className="text-3xl font-bold mb-3">{data.title}</h1> | ||
| {data.publishedAt && ( | ||
| <time className="text-sm text-muted-foreground"> | ||
| {new Date(data.publishedAt).toLocaleDateString("en-US", { | ||
| year: "numeric", | ||
| month: "long", | ||
| day: "numeric", | ||
| })} | ||
| </time> | ||
| )} | ||
| </header> | ||
|
|
||
| <p className="text-lg text-muted-foreground leading-relaxed border-l-2 pl-4 mb-8"> | ||
| {data.summary} | ||
| </p> | ||
|
|
||
| <div className="prose prose-sm max-w-none text-foreground space-y-4"> | ||
| {data.body.split("\n\n").map((paragraph, i) => | ||
| paragraph.trim() ? ( | ||
| <p key={i} className="leading-relaxed"> | ||
| {paragraph.trim()} | ||
| </p> | ||
| ) : null, | ||
| )} | ||
| </div> | ||
| </article> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or 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,67 @@ | ||
| import { myStack } from "@/lib/stack"; | ||
| import Link from "next/link"; | ||
|
|
||
| export const dynamic = "force-dynamic"; | ||
|
|
||
| type ArticleData = { | ||
| title: string; | ||
| summary: string; | ||
| body: string; | ||
| publishedAt?: string; | ||
| published: boolean; | ||
| }; | ||
|
|
||
| export default async function ArticlesPage() { | ||
| const { items } = await myStack.api.cms.getAllContentItems("article"); | ||
| const published = items.filter( | ||
| (item) => (item.parsedData as ArticleData).published, | ||
| ); | ||
|
|
||
| return ( | ||
| <div className="max-w-3xl mx-auto px-4 py-12"> | ||
| <div className="mb-10"> | ||
| <h1 className="text-3xl font-bold mb-2">Articles</h1> | ||
| <p className="text-muted-foreground"> | ||
| Content managed with the BTST CMS plugin. | ||
| </p> | ||
| </div> | ||
|
|
||
| {published.length === 0 ? ( | ||
| <p className="text-muted-foreground">No published articles yet.</p> | ||
| ) : ( | ||
| <div className="divide-y"> | ||
| {published.map((item) => { | ||
| const data = item.parsedData as ArticleData; | ||
| return ( | ||
| <Link | ||
| key={item.id} | ||
| href={`/pages/articles/${item.slug}`} | ||
| className="block group py-8 first:pt-0" | ||
| > | ||
| <div className="flex items-start justify-between gap-6"> | ||
| <div className="min-w-0"> | ||
| <h2 className="text-xl font-semibold group-hover:underline underline-offset-2 mb-2"> | ||
| {data.title} | ||
| </h2> | ||
| <p className="text-muted-foreground text-sm leading-relaxed"> | ||
| {data.summary} | ||
| </p> | ||
| </div> | ||
| {data.publishedAt && ( | ||
| <time className="text-xs text-muted-foreground whitespace-nowrap mt-1 shrink-0"> | ||
| {new Date(data.publishedAt).toLocaleDateString("en-US", { | ||
| year: "numeric", | ||
| month: "short", | ||
| day: "numeric", | ||
| })} | ||
| </time> | ||
| )} | ||
| </div> | ||
| </Link> | ||
| ); | ||
| })} | ||
| </div> | ||
| )} | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.