All files / Section Section.tsx

100% Statements 1/1
87.5% Branches 7/8
100% Functions 1/1
100% Lines 1/1

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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49                              4x                                                                  
import React, { memo, ReactNode } from 'react';
 
import Divider from '@material-ui/core/Divider';
import Grid from '@material-ui/core/Grid';
import Text from '@material-ui/core/Typography';
 
import './Section.css';
 
interface IProps {
  title?: string;
  description?: string;
  children?: ReactNode;
}
 
export function Section({ title, description, children }: IProps) {
  return (
    <Grid container direction='column' spacing={1}>
      {title && (
        <>
          <Grid item>
            <Text variant='h6'>{title}</Text>
          </Grid>
          <Grid item>
            <Divider />
          </Grid>
        </>
      )}
      <Grid item className='m-t-16-i'>
        <Grid container spacing={3}>
          {description && (
            <Grid item xs={12} md={3}>
              <Text variant='body2' color='textSecondary'>
                {description}
              </Text>
            </Grid>
          )}
          {children && (
            <Grid item xs={12} md={description ? 9 : 12}>
              {children}
            </Grid>
          )}
        </Grid>
      </Grid>
    </Grid>
  );
}
 
export default memo(Section);