Coder Social home page Coder Social logo

iperka / iui Goto Github PK

View Code? Open in Web Editor NEW
1.0 0.0 0.0 3.48 MB

UI Component library for iperka. ๐Ÿงฉ

Home Page: https://www.chromatic.com/library?appId=62aece68e29ccfa98f49e265

License: MIT License

EJS 3.01% JavaScript 3.83% TypeScript 92.14% CSS 0.17% SCSS 0.84%
component-library react storybook typescript user-interface

iui's Introduction

UI Component library for iperka ๐Ÿงฉ

React component library for all iperka apps using React and TypeScript.

Screenshots

Chromatic Library

Install โš™

In order to work the GitHub package registry must be added. See docs

$ yarn add @iperka/iui@latest

Usage ๐ŸŽˆ

Note that the instructions for using your library are slightly different if you published to a private repository. Everyone (aside from your own machine) who tries to import it is going to get a 404 Not Found error if they are not authorized.

Those users also need to add a ~/.npmrc file with the same information. To be more secure however you can provide those users with an access token that has only read privileges, not write.

(From this point onward we will presume you have completed that step, or are working with a public repository.)

Since we have created a component library using React and Typescript, we are presuming that the consumers of our library will be using those tools as well. Technically all of our type files (.d.ts) are supplemental: meaning they are simply ignored if working with standard Javascript, so it's not necessary to use Typescript to use our library. The types are simply there if desired.

For our example we will use it however so that we can confirm that they are working properly. We will initialize a React app using one of the most popular and simple methods: Create React App.

Run the following command in a new directory:

(Remember we are simulating other users downloading and installing our library, so this project should be completely separate from the library itself)

$ yarn create react-app my-app --template typescript
$ cd my-app

Open the new my-app directory that is created and run:

$ yarn start

Confirm that you are able to open and load the default application screen on localhost:3000 (or whatever port it opens on).

Now comes the test for our library. From the root directory of your new my-app project, run the following command:

$ yarn add @iperka/iui

Presuming your tokens and configuration are set up properly, everything will install correctly (if there are any issues, revisit the example for the ~/.npmrc config.)

Import the library into the project and start adding components.

import { Button } from "@iperka/iui";

const Example = () => {
  return <Button>Hello world</Button>;
};

Development ๐Ÿ™‡โ€โ™‚๏ธ

There are several predefined scripts that allow for easy development.

  1. Clone this repository.
  2. Install all required modules with yarn.
  3. Start Storybook with yarn storybook.
  4. Create or adjust components and watch life changes in storybook.

Disclaimer! If you are using a Window computer (I don't know why). Setting the NODE_ENV value via script may fail, just run npm i -g win-node-env and try again, this should solve the issue.

Available scripts ๐Ÿš€

Build

This script builds the library for production and creates all files in the dist folder.

$ yarn rollup

Test

The test script runs all tests.

$ yarn test

Storybook

The storybook script starts the storybook server. This is useful for development and testing.

$ yarn storybook

Creating a new component ๐Ÿ“ฆ

In order to create a new component you can use the following command:

$ yarn hygen component new MyComponent

This will automatically create a new component with the structure described in the next section.

Component Structure ๐Ÿšง

To prevent nasty circular dependencies every component and structure includes a index.{ts,tsx} file which exports the required parts. Every other file depending on a exported function should include the index file only!

src/
โ”œโ”€โ”€ components/
โ”‚   โ”œโ”€โ”€ Button/
โ”‚   โ”‚   โ”œโ”€โ”€ Button.stories.tsx # Defines storybook stories
โ”‚   โ”‚   โ”œโ”€โ”€ Button.test.tsx # Jest tests for this component
โ”‚   โ”‚   โ”œโ”€โ”€ Button.tsx # Component file
โ”‚   โ”‚   โ”œโ”€โ”€ Button.types.ts # Exports interface with props and states
โ”‚   โ”‚   โ””โ”€โ”€ index.ts # Exports component file
โ”‚   โ””โ”€โ”€ index.ts # Exports all components with name
โ””โ”€โ”€ index.ts # Exports all

iui's People

Contributors

michaelbeutler avatar dependabot[bot] avatar

Stargazers

 avatar

iui's Issues

`CalendarDay` events not rendered correctly when interval != 15.

Describe the bug
Whenever the interval is set to any different value than 15. The alignment isn't correct.

image

To Reproduce
Steps to reproduce the behavior:

  1. Start the storybook by running yarn stroybook
  2. Click on 'CalendarDay/Default'
  3. Scroll down and adjust interval value.
  4. See error

Expected behavior
Even if interval has been changed, the time and events should align correctly and according to event start and end time.

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.