mediawiki-skins-MinervaNeue/stories/utils.js
jdlrobson 1200cb5279 Storybook added to MinervaNeue
For now just adding story entries for footer element and last modified.

Bug: T244106
Change-Id: Ib36f22f9b9d805f87fc074d12473497cfaf91b79
2020-03-03 15:22:34 +00:00

27 lines
765 B
JavaScript

/**
*
* @param {string} msg to display
* @param {number} height of placeholder
* @return {string}
*/
const placeholder = ( msg, height ) => {
return `<div style="width: 100%; height: ${height || 200}px; margin-bottom: 2px;
font-size: 1.4em; padding: 8px;
display: flex; background: #eaecf0; align-items: center; justify-content: center;">${msg}</div>`;
};
/**
*
* @param {string} story to describe.
* @param {string} annotation to annotate story with.
* @param {number} height of placeholder
* @return {string}
*/
const withAnnotation = ( story, annotation, height ) => {
const node = document.createElement( 'div' );
node.innerHTML = placeholder( annotation, height ) + story;
return node.outerHTML;
};
export { placeholder, withAnnotation };