# All files / components/Breadcrumb Breadcrumbs.js

0% Statements 0/23
0% Branches 0/11
0% Functions 0/3
0% Lines 0/14

    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

     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;

    /** @component */
    export default Breadcrumbs;