0.2.4 • Published 3 years ago

nitramui v0.2.4

Weekly downloads
102
License
ISC
Repository
-
Last release
3 years ago

NitramUI

npm GitHub stars npm GitHub Join the chat at https://gitter.im/nitramui/community


Don’t worry about design, HTML, and CSS. Just use NitramUI’s components, play around with options, select a built–in theme (or let the user select it), and focus on the rest.

If you want to customize your project’s look and feel, this is not for you. This is for you if you want a design system which is lightweight, easy to use, and user–oriented.

Head over to the Demo.

Light and Dark Modes

Screenshot Screenshot

Design principles

  • Convention over customization.
  • Complete abstraction from HTML/CSS, which means you can’t set custom classes or style attributes to the elements. Instead, components have their own size–variant properties. For example, Panes have a size property with options like: default, small, full, square, …

Getting started

Add fonts and root style

Add these lines in the head of your index.html:

<link href="https://fonts.googleapis.com/css2?family=Inconsolata&family=Inter:wght@200;400;600&display=swap" rel="stylesheet">
<style>#root { height: 100%; }</style>

This is due to an issue with @import and createGlobalStyle. Read more: Note regarding css @import and createGlobalStyle.

NitramUI options

  • customThemes
  • availableThemes

NitramUIContext

  • mode: (string) current mode name. Default: light.
  • setMode: (function) sets mode.
  • theme: (string) current theme name. Defaults to the first theme in the availableThemes NitramUI prop, or to smooth if availableThemes is not set.
  • setTheme: (function) sets theme.
  • themes: (object) available themes, built-in and custom. Default:
    {
      "smooth": "smooth",
      "hiContrast": "hiContrast"
    }
  • ds: (object) design system definition. Each attributed has to be accesed using getDSVal. See: designSystem
  • getDSVal: (function) useful to get mode and theme aware values from the design system. Example: getDSVal(ds.colors.bg)

Change theme and mode

import { modes, NitramUI, NitramUIContext } from 'nitramui'

export const App = () => {
  return (
    <NitramUI>
      <NitramUIContext.Consumer>
        {({ mode, setMode }) => (
          <Layout
            menuB={(
              <Control
                type='select'
                value={mode}
                onChange={setMode}
                options={Object.entries(modes).map(([_key, value]) => ({ label: value, value }))}
              />
            )}
          >
            <p>FG color: {getDSVal(ds.colors.fg)}</p>
          </Layout>
        )}
      </NitramUIContext.Consumer>
    </NitramUI>
  )
}

Get design system attributees (theme and mode aware)

import { NitramUI, NitramUIContext } from 'nitramui'

export const App = () => {
  return (
    <NitramUI>
      <NitramUIContext.Consumer>
        {({ ds, getDSVal }) => (
          <Layout>
            <p>FG color: {getDSVal(ds.colors.fg)}</p>
          </Layout>
        )}
      </NitramUIContext.Consumer>
    </NitramUI>
  )
}

Note: NitramUIContext has to be consumed within NitramUI scope.

Roadmap

  • Use Storybook
  • Test reset using createGlobalStyle
  • Add Inter, Inconsolata
  • Headings font
  • top and bottom fixed bars
  • Add eslint
  • Add themes (smooth, dark, high-contrast, …)
  • Add box shadow to design system
  • Export GlobalStyle and ThemeProvider (do not export reset)
  • Make smooth default theme when there is no ThemeProvider (test in Layout/Full story)
  • Build NitramUI into a library
  • Add a screenshot
  • Add license
  • Add Pane size: half
  • Fix labelStyles (or just vertical padding) for inputs and selects
  • Create form control component (for inputs and selects with or without labels)
  • Make onChange optional on controls
  • Export design system variables aware of theme and mode
  • Add instructions for NitramUIContext.Consumer, and controlling modes and themes
  • Add button variants (secondary, text, …)
  • Fix too many scrollbars on Windows
  • Prevent control labels from being selected (reproduce with double click on them)
  • Pass ref to controls
  • Have the outter pane have the scroll. E.g: default pane inside full-width pane (<Pane height='auto'> inside a Layout or Container with scroll='vertical')
  • Center panes horizontally
  • Add git hook for build and build storybook
  • Add button link (https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md)
  • Add instructions for customThemes and availableThemes props
  • Add hook for auto dark mode
  • Add packagequality.com badge
  • Create React App template
  • Responsive layout (what to do with the sidebar pane?)
  • Check for updates
  • Add terser (https://www.npmjs.com/package/rollup-plugin-terser)
  • Move some dependencies to devDependencies/peerDependencies (does this prevent them to be installed when installed this package, for example popper.js which I think comes from storybook)
  • Add guidelines for contributors
  • Add build badge
  • Add tests
  • Add tests coverage badge
  • Is having funding/sponsors/buy-me-a-beer/bitcoin-wallet a good idea?
  • Create custom font with Glyphsapp Mini

Useful articles:

0.2.4

3 years ago

0.2.3

3 years ago

0.2.1

3 years ago

0.2.2

3 years ago

0.2.0

3 years ago

0.1.96

3 years ago

0.1.95

3 years ago

0.1.94

4 years ago

0.1.93

4 years ago

0.1.92

4 years ago

0.1.91

4 years ago

0.1.90

4 years ago

0.1.89

4 years ago

0.1.88

4 years ago

0.1.85

4 years ago

0.1.86

4 years ago

0.1.87

4 years ago

0.1.84

4 years ago

0.1.83

4 years ago

0.1.81

4 years ago

0.1.82

4 years ago

0.1.80

4 years ago

0.1.79

4 years ago

0.1.78

4 years ago

0.1.77

4 years ago

0.1.75

4 years ago

0.1.76

4 years ago

0.1.74

4 years ago

0.1.73

4 years ago

0.1.72

4 years ago

0.1.71

4 years ago

0.1.70

4 years ago

0.1.68

4 years ago

0.1.69

4 years ago

0.1.67

4 years ago

0.1.66

4 years ago

0.1.65

4 years ago

0.1.64

4 years ago

0.1.63

4 years ago

0.1.62

4 years ago

0.1.61

4 years ago

0.1.59

4 years ago

0.1.60

4 years ago

0.1.57

4 years ago

0.1.58

4 years ago

0.1.55

4 years ago

0.1.56

4 years ago

0.1.54

4 years ago

0.1.53

4 years ago

0.1.52

4 years ago

0.1.51

4 years ago

0.1.50

4 years ago

0.1.49

4 years ago

0.1.48

4 years ago

0.1.47

4 years ago

0.1.46

4 years ago

0.1.45

4 years ago

0.1.44

4 years ago

0.1.43

4 years ago

0.1.42

4 years ago

0.1.41

4 years ago

0.1.40

4 years ago

0.1.38

4 years ago

0.1.39

4 years ago

0.1.37

4 years ago

0.1.35

4 years ago

0.1.36

4 years ago

0.1.34

4 years ago

0.1.33

4 years ago

0.1.32

4 years ago

0.1.31

4 years ago

0.1.30

4 years ago

0.1.28

4 years ago

0.1.29

4 years ago

0.1.27

4 years ago

0.1.26

4 years ago

0.1.25

4 years ago

0.1.23

4 years ago

0.1.24

4 years ago

0.1.22

4 years ago

0.1.21

4 years ago

0.1.20

4 years ago

0.1.18

4 years ago

0.1.19

4 years ago

0.1.17

4 years ago

0.1.16

4 years ago

0.1.15

4 years ago

0.1.14

4 years ago

0.1.13

4 years ago

0.1.12

4 years ago

0.1.11

4 years ago

0.1.10

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.2

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago