Skip to content

Commit

Permalink
Add Guiding Principles
Browse files Browse the repository at this point in the history
  • Loading branch information
koechkevin committed Sep 21, 2023
1 parent 176eadc commit 0dcbe23
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 34 deletions.
3 changes: 2 additions & 1 deletion apps/codeforafrica/payload.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import path from "path";

import { buildConfig } from "payload/config";
import GuidingPrinciples from "./src/payload/collections/GuidingPrinciples";
import Impact from "./src/payload/collections/Impact";
import Media from "./src/payload/collections/Media";
import Pages from "./src/payload/collections/Pages";
Expand Down Expand Up @@ -31,7 +32,7 @@ const adapter = s3Adapter({

export default buildConfig({
serverURL: appURL,
collections: [Impact, Pages, Media, Partners] as CollectionConfig[],
collections: [GuidingPrinciples, Impact, Pages, Media, Partners] as CollectionConfig[],
globals: [Settings] as GlobalConfig[],
admin: {
css: path.resolve(__dirname, "./src/payload/admin/scss/custom.scss"),
Expand Down
2 changes: 1 addition & 1 deletion apps/codeforafrica/src/pages/[...slugs].page.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ const componentsBySlugs = {
"custom-page-header": CustomPageHeader,
"get-involved": GetInvolved,
"get-in-touch": GetInTouch,
"guiding-principles": GuidingPrinciplesCardList,
hero: Hero,
"join-our-slack": JoinOurSlack,
"meet-our-team": MeetOurTeam,
"news-stories": NewsAndStories,
"our-guiding-principles": GuidingPrinciplesCardList,
"our-impact": OurImpact,
"our-partners": OurPartners,
"page-header": PageHeader,
Expand Down
43 changes: 11 additions & 32 deletions apps/codeforafrica/src/payload/blocks/GuidingPrinciples.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import image from "../fields/image";
import richText from "../fields/richText";

const GuidingPrinciples = {
slug: "guiding-principles",
imageURL: "/images/cms/blocks/guiding_principles.jpg",
slug: "our-guiding-principles",
imageURL: "/images/cms/blocks/guiding_principles.png",
imageAltText: "Guiding Principles",
fields: [
{
Expand All @@ -17,33 +14,15 @@ const GuidingPrinciples = {
},
{
name: "list",
label: "Guiding Principles",
type: "array",
fields: [
{
name: "title",
label: {
en: "Title",
},
type: "text",
localized: true,
required: true,
},
image({
overrides: {
name: "icon",
required: true,
},
}),
richText({
name: "description",
label: {
en: "Description",
},
localized: true,
required: true,
}),
],
label: {
en: "Guiding Principles",
},
type: "relationship",
relationTo: "guiding-principles",
hasMany: true,
admin: {
isSortable: true,
},
},
],
};
Expand Down
34 changes: 34 additions & 0 deletions apps/codeforafrica/src/payload/collections/GuidingPrinciples.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import image from "../fields/image";
import richText from "../fields/richText";

const GuidingPrinciples = {
slug: "guiding-principles",
admin: {
useAsTitle: "title",
},
fields: [
{
name: "title",
label: {
en: "Title",
},
type: "text",
required: true,
},
image({
overrides: {
name: "icon",
required: true,
},
}),
richText({
name: "description",
label: {
en: "Description",
},
required: true,
}),
],
};

export default GuidingPrinciples;

0 comments on commit 0dcbe23

Please sign in to comment.