1.3.0 • Published 2 years ago

@baizey/styled-preact v1.3.0

Weekly downloads
-
License
GPL-2.0-only
Repository
github
Last release
2 years ago

Styled preact

The goal of this package is to provide a similar-ish experience of styling elements in preact as you can with styled-components in React

Usage

fx: Div instead of div, Header1 instead of H1 etc.

These new elements take an extra property on top of their normal ones, styling

A simple example would be something like:

function Container(props: MyProps & DivProps){
    return <Div {...props}
       styling={css`
        color: #000;
        
        &:focus {
            background-color: green;
        }
       `}
    />
}

And if you want to combine styling as it goes down the element-tree you can use

mergeStyling(higherPriority, lowerPriority)

an example could be

function Container({styling, ...props}: MyProps & DivProps){
    return <Div {...props}
       styling={mergeStyling(styling, css`
        color: #000;
        
        &:focus {
            background-color: green;
        }
       `)}
    />
}

Notes

This package is primarily developed to support my own projects, so it will likely be lacking in any features outside what I required. If this package is useful for someone, but it lacks features, a pull request is very welcome

1.2.18

2 years ago

1.2.19

2 years ago

1.3.0

2 years ago

1.2.16

2 years ago

1.2.17

2 years ago

1.2.15

2 years ago

1.2.8

2 years ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.9

2 years ago

1.2.12

2 years ago

1.2.13

2 years ago

1.2.10

2 years ago

1.2.11

2 years ago

1.2.14

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.2

2 years ago