Skip to content

Commit

Permalink
feat(templates): update website styles and new home hero image (#9413)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulpopus authored Nov 21, 2024
1 parent 0b4e5a6 commit 2036a56
Show file tree
Hide file tree
Showing 22 changed files with 269 additions and 247 deletions.
200 changes: 99 additions & 101 deletions templates/website/pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion templates/website/src/Footer/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ThemeSelector } from '@/providers/Theme/ThemeSelector'
import { CMSLink } from '@/components/Link'

export async function Footer() {
const footer: Footer = await getCachedGlobal('footer')()
const footer: Footer = await getCachedGlobal('footer', 1)()

const navItems = footer?.navItems || []

Expand Down
15 changes: 7 additions & 8 deletions templates/website/src/Header/Component.client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,13 @@ export const HeaderClient: React.FC<HeaderClientProps> = ({ header }) => {
}, [headerTheme])

return (
<header
className="container relative z-20 py-8 flex justify-between"
{...(theme ? { 'data-theme': theme } : {})}
>
<Link href="/">
<Logo />
</Link>
<HeaderNav header={header} />
<header className="container relative z-20 " {...(theme ? { 'data-theme': theme } : {})}>
<div className="py-8 border-b border-border flex justify-between">
<Link href="/">
<Logo />
</Link>
<HeaderNav header={header} />
</div>
</header>
)
}
4 changes: 2 additions & 2 deletions templates/website/src/app/(frontend)/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
--background: 0 0% 0%;
--foreground: 210 40% 98%;

--card: 240 6% 10%;
--card: 0 0% 4%;
--card-foreground: 210 40% 98%;

--popover: 222.2 84% 4.9%;
Expand All @@ -74,7 +74,7 @@
--destructive: 0 62.8% 30.6%;
--destructive-foreground: 210 40% 98%;

--border: 240 4% 16%;
--border: 0, 0%, 15%, 0.5;
--input: 217.2 32.6% 17.5%;
--ring: 212.7 26.8% 83.9%;

Expand Down
21 changes: 8 additions & 13 deletions templates/website/src/app/(frontend)/posts/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,15 @@ export default async function Post({ params: paramsPromise }: Args) {
<PostHero post={post} />

<div className="flex flex-col items-center gap-4 pt-8">
<div className="container lg:mx-0 lg:grid lg:grid-cols-[1fr_48rem_1fr] grid-rows-[1fr]">
<RichText
className="lg:grid lg:grid-cols-subgrid col-start-1 col-span-3 grid-rows-[1fr]"
content={post.content}
enableGutter={false}
/>
<div className="container">
<RichText className="max-w-[48rem] mx-auto" content={post.content} enableGutter={false} />
{post.relatedPosts && post.relatedPosts.length > 0 && (
<RelatedPosts
className="mt-12 max-w-[52rem] lg:grid lg:grid-cols-subgrid col-start-1 col-span-3 grid-rows-[2fr]"
docs={post.relatedPosts.filter((post) => typeof post === 'object')}
/>
)}
</div>

{post.relatedPosts && post.relatedPosts.length > 0 && (
<RelatedPosts
className="mt-12"
docs={post.relatedPosts.filter((post) => typeof post === 'object')}
/>
)}
</div>
</article>
)
Expand Down
59 changes: 21 additions & 38 deletions templates/website/src/app/(payload)/admin/importMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,42 +21,25 @@ import { default as default_1a7510af427896d367a49dbf838d2de6 } from '@/component
import { default as default_8a7ab0eb7ab5c511aba12e68480bfe5e } from '@/components/BeforeLogin'

export const importMap = {
'@payloadcms/richtext-lexical/rsc#RscEntryLexicalCell':
RscEntryLexicalCell_44fe37237e0ebf4470c9990d8cb7b07e,
'@payloadcms/richtext-lexical/rsc#RscEntryLexicalField':
RscEntryLexicalField_44fe37237e0ebf4470c9990d8cb7b07e,
'@payloadcms/richtext-lexical/client#InlineToolbarFeatureClient':
InlineToolbarFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
'@payloadcms/richtext-lexical/client#FixedToolbarFeatureClient':
FixedToolbarFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
'@payloadcms/richtext-lexical/client#HeadingFeatureClient':
HeadingFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
'@payloadcms/richtext-lexical/client#ParagraphFeatureClient':
ParagraphFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
'@payloadcms/richtext-lexical/client#UnderlineFeatureClient':
UnderlineFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
'@payloadcms/richtext-lexical/client#BoldFeatureClient':
BoldFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
'@payloadcms/richtext-lexical/client#ItalicFeatureClient':
ItalicFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
'@payloadcms/richtext-lexical/client#LinkFeatureClient':
LinkFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
'@payloadcms/plugin-seo/client#OverviewComponent':
OverviewComponent_a8a977ebc872c5d5ea7ee689724c0860,
'@payloadcms/plugin-seo/client#MetaTitleComponent':
MetaTitleComponent_a8a977ebc872c5d5ea7ee689724c0860,
'@payloadcms/plugin-seo/client#MetaImageComponent':
MetaImageComponent_a8a977ebc872c5d5ea7ee689724c0860,
'@payloadcms/plugin-seo/client#MetaDescriptionComponent':
MetaDescriptionComponent_a8a977ebc872c5d5ea7ee689724c0860,
'@payloadcms/plugin-seo/client#PreviewComponent':
PreviewComponent_a8a977ebc872c5d5ea7ee689724c0860,
'@/fields/slug/SlugComponent#SlugComponent': SlugComponent_92cc057d0a2abb4f6cf0307edf59f986,
'@payloadcms/richtext-lexical/client#HorizontalRuleFeatureClient':
HorizontalRuleFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
'@payloadcms/richtext-lexical/client#BlocksFeatureClient':
BlocksFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
'@payloadcms/plugin-search/client#LinkToDoc': LinkToDoc_aead06e4cbf6b2620c5c51c9ab283634,
'@/components/BeforeDashboard#default': default_1a7510af427896d367a49dbf838d2de6,
'@/components/BeforeLogin#default': default_8a7ab0eb7ab5c511aba12e68480bfe5e,
"@payloadcms/richtext-lexical/rsc#RscEntryLexicalCell": RscEntryLexicalCell_44fe37237e0ebf4470c9990d8cb7b07e,
"@payloadcms/richtext-lexical/rsc#RscEntryLexicalField": RscEntryLexicalField_44fe37237e0ebf4470c9990d8cb7b07e,
"@payloadcms/richtext-lexical/client#InlineToolbarFeatureClient": InlineToolbarFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#FixedToolbarFeatureClient": FixedToolbarFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#HeadingFeatureClient": HeadingFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#ParagraphFeatureClient": ParagraphFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#UnderlineFeatureClient": UnderlineFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#BoldFeatureClient": BoldFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#ItalicFeatureClient": ItalicFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#LinkFeatureClient": LinkFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/plugin-seo/client#OverviewComponent": OverviewComponent_a8a977ebc872c5d5ea7ee689724c0860,
"@payloadcms/plugin-seo/client#MetaTitleComponent": MetaTitleComponent_a8a977ebc872c5d5ea7ee689724c0860,
"@payloadcms/plugin-seo/client#MetaImageComponent": MetaImageComponent_a8a977ebc872c5d5ea7ee689724c0860,
"@payloadcms/plugin-seo/client#MetaDescriptionComponent": MetaDescriptionComponent_a8a977ebc872c5d5ea7ee689724c0860,
"@payloadcms/plugin-seo/client#PreviewComponent": PreviewComponent_a8a977ebc872c5d5ea7ee689724c0860,
"@/fields/slug/SlugComponent#SlugComponent": SlugComponent_92cc057d0a2abb4f6cf0307edf59f986,
"@payloadcms/richtext-lexical/client#HorizontalRuleFeatureClient": HorizontalRuleFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#BlocksFeatureClient": BlocksFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/plugin-search/client#LinkToDoc": LinkToDoc_aead06e4cbf6b2620c5c51c9ab283634,
"@/components/BeforeDashboard#default": default_1a7510af427896d367a49dbf838d2de6,
"@/components/BeforeLogin#default": default_8a7ab0eb7ab5c511aba12e68480bfe5e
}
84 changes: 43 additions & 41 deletions templates/website/src/blocks/Form/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,47 +126,49 @@ export const FormBlock: React.FC<
)

return (
<div className="container lg:max-w-[48rem] pb-20">
<FormProvider {...formMethods}>
{enableIntro && introContent && !hasSubmitted && (
<RichText className="mb-8" content={introContent} enableGutter={false} />
)}
{!isLoading && hasSubmitted && confirmationType === 'message' && (
<RichText content={confirmationMessage} />
)}
{isLoading && !hasSubmitted && <p>Loading, please wait...</p>}
{error && <div>{`${error.status || '500'}: ${error.message || ''}`}</div>}
{!hasSubmitted && (
<form id={formID} onSubmit={handleSubmit(onSubmit)}>
<div className="mb-4 last:mb-0">
{formFromProps &&
formFromProps.fields &&
formFromProps.fields?.map((field, index) => {
const Field: React.FC<any> = fields?.[field.blockType]
if (Field) {
return (
<div className="mb-6 last:mb-0" key={index}>
<Field
form={formFromProps}
{...field}
{...formMethods}
control={control}
errors={errors}
register={register}
/>
</div>
)
}
return null
})}
</div>

<Button form={formID} type="submit" variant="default">
{submitButtonLabel}
</Button>
</form>
)}
</FormProvider>
<div className="container lg:max-w-[48rem]">
{enableIntro && introContent && !hasSubmitted && (
<RichText className="mb-8 lg:mb-12" content={introContent} enableGutter={false} />
)}
<div className="p-4 lg:p-6 border border-border rounded-[0.8rem]">
<FormProvider {...formMethods}>
{!isLoading && hasSubmitted && confirmationType === 'message' && (
<RichText content={confirmationMessage} />
)}
{isLoading && !hasSubmitted && <p>Loading, please wait...</p>}
{error && <div>{`${error.status || '500'}: ${error.message || ''}`}</div>}
{!hasSubmitted && (
<form id={formID} onSubmit={handleSubmit(onSubmit)}>
<div className="mb-4 last:mb-0">
{formFromProps &&
formFromProps.fields &&
formFromProps.fields?.map((field, index) => {
const Field: React.FC<any> = fields?.[field.blockType]
if (Field) {
return (
<div className="mb-6 last:mb-0" key={index}>
<Field
form={formFromProps}
{...field}
{...formMethods}
control={control}
errors={errors}
register={register}
/>
</div>
)
}
return null
})}
</div>

<Button form={formID} type="submit" variant="default">
{submitButtonLabel}
</Button>
</form>
)}
</FormProvider>
</div>
</div>
)
}
18 changes: 7 additions & 11 deletions templates/website/src/blocks/MediaBlock/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export const MediaBlock: React.FC<Props> = (props) => {
enableGutter = true,
imgClassName,
media,
position = 'default',
staticImage,
disableInnerContainer,
} = props
Expand All @@ -38,25 +37,22 @@ export const MediaBlock: React.FC<Props> = (props) => {
className={cn(
'',
{
container: position === 'default' && enableGutter,
container: enableGutter,
},
className,
)}
>
{position === 'fullscreen' && (
<div className="relative">
<Media resource={media} src={staticImage} />
</div>
)}
{position === 'default' && (
<Media imgClassName={cn('rounded', imgClassName)} resource={media} src={staticImage} />
)}
<Media
imgClassName={cn('border border-border rounded-[0.8rem]', imgClassName)}
resource={media}
src={staticImage}
/>
{caption && (
<div
className={cn(
'mt-6',
{
container: position === 'fullscreen' && !disableInnerContainer,
container: !disableInnerContainer,
},
captionClassName,
)}
Expand Down
15 changes: 0 additions & 15 deletions templates/website/src/blocks/MediaBlock/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,6 @@ export const MediaBlock: Block = {
slug: 'mediaBlock',
interfaceName: 'MediaBlock',
fields: [
{
name: 'position',
type: 'select',
defaultValue: 'default',
options: [
{
label: 'Default',
value: 'default',
},
{
label: 'Fullscreen',
value: 'fullscreen',
},
],
},
{
name: 'media',
type: 'upload',
Expand Down
2 changes: 1 addition & 1 deletion templates/website/src/blocks/RelatedPosts/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const RelatedPosts: React.FC<RelatedPostsProps> = (props) => {
<div className={clsx('container', className)}>
{introContent && <RichText content={introContent} enableGutter={false} />}

<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 md:gap-8 items-stretch">
<div className="grid grid-cols-1 md:grid-cols-2 gap-4 md:gap-8 items-stretch">
{docs?.map((doc, index) => {
if (typeof doc === 'string') return null

Expand Down
1 change: 0 additions & 1 deletion templates/website/src/endpoints/seed/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,6 @@ export const home: RequiredDataFromCollectionSlug<'pages'> = {
blockType: 'mediaBlock',
// @ts-ignore
media: '{{IMAGE_2}}',
position: 'default',
},
{
blockName: 'Archive Block',
Expand Down
67 changes: 67 additions & 0 deletions templates/website/src/endpoints/seed/image-3.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import type { Media } from '@/payload-types'

export const image3: Omit<Media, 'createdAt' | 'id' | 'updatedAt'> = {
alt: 'Straight metallic shapes with an orange and blue gradient',
caption: {
root: {
type: 'root',
children: [
{
type: 'paragraph',
children: [
{
type: 'text',
detail: 0,
format: 0,
mode: 'normal',
style: '',
text: 'Photo by ',
version: 1,
},
{
type: 'link',
children: [
{
type: 'text',
detail: 0,
format: 0,
mode: 'normal',
style: '',
text: 'Andrew Kliatskyi',
version: 1,
},
],
direction: 'ltr',
fields: {
linkType: 'custom',
newTab: true,
url: 'https://unsplash.com/@kirp',
},
format: '',
indent: 0,
version: 2,
},
{
type: 'text',
detail: 0,
format: 0,
mode: 'normal',
style: '',
text: ' on Unsplash.',
version: 1,
},
],
direction: 'ltr',
format: '',
indent: 0,
textFormat: 0,
version: 1,
},
],
direction: 'ltr',
format: '',
indent: 0,
version: 1,
},
},
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
2 changes: 1 addition & 1 deletion templates/website/src/endpoints/seed/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const seed = async ({
'https://raw.githubusercontent.com/payloadcms/payload/refs/heads/main/templates/website/src/endpoints/seed/image-post3.webp',
),
fetchFileByURL(
'https://raw.githubusercontent.com/payloadcms/payload/refs/heads/main/templates/website/src/endpoints/seed/image-hero1.webp',
'https://raw.githubusercontent.com/payloadcms/payload/refs/heads/main/templates/website/src/endpoints/seed/image-hero1.jpg',
),
])

Expand Down
1 change: 0 additions & 1 deletion templates/website/src/endpoints/seed/post-1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ export const post1: Partial<Post> = {
blockName: '',
blockType: 'mediaBlock',
media: '{{IMAGE_2}}',
position: 'default',
},
format: '',
version: 2,
Expand Down
Loading

0 comments on commit 2036a56

Please sign in to comment.