0.1.2 • Published 2 years ago

@ereminnf/rui v0.1.2

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

React-ui

React components

📦 Install

npm install @ereminnf/rui

📝 Usage

React

import { Button } from '@ereminnf/rui'

const App = () => {
    return (
        <>
            <Button variant='accent'>Button</Button>
        </>
    )
}

Styles

// from node_modules for syntax highlighter vars
@import '/node_modules/@ereminnf/rui/lib/styles';

@import '@ereminnf/rui/button';

.rui-button {
    // ...override
}

🔨 Generic with typescript

import React from 'react'
import clsx from 'clsx'
import style from './index_module.scss'
import {
    Button:RuiButton,
    ButtonProps:RuiButtonProps
} from '@ereminnf/rui/button'

interface ButtonProps extends RuiButtonProps {
    /** Custom property */
    label?: string
}

export const Button: React.FC<ButtonProps> = ({ children, classes, ...rest }) => {
    const classNames = {
        ...classes,
        root: {
            clsx(style.root, classes.root)
        }
    }
    return (
        <RuiButton classes={classNames} {...rest}>{label || children}</RuiButton>
    )
}