How to use the @govuk-react/lib.spacing.responsive function in @govuk-react/lib

To help you get started, we’ve selected a few @govuk-react/lib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github govuk-react / govuk-react / components / accordion / src / index.js View on Github external
import PropTypes from 'prop-types';
import styled from 'styled-components';
import { BORDER_COLOUR } from 'govuk-colours';
import { spacing } from '@govuk-react/lib';

import Group from './molecules/group';
import Icon from './atoms/icon';
import OpenAll from './atoms/open-all';
import SectionButton from './atoms/section-button';
import SectionContent from './atoms/section-content';
import SectionHeader from './atoms/section-header';
import SectionHeading from './atoms/section-heading';
import SectionSummary from './atoms/section-summary';

const AccordionContainer = styled('div')(
  spacing.responsive({ size: 6, property: 'margin', direction: 'bottom' }),
  {
    borderBottom: `1px solid ${BORDER_COLOUR}`,
  },
  spacing.withWhiteSpace(),
);

/**
 *
 * ### Usage
 *
 * Simple
 * ```jsx
 *
 * import Accordion from '@govuk-react/accordion'
 *
 * const checkOpen = state => Object.values(state).every(Boolean);
github govuk-react / govuk-react / components / accordion / src / atoms / section-content / index.js View on Github external
import styled from 'styled-components';
import { spacing } from '@govuk-react/lib';

const SectionContent = styled('div')(
  spacing.responsive({ size: 3, property: 'padding', direction: 'top' }),
  spacing.responsive({ size: 3, property: 'padding', direction: 'bottom' }),
  {
    ':last-child': {
      marginBottom: 0,
    },
  },
);

export default SectionContent;
github govuk-react / govuk-react / components / tabs / src / atoms / list / index.js View on Github external
import { spacing } from '@govuk-react/lib';
import { MEDIA_QUERIES } from '@govuk-react/constants';

const clearfix = {
  '::after': {
    content: "''",
    display: 'block',
    clear: 'both',
  },
};

const TabList = styled('ul')(
  {
    margin: 0,
  },
  spacing.responsive({ size: 6, property: 'margin', direction: 'bottom' }),
  {
    padding: 0,
    listStyle: 'none',
    [MEDIA_QUERIES.TABLET]: {
      borderBottom: `1px solid ${BORDER_COLOUR}`,
      marginBottom: 0,
      ...clearfix,
    },
  }
);

export default TabList;