All files / src/server styles.jsx

88.89% Statements 8/9
85.71% Branches 6/7
100% Functions 2/2
87.5% Lines 7/8
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24    2x 3x 3x   1x 1x 1x               1x              
import React from 'react';
 
export const getStyleTag = (sheet, isAmp = false) => {
  const styleTags = sheet.getStyleElement();
  if (!isAmp) return styleTags;
 
  const inlineCss = styleTags.reduce((inlineStyles, currentStylesheet) => {
    Eif (currentStylesheet && currentStylesheet.props) {
      return `${inlineStyles}${
        // eslint-disable-next-line no-underscore-dangle
        currentStylesheet.props.dangerouslySetInnerHTML.__html
      }`;
    }
    return inlineStyles;
  }, '');
 
  return (
    // eslint-disable-next-line react/no-danger
    <style amp-custom="" dangerouslySetInnerHTML={{ __html: inlineCss }} />
  );
};
 
export default getStyleTag;