0.5.4 • Published 2 years ago

@sankei-arc-shared-components/utils_ans-helpers v0.5.4

Weekly downloads
36
License
ISC
Repository
github
Last release
2 years ago

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
0.5.4

2 years ago

0.5.3

3 years ago

0.5.2

3 years ago

0.5.1

4 years ago

0.5.0

4 years ago

0.4.1

4 years ago

0.3.0

4 years ago

0.2.3

4 years ago

0.2.0

4 years ago

0.2.2

4 years ago

0.1.0

4 years ago