0.4.0-alpha.25 • Published 5 days ago

inlines v0.4.0-alpha.25

Weekly downloads
-
License
ISC
Repository
github
Last release
5 days ago

Inlines

When you just want to use the inline style prop in React.

Uses inline styles where possible, uses dynamic stylesheets for the rest.

For example

import { styled } from 'inlines'

const App = () => {
  return (
    <styled.div
      style={{
        border: '10px solid purple',
        background: 'yellow',
        '@media (min-width: 600px)': {
          background: 'hotpink'
        },
        '@keyframes': {
          from: {
            opacity: 0
          },
          to: {
            opacity: 1
          }
        }
      }}
    >
      <div
        style={{
          marginBottom: 8
        }}
      >
        Just use normal elements when you can
      </div>
      <styled.input
        placeholder="Wow I'm orange"
        style={{
          border: '1px solid blue',
          '&::placeholder': {
            color: 'orange'
          }
        }}
      />
      <styled.button
        style={{
          border: '1px solid red',
          '&:hover': {
            background: 'yellow'
          },
          '&:active': {
            background: 'red'
          }
        }}
      >
        Look I'm a button
      </styled.button>
    </styled.div>
  )
}

export default App

Or use styled as a function if you prefer:

import { styled } from 'inlines'

const Container = styled('div', {
  border: '10px solid purple',
  background: 'yellow',
  '@media (min-width: 600px)': {
    background: 'hotpink'
  },
  '@keyframes': {
    from: {
      opacity: 0
    },
    to: {
      opacity: 1
    }
  }
})

const Input = styled('input', {
  border: '1px solid blue',
  '&::placeholder': {
    color: 'orange'
  }
})

const Button = styled('button', {
  border: '1px solid red',
  '&:hover': {
    background: 'yellow'
  },
  '&:active': {
    background: 'red'
  }
})

const App = () => {
  return (
    <Container>
      <div
        style={{
          marginBottom: 8
        }}
      >
        Just use normal elements when you can
      </div>
      <Input placeholder="Wow I'm orange" />
      <Button>Look I'm a button</Button>
    </Container>
  )
}

export default App
0.4.0-alpha.25

5 days ago

0.4.0-alpha.18

24 days ago

0.4.0-alpha.4

25 days ago

0.4.0-alpha.19

24 days ago

0.4.0-alpha.3

25 days ago

0.4.0-alpha.14

24 days ago

0.4.0-alpha.15

24 days ago

0.4.0-alpha.16

24 days ago

0.4.0-alpha.17

24 days ago

0.4.0-alpha.10

24 days ago

0.4.0-alpha.11

24 days ago

0.4.0-alpha.12

24 days ago

0.4.0-alpha.13

24 days ago

0.4.0-alpha.9

24 days ago

0.4.0-alpha.8

24 days ago

0.4.0-alpha.7

24 days ago

0.4.0-alpha.6

24 days ago

0.4.0-alpha.5

24 days ago

0.4.0-alpha.21

23 days ago

0.4.0-alpha.22

23 days ago

0.4.0-alpha.23

23 days ago

0.4.0-alpha.24

23 days ago

0.4.0-alpha.20

24 days ago

0.4.0-alpha.2

4 months ago

0.4.0-alpha.1

5 months ago

0.4.0-alpha.0

5 months ago

0.3.0

5 months ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago