feat: more maintainable colors

This commit is contained in:
James
2022-07-14 15:20:34 -07:00
parent 41a0ba5780
commit 5fc4f3adad
30 changed files with 402 additions and 250 deletions

View File

@@ -1,6 +1,6 @@
import { buildConfig } from '../buildConfig';
import { devUser } from '../../credentials';
import { arrayDoc, blocksDoc, collapsibleDoc, textDoc } from './shared';
import { arrayDoc, blocksDoc, collapsibleDoc, richTextDoc, textDoc } from './shared';
export default buildConfig({
collections: [
@@ -72,6 +72,16 @@ export default buildConfig({
},
],
},
{
slug: 'rich-text-fields',
fields: [
{
name: 'richText',
type: 'richText',
required: true,
},
],
},
{
slug: 'text-fields',
admin: {
@@ -110,9 +120,17 @@ export default buildConfig({
data: collapsibleDoc,
});
await payload.create({
const createdTextDoc = await payload.create({
collection: 'text-fields',
data: textDoc,
});
const richTextDocWithRelationship = { ...richTextDoc };
richTextDocWithRelationship.richText[2].value = { id: createdTextDoc.id };
await payload.create({
collection: 'rich-text-fields',
data: richTextDocWithRelationship,
});
},
});

View File

@@ -36,10 +36,83 @@ export const blocksDoc = {
],
};
export const textDoc = {
text: 'Seeded text document',
};
export const collapsibleDoc = {
text: 'Seeded collapsible doc',
};
export const richTextDoc = {
richText: [
{
children: [
{
text: "Hello, I'm a rich text field.",
},
],
type: 'h1',
},
{
children: [
{
text: 'I can do all kinds of fun stuff like render links and store nested relationship fields:',
},
],
},
{
children: [
{
text: '',
},
],
type: 'relationship',
value: { id: '' },
relationTo: 'text-fields',
},
{
children: [
{
text: 'You can build your own elements, too.',
},
],
},
{
type: 'ul',
children: [
{
children: [
{
text: "It's built with SlateJS",
},
],
type: 'li',
},
{
type: 'li',
children: [
{
text: 'It stores content as JSON so you can use it wherever you need',
},
],
},
{
type: 'li',
children: [
{
text: "It's got a great editing experience for non-technical users",
},
],
},
],
},
{
children: [
{
text: 'And a whole lot more.',
},
],
},
],
};
export const textDoc = {
text: 'Seeded text document',
};