How to use the reakit/styled function in reakit

To help you get started, weโ€™ve selected a few reakit 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 fannypackui / fannypack / src / Spinner / styled.js View on Github external
transform: rotate(360deg);
  }
`;
export const spinnerProperties = css`
  animation: ${rotate} 0.6s infinite linear;
  border: 0.1em solid ${props => palette(props.color)(props)};
  border-radius: 100%;
  border-right-color: transparent;
  border-top-color: transparent;
  display: inline-block;
  height: 1em;
  width: 1em;
  position: relative;
`;

export default styled(Box)`
  font-size: 20px;
  ${spinnerProperties};

  & {
    ${theme('fannypack.Spinner.base')};
  }

  ${props => sizes[props.size]} /* Extend size styles */;
`;
github fannypackui / fannypack / src / Table / styled.js View on Github external
// @flow
import styled, { css } from 'reakit/styled';
import { theme } from 'styled-tools';
import Box from 'reakit/Box';

export const Caption = styled(Box)`
  caption-side: ${props => props.position};

  & {
    ${theme('fannypack.Table.Caption.base')};
  }
`;

export const TableCell = styled(Box)`
  padding: ${theme('fannypack.Table.spacing')}rem;

  & {
    ${theme('fannypack.Table.Cell.base')};
  }
`;

export const TableFoot = styled(Box)`
  font-weight: bold;

  & {
    ${props =>
      props.hasBorder &&
      css`
        border-top: 2px solid ${theme('fannypack.Table.borderColor')};
      `};
github fannypackui / fannypack / src / Switch / styled.js View on Github external
// @flow
import styled, { css } from 'reakit/styled';
import { palette, theme } from 'styled-tools';
import { tint } from 'polished';
import Label from 'reakit/Label';

import { Box } from '../primitives';
import HiddenInput from '../_utils/HiddenInput';

export const SwitchIcon = styled(Box)`
  background-color: ${palette('whiteDarker')};
  border: 1px solid #bdbdbd;
  border-radius: 1em;
  height: 1.5em;
  position: relative;
  width: 3em;

  & {
    ${props =>
      props.state &&
      css`
        border-color: ${props => palette(`${props.state}Lighter`)};
        box-shadow: ${props => palette(`${props.state}Lighter`)} 0px 0px 0px 1px !important;
      `};
  }
github fannypackui / fannypack / src / Button / styled.js View on Github external
import styled from 'reakit/styled';
import Box from 'reakit/Box';
import Button from 'reakit/Button';
import { palette } from 'styled-tools';
import { darken } from 'polished';

export const DefaultButton = styled(Button)`
  background-color: ${palette()};
  border: 1px solid ${props => darken(0.2, palette()(props))};
  color: ${props => palette(`${props.palette}Inverted`)(props)};
`;

export const OutlinedButton = styled(Button)`
  background-color: unset;
  border: 1px solid ${palette()};
  color: ${palette()};

  &:hover {
    color: ${props => palette(`${props.palette}Inverted`)(props)};
  }
`;

export const LinkButton = styled(Button)`
github fannypackui / fannypack / src / Textarea / styled.js View on Github external
top: 16px;
      right: 12px;
    }

    & {
      ${theme('fannypack.Textarea.sizes.large')};
    }
  `
};

const stateProperties = css`
  border-color: ${props => palette(`${props.state}Lighter`)(props)};
  box-shadow: ${props => palette(`${props.state}Lighter`)(props)} 0px 0px 0px 1px !important;
`;

export default styled(use(Input, 'textarea'))`
  border: 1px solid #bdbdbd;
  box-shadow: inset 0px 1px 2px #e5e5e5;
  border-radius: 0.2em;
  width: 100%;
  padding: 0.4em 0.6em;

  &[disabled] {
    background-color: ${palette('whiteDarker')};
    box-shadow: unset;
    color: ${palette('grayLight')};

    & {
      ${theme('fannypack.Textarea.disabled')};
    }
  }
github fannypackui / fannypack / src / Switch / styled.js View on Github external
uncheckedIconCss: css`
    background: white;
    content: '';
    border-radius: 100%;
    border: 1px solid #bdbdbd;
    height: 1em;
    width: 1em;
    top: 0.2em;
    left: 0.2em;
    transition: all ease 0.2s;
    position: absolute;
  `,
  themePrefix: 'Switch'
});

export default styled(Label)`
  align-items: center;
  cursor: ${props => (props.disabled ? 'not-allowed' : 'pointer')};
  display: flex;

  & {
    ${theme('fannypack.Switch.label')};
  }
`;
github fannypackui / fannypack / src / Buttons / styled.js View on Github external
const groupedProperties = css`
  & > *:not(:first-child) {
    border-bottom-left-radius: 0px;
    border-top-left-radius: 0px;
    border-left-width: 0px;
  }
  & > *:not(:last-child) {
    border-bottom-right-radius: 0px;
    border-top-right-radius: 0px;
  }
  & {
    ${theme('fannypack.Buttons.grouped')};
  }
`;

export default styled(Box)`
  & > *:not(:first-child) {
    margin-left: ${props => (props.isGrouped ? '' : '0.5rem')};
  }
  & {
    ${theme('fannypack.Buttons.base')};
  }
  ${props => props.isGrouped && groupedProperties};
`;
github fannypackui / fannypack / src / _utils / HiddenInput.js View on Github external
export default ({
  Icon,
  checkedCss,
  disabledCheckedCss,
  disabledCheckedIconCss,
  disabledUncheckedIconCss,
  checkedIconCss,
  uncheckedIconCss,
  themePrefix
}) => styled(Input)`
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  position: absolute;
  width: 1px;

  & + ${Icon} {
    &::before {
      ${uncheckedIconCss};

      & {
        ${theme(`fannypack.${themePrefix}.icon.unchecked`)};
      }
    }
  }
github fannypackui / fannypack / src / Text / styled.js View on Github external
import styled from 'reakit/styled';
import Box from 'reakit/Box';
import { theme } from 'styled-tools';
import Icon from '../Icon/styled';

export default styled(Box)`
  abbr& {
    border-bottom: 1px dotted;
    cursor: help;
    text-decoration: none;
  }

  i& {
    font-style: italic;
  }

  kbd& {
    background: #454d5d;
    border-radius: 0.1rem;
    color: #fff;
    fill: #fff;
    padding: 0.1rem 0.2rem;
github fannypackui / fannypack / src / Button / styled.js View on Github external
`;

export const LinkButton = styled(Button)`
  border: 0;
  background: unset;
  box-shadow: unset !important;
  color: ${props => (props.palette === 'default' ? palette('text')(props) : palette()(props))};
  text-decoration: underline;

  &:hover {
    color: ${props =>
      props.palette === 'default' ? darken(0.5, palette('text')(props)) : darken(0.5, palette()(props))};
  }
`;

export const SpinnerWrapper = styled(Box)`
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;

  & + div {
    opacity: 0;
  }
`;