1.0.1 • Published 1 year ago

@anthaathi/solid-styletron v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Styletron with SolidJS

Integrates Styletron to the SolidJS.

Installation

Add package to the app.

yarn add @anthaathi/solid-styletron styletron-engine-atomic

Configure the Styletron

import type {Component} from 'solid-js';
import {StyletronProvider, useStyletron} from '@anthaathi/solid-styletron';
import {Client} from 'styletron-engine-atomic';

// Configure theme object
const THEME_OBJECT = {
    colorRed: 'red',
};

// Initiate client for styletron
const client = new Client({prefix: '_'});

function Elem(props) {
    const [css, $theme] = useStyletron();

    return <div class={css({ color: $theme.colorRed })}>{props.children}</div>
}

function App() {
    <StyletronProvider theme={THEME_OBJECT} client={client}>
        <Elem/>
    </StyletronProvider>
}

// Declare custom theme
declare module '@anthaathi/solid-styletron' {
    export interface StyletronTheme {
        colorRed: string;
    }
}
1.0.1

1 year ago

1.0.0

1 year ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago