# All files / components/Breadcrumb Breadcrumbs.js

27.27% Statements 3/11
0% Branches 0/7
0% Functions 0/2
30% Lines 3/10

    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

    4x

    4x

    4x

     import styled from 'styled-components';
    import Breadcrumb from './Breadcrumb';
    import dedent from 'dedent';

    const Breadcrumbs = styled.div`
      & > ${Breadcrumb}:not(:last-child)::after {
        content: '\00a0 \00a0 ›\00a0 \00a0';
      }
    `;

    Breadcrumbs.propTypes = {
      children: props => {
        if (!props.children) return;
        const invalidChildren = props.children.filter(
          child => child.type.displayName !== Breadcrumb.displayName,
        );
        if (invalidChildren.length > 0) {
          const child = invalidChildren[0];
          const childName = child.type.displayName || child.type.name || child.type;
          return new Error(dedent`Invalid child component for Breadcrumbs: ${
            childName
          }.  Only ${Breadcrumb.displayName} \
            components may be nested within Breadcrumbs.`);
        }
      },
    };

    Breadcrumbs.Breadcrumb = Breadcrumb;

    export default Breadcrumbs;