1.3.2 • Published 6 years ago

styled-utils v1.3.2

Weekly downloads
9
License
ISC
Repository
github
Last release
6 years ago

styled-utils

npm npm JavaScript Style Guide styled with prettier

Introduction

styled-utils is a collection of util functions for styled-components

Installation

npm install styled-utils --save
yarn add styled-utils

Usage

Play with it here

Example

import React from 'react'
import styled, { ThemeProvider } from 'styled-components'
import { withColor, withHover, withSize, withDisplay, isOutlined } from 'styled-utils'


const Button = styled.a`
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 0 1.5em;
  height: 2.25em;
  border: 1px solid transparent;
  border-radius: 5px;
  margin: 0 5px 5px 0;
  cursor: pointer;
  text-align: center;

  ${withColor}
  ${withHover}
  ${withSize}
  ${withDisplay}
  ${isOutlined}
`

const theme = {}

theme.palettes = {
  primary: ['#1b8ceb', '#106cb9'],
  success: ['#4caf50', '#388e3c'],
  danger: ['#e91e63', '#c2185b'],
  white: ['#fff', '#fff']
}

theme.sizes = {
  maxWidth: '600px',
  font: {tiny: '0.55rem', small: '0.75rem', medium: '1rem', large: '1.25rem', big: '1.5rem', huge: '2rem'}
}

const Main = props => {
  return (
    <ThemeProvider theme={theme}>
      <div>
        <Button color='primary'>Click Me</Button>
        <Button color='success'>Click Me</Button>
        <Button color='danger' isOutlined>Click Me</Button>
        <Button color='white' isInverted>Click Me</Button>
        <Button color='primary' display='flex' size='large'>Click Me</Button>
        <Button color='primary' size='tiny'>Click Me</Button>
      </div>
    </ThemeProvider>
  )
}

export default Main
1.3.2

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.6

7 years ago

1.2.5

7 years ago

1.2.4

7 years ago

1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.28

7 years ago

1.1.27

7 years ago

1.1.26

7 years ago

1.1.25

7 years ago

1.1.24

7 years ago

1.1.23

7 years ago

1.1.22

7 years ago

1.1.21

7 years ago

1.1.20

7 years ago

1.1.19

7 years ago

1.1.18

7 years ago

1.1.17

7 years ago

1.1.16

7 years ago

1.1.15

7 years ago

1.1.14

7 years ago

1.1.13

7 years ago

1.1.12

7 years ago

1.1.11

7 years ago

1.1.10

7 years ago

1.1.9

7 years ago

1.1.8

7 years ago

1.1.7

7 years ago

1.1.6

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.0

7 years ago

1.0.10

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago