Using the existing curation endpoint, we can save/load a CustomHeader
item that will be used to store the attributes that can be consumed at page render to create the desired customized header look.
The CustomHeader
item could look something like this:
{
"itemType": "CustomHeader",
"itemData": {
"backgroud": {
"type": "color",
"value": "#509b22"
},
"primary": {
"type": "text",
"value": "This is a text headline"
// possibly color?
},
"secondary": {
"type": "text",
"value": "this is some paragraph text I suppose"
},
"tertiary": {
"type": "links",
"value": [
{
"text": "Season 1",
"url": "/c/tv-shows/season-1"
},
{
"text": "Season 2",
"url": "/c/tv-shows/season-2"
}
]
}
}
}
/* potentially in the future we add additional content "types" and the types in each slot would be interchangeble.
(ie: "primary": {"type": "links", "value"...)
*/
I feel like a basic MVP is achievable by 9/30. That basic MVP would allow for:
- Custom background color
- Non-formated text in both the primary (heading) & secondary (text) slots
- Image in the primary (heading) slot
- Ability to set the background to an image
- Up to 4 links in the tertiary slot
- overhang the curation module (see second image)
- look like:
Once this is released, we can look to expand the functionality by order of importance and add things like:
- Addition of a "Sponsor Badge" slot
- Formatted and/or colored text in both the primary (heading) & secondary (text) slots
Ultimately arriving at something like this:
Pros
- Custom header functionality can be added to any place a curation module currently lives.
- Using the existing curation module endpoints means that new api/backend work should be required and also means that...
- only a single call needs to be made to retrieve the data for both the curation module and the custom header, rather than 2 separate calls.
- Potentially makes doing curation/header integrations easier in the future.
Cons
- Every place the curation module possibly could live needs to be touched to ensure that it can properly handle the possibly of the new
CustomHeader
item type. - Making updates to either a custom header or a curation module on a page means that both parts need to be "Saved"
- Custom header functionality can't easily live on pages were curation module can't/doesn't exist
(ie: "Uncategorized" category/subcategory pages & permalink pages) - Potentially adds confusion/complexity around using the "Delete" endpoints as they would now remove both the data responsible for rendering the curation module and the custom header. Currently no client functionality exists utilizing this endpoint.
Make sure the page render and the curation module component can handle the new CustomHeader
item.
Update:
kinja-magma/client/controllers/categorization/category-page.js and/or
kinja-magma/utils/prepareCurationProps.js
Build a custom component that consumes a CustomHeader
item and renders it correctly on the page.
To allow for instances were someone wants a custom header but no curation module.
This is option can be utilized via the "Remove curation module" button shown in this mock
in kinja-components/components/curation-layout/default-layouts-stub.js add to getDefaultLayouts
{
group: 'None',
cardinality: 1,
zones: [
{
dimension: '1fr',
numberOfItems: 0
}
]
}
When the curation module edit "Pin" is clicked, the custom header component becomes editable.
On pages that don't currently have any custom header content, an empty editable header is displayed.
Update the curation module "Save" functionality so that it takes the values set in that editable header and bundles them into a CustomHeader
item that is included in the existing curation save flow prior to POST
.
"Background Color" would be set using a system color picker similar to special sections.
"Background Image" would be set via the same sort of functionality that is used on special sections.
"Links" would open a simple modal similar to what currently exists when adding a link on a special sections.
One note. I think that it would make a bit more sense to elevate the customHeader data a level up in the JSON. If you check https://kinja.com/api/core/curation/views/forBlog?blogId=4 right now we have
blogId, layout, items, updatedAt, updatedBy
. Instead of adding the custamHeader data inside items, I think I'd rather have it on the same level as these keys I mentioned.I'm not really familiar with the curation api, but it seems like inside
items
you only ever have the type ofStoryCard
, which are the actual items in the curation. It feels like the customHeader doesn't belong there.On a side note, typing for the curation module is all kinds of messed up right now in our codebase.