GithubHelp home page GithubHelp logo

yhuley / panenco-ui Goto Github PK

View Code? Open in Web Editor NEW

This project forked from panenco/panenco-ui

0.0 0.0 0.0 3.36 MB

Home Page: https://panenco.github.io/panenco-ui/

License: MIT License

JavaScript 27.51% HTML 0.02% TypeScript 70.45% SCSS 1.98% Shell 0.05%

panenco-ui's Introduction

Panenco UI

Panenco UI is our own design system that is created to unify the way we create user interfaces.

It provides you a way for it's customization via Theming and Modes.

Principles

Theme

Theme - is a color pallete used for determination of whole project styling. While Panenco UI has it's crosstheme styles, that styles are project dependent. Choose or define Theme according to your project's branding colors, etc.

Mode (Dark/Light appearence)

Each theme has two different appearences. So interfaces built on top of Panenco UI are ready to be used with Light or Dark modes.

Installation and usage

Install

In the project you'd like to add our lovely Panenco UI to, just add it as a depencency:

yarn add @panenco/ui

Use

To start importing and using components in your project, you need:

  • Import css of Panenco UI from @panenco/ui/lib/styles.css. It could be any way of global import of styles into your project. For instance, using import in js with propper loader or using @import in your css.
  • Include Panenco UI icons by importing @panenco/ui/lib/spritesheet.svg as file (to obtain it's URL and be able to inject it to DOM asyncronously) and pass it to injectIcons function as shown below.
  • Wrap your application with ThemeProvider component from @panenco/ui and pass theme and mode to it (optionally).
import React from 'react';
import { render } from 'react-dom';
import AppContainers from 'containers';
import { ThemeProvider, injectIcons } from '@panenco/ui';
import { theme } from './theme';

import '@panenco/ui/lib/styles.css';
import svgSprite from '!file-loader!@panenco/ui/lib/spritesheet.svg';

injectIcons(svgSprite);

const App = () => (
  <ThemeProvider theme={theme}>
    <AppContainers />
  </ThemeProvider>
);

render(<App />, document.getElementById('root'));

Theme definition

Theme is just a nested object with properties defining appearence of your UI.

type PUITheme = {
  colors: PUIColors & {
    darkMode?: PUIModeColors;
    lightMode?: PUIModeColors;
  };
  typography: {
    sizes: PUISizes;
    weights: PUIWeights;
  };
};

There are two properties colors and typography.

colors definition

Colors that are defined within theme is represented with next type:

export type PUIColors = {
  alert: string;
  error: string;
  success: string;
  primary200: string;
  primary500: string;
  primary700: string;
  primary900: string;
  base100: string;
  base200: string;
  base300: string;
  base400: string;
  base500: string;
  base600: string;
  base700: string;
  base800: string;
  base900: string;
};

Also you have an option to override theme colors dependending on current mode.

colors: PUIColors & {
    darkMode?: PUIModeColors;
    lightMode?: PUIModeColors;
};

Each mode is represented by similar to PUIColors type with all colors optional. This behaviour makes possible changing colors of your components depending on mode.

typograpty definition

Typography consists of two properties: sizes and weights. They are used as a base for Text component. Setting of this properties has an impact on all text sizes in all components around Panenco UI. Also, when using custom fonts, it's highly recommended to set propper weights of the font you use.

export type PUIWeights = {
  thin: number;
  light: number;
  regular: number;
  medium: number;
  bold: number;
  black: number;
};

export type TextSize = { textSize: string; lineHeight: string | number };

export type PUISizes = {
  xs: TextSize;
  s: TextSize;
  m: TextSize;
  l: TextSize;
  xl: TextSize;
  h3: TextSize;
  h2: TextSize;
  h1: TextSize;
};

Exported external modules

panenco-ui's People

Contributors

vlacher12 avatar doichev-kostia avatar vozbrann avatar lazzystep avatar oleksii-kotvytskyi avatar alinababenko02 avatar dmytrolyn avatar kaliahinartem avatar golotamishka avatar andrii-pavlenko avatar klevytskyi avatar sergdeev avatar dependabot[bot] avatar kkurylchenko avatar taras-venger avatar siniiitsa avatar olhanikoliuk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.