All files / src/components/Content index.tsx

25% Statements 2/8
0% Branches 0/4
0% Functions 0/3
25% Lines 2/8

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 22 23 24 25 26 27 28 29 30 31 32 33 34      4x   4x                                                        
import React, { FC } from 'react';
import { Accordion, AccordionSection } from 'ag-ems-ui-library';
 
const styles = require('./Content.module.css');
 
export const Content: FC<{ title: string; content: any }> = ({ title, content }) => {
  return <div className={styles.Content}>
    <h1>{title}</h1>
 
    {content.map((el, index) => {
      if (el.text) {
        return <React.Fragment key={index}>
          <div
            dangerouslySetInnerHTML={{ __html: el.text }}
          />
        </React.Fragment>;
      }
      if (el.items) {
        return <Accordion key={index} desktopView={false} classes={styles.ContentAccordion}>
          {el.items.map((item, index) =>
            <AccordionSection key={index} title={<p className={styles.ContentAccordionTitle}>{item.title}</p>}>
              <div
                className={styles.ContentAccordionContent}
                dangerouslySetInnerHTML={{ __html: item.content }}
              />
            </AccordionSection>
          )}
        </Accordion>;
      }
    })}
  </div>;
};