Skip to content

Commit

Permalink
♻️ Refactor - Added Abstraction of Common Object Field (#1092)
Browse files Browse the repository at this point in the history
* Added abstraction of benefits field

* Schema changes

* Removed abstraction of booking, as there are differences

* Undid abstractions for benefits, made only common fields
  • Loading branch information
Harry-Ross authored Jul 21, 2023
1 parent f81f010 commit 94d88bf
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 63 deletions.
2 changes: 1 addition & 1 deletion .tina/__generated__/_schema.json

Large diffs are not rendered by default.

33 changes: 2 additions & 31 deletions .tina/collections/consulting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { seoSchema } from "../../components/util/seo";

import type { Collection } from "tinacms";
import { testimonialRowSchema } from "../../components/testimonials/TestimonialRow";
import { benefitsFields } from "./shared-fields";

export const consultingIndexSchema: Collection = {
label: "Consulting - Index",
Expand Down Expand Up @@ -273,37 +274,7 @@ export const consultingSchema: Collection = {
return { label: item?.title };
},
},
fields: [
{
type: "image",
label: "Image URL",
name: "image",
// @ts-ignore
uploadDir: () => "/benefits",
},
{
type: "string",
label: "Title",
name: "title",
},
{
type: "rich-text",
label: "Description",
name: "description",
},
{
type: "string",
required: false,
label: "linkName",
name: "linkName",
},
{
type: "string",
required: false,
label: "linkURL",
name: "linkURL",
},
],
fields: benefitsFields,
},
{
type: "object",
Expand Down
33 changes: 2 additions & 31 deletions .tina/collections/employment.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Collection } from "tinacms";
import * as Schemas from "../../components/blocks";
import { seoSchema } from "../../components/util/seo";
import { benefitsFields } from "./shared-fields";

export const employmentSchema: Collection = {
label: "Employment Pages",
Expand Down Expand Up @@ -67,37 +68,7 @@ export const employmentSchema: Collection = {
return { label: item?.title };
},
},
fields: [
{
type: "image",
label: "Image URL",
name: "image",
// @ts-ignore
uploadDir: () => "/benefits",
},
{
type: "string",
label: "Title",
name: "title",
},
{
type: "rich-text",
label: "Description",
name: "description",
},
{
type: "string",
required: false,
label: "linkName",
name: "linkName",
},
{
type: "string",
required: false,
label: "linkURL",
name: "linkURL",
},
],
fields: benefitsFields,
},
],
},
Expand Down
33 changes: 33 additions & 0 deletions .tina/collections/shared-fields.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { TinaField } from "tinacms";

export const benefitsFields: TinaField[] = [
{
type: "image",
label: "Image URL",
name: "image",
// @ts-ignore
uploadDir: () => "/benefits",
},
{
type: "string",
label: "Title",
name: "title",
},
{
type: "rich-text",
label: "Description",
name: "description",
},
{
type: "string",
required: false,
label: "linkName",
name: "linkName",
},
{
type: "string",
required: false,
label: "linkURL",
name: "linkURL",
},
];

0 comments on commit 94d88bf

Please sign in to comment.