@economist/component-articletemplate

A template with which to render articles

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
08May 26, 2016Jun 25, 2015Minified + gzip package size for @economist/component-articletemplate in KB

Readme

component-articletemplate

A template with which to render articles

Goals

  • Stateless.
  • Supports different types of article content.
  • Developed so that article variants with radically-different HTML can co-exist.
  • Separation of styling concerns using variant-specific classes.

Design

An ArticleTemplate is a description of how an ArticleHeader, ArticleSubheader, ArticleBody and ArticleFooter should render a page.

By default it will render a very basic article template, however the use of the higher-order components within component-variantify allow the developer to declaratively specify the different article variants. Both ArticleTemplate and ArticleBodyTemplate can be wrapped to this effect.

All inner components receive a generateClassNameList which can have a class name passed into it so they generate additional variant classes. This function is created from the usage of the higher-order component withVariantClassNameList.

Variant-specific ArticleHeader, ArticleSubheader, ArticleBody and ArticleFooter components can be made with help from some basic components exposed where the default components are defined.

Variants

Usage

See example.es6 for usage instructions.

Install

npm install --save @economist/component-articletemplate;

Run tests

npm test;

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.