# All files / components/Code Code.js

100% Statements 4/4
100% Branches 0/0
100% Functions 0/0
100% Lines 4/4

    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

    4x

    4x

    4x

    4x

     import React from 'react';
    import PropTypes from 'prop-types';
    import styled from 'styled-components';
    import get from 'extensions/themeGet';

    import Block from './CodeBlock';

    const Code = styled.pre.withConfig({ displayName: 'Code' })`
      font-family: ${get('fonts.monospace')};
      font-size: 0.85em;

      background: ${get('colors.gray.light')};
      color: ${get('colors.text.default')};
      border-color: ${get('colors.border.medium')};
      border-width: ${get('thicknesses.normal')};
      border-style: solid;
      border-radius: 3px;

      padding: 0.3em;
      margin: 0;

      display: inline-block;
    `;

    Code.propTypes = {
      /**
       * A class name to pass to the element.
       */
      className: PropTypes.string,
      /**
       * An id to pass to the element.
       */
      id: PropTypes.string,
    };

    Code.defaultProps = {
      className: null,
      id: null,
    };

    Code.Block = Block;

    /**
     * @component
     */
    export default Code;