aalmeida00 / sagu-ui

It's a simple and faster React UI

Home Page:https://vczb.github.io/sagu-ui

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SAGU-UI

It's a simple and faster React UI

Installation

sagu-ui is available as an npm package.

To install it, run:

  //with npm
  npm install sagu-ui

  //with yarn
  yarn add sagu-ui

styled-components package is required

Usage

Here is a quick example to get you started, it's all you need:

import React from 'react'
import { theme, SaguGlobalStyles, SaguProvider, Button } from 'sagu-ui'

function App() {
  return (
    <SaguProvider theme={theme}>
      <SaguGlobalStyles />
      <Button>Click me</Button>
    </SaguProvider>
  )
}

export default App

Theme customization

You can easily override the values of the theme object

import { theme, SaguProvider } from 'sagu-ui'

function App() {
  const customTheme = Object.assign(theme)

  customTheme.colors.primary.medium = '#510763'

  return <SaguProvider theme={customTheme}>...</SaguProvider>
}

Also you can add an entire custom object and it will be available on the Provider

import { theme, SaguProvider } from 'sagu-ui'
import { CustomWrapper } from './components/CustomWrapper'

function App() {
  const customTheme = Object.assign(theme)

  customTheme.colors.tertiary = {
    lighter: '#fb973a',
    light: '#e37c1d',
    medium: '#da710f',
    dark: '#9e4c01'
  }

  return (
    <SaguProvider theme={customTheme}>
      <CustomWrapper>...</CustomWrapper>
    </SaguProvider>
  )
}
// components/CustomWrapper.ts
import styled, { css } from 'styled-components'

export const CustomWrapper = styled.div`
  ${({ theme }) => css`
    background: ${theme.colors.tertiary.medium};
  `}
`

Component customization

You have too many ways to customize the Sagu components

Using styled-components

import styled from 'styled-components'
import { Button } from 'sagu-ui'

const MyCustomButton = styled(Button)`
  background: red;
`
...

<MyCustomButton>My Button</MyCustomButton>

Using inline styles

import { Button } from 'sagu-ui'

...

<Button
  style={{
    background: 'yellow'
  }}
>
  My Button
</Button>

Using CSS classes

.button-green {
  background: green;
}
import { Button } from 'sagu-ui'
import './styles.css'

...

<Button className="button-green">My Button</Button>

Examples

Take a look at some examples using Sagu-UI

Contributing

You can contribute to this project by opening an issue or creating a pull request.

What is inside?

Available commands

  • build: build the files in the lib directory
  • sb: run the storybook at the address localhost:6006
  • prettier:check: check formatting on all src directory
  • prettier:format: formats all src directory
  • generate <Component name>: create a component boilerplate
  • test: test all components

Project structure

/.storybook
/lib
/src
├── index.ts
├── animations
|   ├── placeholder.ts
├── hooks
|   ├── ...
├── packages
|   ├── index.ts
|   ├── Button
|   |   ├── index.tsx
|   |   ├── stories.tsx
|   |   └── styles.ts
|   |   └── test.tsx
├── styles
|   ├── global.ts
|   ├── theme.ts
|   ├── provider.ts

License

This project is licensed under the MIT License.

About

It's a simple and faster React UI

https://vczb.github.io/sagu-ui

License:MIT License


Languages

Language:TypeScript 98.3%Language:JavaScript 1.3%Language:Handlebars 0.4%