How to use the polished.size function in polished

To help you get started, we’ve selected a few polished 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 apollographql / gatsby-theme-apollo / packages / gatsby-theme-apollo-docs / src / components / docset-switcher.js View on Github external
marginLeft: 'auto',
  [breakpoints.md]: {
    marginTop: 8
  }
});

const SocialLink = styled.a({
  color: colors.text2,
  ':hover': {
    color: colors.text3
  },
  ':not(:last-child)': {
    marginRight: 24
  },
  svg: {
    ...size(24),
    display: 'block',
    fill: 'currentColor'
  }
});

export default function DocsetSwitcher(props) {
  const menuRef = useRef(null);
  const {width} = useWindowSize();
  useKey('Escape', props.onClose);

  useEffect(() => {
    if (props.open) {
      // focus the menu after it has been transitioned in
      setTimeout(() => {
        menuRef.current.focus();
      }, transitionDuration);
github sumup-oss / circuit-ui / src / components / Badge / Badge.js View on Github external
const circleStyles = ({ circle }) =>
  circle &&
  css`
    display: flex;
    align-items: center;
    justify-content: center;
    ${size(24)};
  `;
github sumup-oss / circuit-ui / src / components / Toggle / components / Switch / Switch.js View on Github external
const knobBaseStyles = ({ theme }) => css`
  label: toggle__switch-knob;
  display: block;
  background-color: ${theme.colors.n100};
  box-shadow: ${knobShadow(theme.colors.n500)};
  position: absolute;
  top: 50%;
  transform: translate3d(${theme.spacings.bit}, -50%, 0);
  transition: box-shadow ${ANIMATION_TIMING}, transform ${ANIMATION_TIMING};
  ${size(KNOB_SIZE)};
  border-radius: ${KNOB_SIZE}px;
`;
github MyCryptoHQ / ui / src / Theme / Theme.story.tsx View on Github external
import { storiesOf } from '@storybook/react';
import { margin, size } from 'polished';
import React, { DetailedHTMLProps, HTMLAttributes } from 'react';
import { StyledComponentClass, withTheme } from 'styled-components';

import styled from 'src/styled-components';
import Theme, { monospace } from 'src/Theme';
import Typography from 'src/Typography';

const Color = styled.div`
  background: ${props => props.color};
  border: 0.0625em solid ${props => props.theme.text};
  ${size('1.5625em')};
  ${margin('0.3125em', '0.625em')};
  border-radius: 50%;
`;

const Code = styled(Typography)`
  font-family: ${monospace};
` as StyledComponentClass<
  DetailedHTMLProps, HTMLElement>,
  Theme
>;

Code.defaultProps = { as: 'code' };

const VerticallyCentered = styled.div`
  display: flex;
  align-items: center;
github sumup-oss / circuit-ui / src / components / Checkbox / Checkbox.js View on Github external
box-sizing: border-box;
    box-shadow: inset 0 1px 2px 0 rgba(102, 113, 123, 0.12);
    background-color: ${theme.colors.white};
    border: 1px solid ${theme.colors.n500};
    border-radius: 3px;
    content: '';
    display: block;
    position: absolute;
    top: ${theme.spacings.kilo};
    left: 0;
    transform: translateY(-50%);
    transition: border 0.05s ease-in, background-color 0.05s ease-in;
  }

  svg {
    ${size(10)};
    box-sizing: border-box;
    fill: ${theme.colors.p500};
    display: block;
    left: 3px;
    line-height: 0;
    opacity: 0;
    position: absolute;
    top: ${theme.spacings.kilo};
    transform: translateY(-50%) scale(0, 0);
    transition: transform 0.05s ease-in, opacity 0.05s ease-in;
  }
`;
github sumup-oss / circuit-ui / src / components / RadioButton / RadioButton.js View on Github external
box-shadow: inset 0 1px 2px 0 rgba(102, 113, 123, 0.12);
    background-color: ${theme.colors.white};
    border: 1px solid ${theme.colors.n500};
    border-radius: 100%;
    content: '';
    display: block;
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    transition: border 0.05s ease-in;
  }

  &::after {
    box-sizing: border-box;
    ${size(theme.spacings.byte)};
    background-color: ${theme.colors.p500};
    border-radius: 100%;
    content: '';
    display: block;
    position: absolute;
    top: 50%;
    left: ${theme.spacings.bit};
    transform: translateY(-50%) scale(0, 0);
    opacity: 0;
    transition: transform 0.05s ease-in, opacity 0.05s ease-in;
  }
`;
github apollographql / fullstack-tutorial / final / client / src / components / login-form.js View on Github external
backgroundPosition: 'center',
});

const svgClassName = css({
  display: 'block',
  fill: 'currentColor',
});

const Header = styled('header')(svgClassName, {
  width: '100%',
  marginBottom: unit * 5,
  padding: unit * 2.5,
  position: 'relative',
});

const StyledLogo = styled(Logo)(size(56), {
  display: 'block',
  margin: '0 auto',
  position: 'relative',
});

const StyledCurve = styled(Curve)(size('100%'), {
  fill: colors.primary,
  position: 'absolute',
  top: 0,
  left: 0,
});

const Heading = styled('h1')({
  margin: `${unit * 3}px 0 ${unit * 6}px`,
});
github apollographql / gatsby-theme-apollo / packages / gatsby-theme-apollo-core / src / components / menu-button.js View on Github external
import React from 'react';
import styled from '@emotion/styled';
import {IconMenu} from '@apollo/space-kit/icons/IconMenu';
import {size} from 'polished';

const StyledButton = styled.button({
  padding: 0,
  marginRight: 20,
  color: 'inherit',
  border: 'none',
  background: 'none',
  outline: 'none',
  cursor: 'pointer'
});

const StyledIcon = styled(IconMenu)(size(24), {
  display: 'block',
  fill: 'currentColor'
});

export default function MenuButton(props) {
  return (
    
      
    
  );
}

MenuButton.propTypes = {
  onClick: PropTypes.func.isRequired
};
github Amsterdam / amsterdam-styled-components / packages / asc-ui / src / components / IconButton / IconButtonStyle.ts View on Github external
${({ size: sizeProp }) =>
    sizeProp
      ? size(sizeProp)
      : css`
          width: 30px;
          height: 30px;
        `}