Members
# constant getDomainSpecificHamburgerMenuItems
returns hamburger menu items for subdomains
which menuGroup to pick for which domain can be configured by setting featureConfig.sidebarMenu.menuGroupSlug for the subdomain if featureConfig isn't passed, check if menuGroup with slug "amp-sidebar-menu-${domainSlug}" is present and return those items if that's not set, check if menuGroup with slug "sidebar-menu-${domainSlug}" is present and return those items if that's not set either, return default menu group items
# constant getTokensForDarkTheme
Inverts colors for dark theme. Currently only inverts shades of gray not sure how desirable the output of this will be on non-gray colors. Check before using!
Methods
# ampifyStory(params) → {function}
The ampifyStory function is used behind the scenes by quintype/framework
It picks the correct story template and passes on control to renderToString
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | [mandatory] object containing parameters |
story |
Object | [mandatory] story object |
publisherConfig |
Object | [mandatory] the publisher config - same as "/api/v1/config" |
ampConfig |
Object | [mandatory] AMP specific config coming from platform - same as "/api/v1/amp/config" |
seo |
String | ready to use SEO string that can be put in the document head |
opts |
Object | opts object containing customizations and configs |
the renderToString function
# applyTransforms()
transforms are functions provided optionally by the user that "transform" the amp html string generated by ampLib opts.transforms is an array of functions, executed left to right output of function at 0th index is given as input to the function at index 1 and so on
# renderToString(params) → {string}
The renderToString function generates AMP Html string from react component. Styles created using styled components and those added using react-helmet are merged. script, meta, link tags, seo are added to the head
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | [mandatory] object containing parameters |
template |
Object | template react component |
seo |
string | the SEO string that is to be added in the head |
langTag |
string | the lang tag that is to be added to the html element. eg: en, fr |
config |
Object | the config object |
story |
Object | the story object |
ready to render amp html