All files / src/templates header.js

42.86% Statements 3/7
0% Branches 0/2
0% Functions 0/1
42.86% Lines 3/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 221x   1x                                   1x  
const compile = require('string-template/compile');
 
const template = (config) => {
  const headerConfig = config.header;
  headerConfig.accent_color = config.accent_color;
 
  const headerContent = headerConfig.banner ?
    '<mj-image href="{link}" align="center" src="{banner}" alt="{title}"></mj-image>' :
    '<mj-text color="{accentColor}" padding="30px 0 40px" align="center" font-size="24px"><a href="{link}">{title}</a></mj-text>';
 
  return compile(`
      <!-- Header -->
      <mj-section>
        <mj-column>
          ${headerContent}
        </mj-column>
      </mj-section>
  `)(headerConfig);
};
 
module.exports = template;