@sankei-arc-shared-components/utils_ans-helpers
v0.5.4
Published
Helper functions for retrieving ANS content
Downloads
102
Readme
ANS Helper functions
How do I use it?
These are helpers which make it easier to retrieve ANS content from received fusion props.
For example, the getContent
helper which retrieves global content.
import React from 'react';
import { getContent } from "@sankei-arc-shared-components/utils_ans-helpers";
const TestComponent = (props) => {
const globalContent = getContent(props);
/*
Example of a globalContent structure
globalContent = {
_id: '123',
content_elements: [
{ _id: 'abc' },
],
promo_items: {
basic: { _id: 'basic' },
lead_art: { _id: 'lead_art' },
},
taxonomy: {
tags: [
{ slug: 'tag1' },
],
},
type: 'gallery',
website_url: '/path/to/content',
};
*/
...
}
How can I view what's in there quickly?
The current list of available helpers is:
- getAuthorURL
- getContent
- getContentConfig
- getContentElements
- getDistributor
- getId
- getNodeType
- getPbType
- getPbLayout
- getPrimarySection
- getPromoItems
- getSectionAncestry
- getStoryURL
- getSubtype
- getTags
- getWebsiteUrl
- isArticle
- isCategoryPage
- isGallery
- isHomePage