2.1.87 • Published 2 years ago

segel-ui v2.1.87

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

Segel UI

Sumary

UI component library for the pages from Serturner Institut.

The library es built using React and TailwindCSS.

In order to get the maximum compatibility, we opted to use the rollup library to make the bundle instead webpack. This allows us to create a bundle that can be used in projects that don't use typescript without sacrificing the new ecmascript features. The complete project is written in typescript with a lintern like ESLint to ensure that all the team follows the same code style.

The tool Storybook is used to write a documentation and develop without create a pet project.

Motivation

UNDER CONSTRUCTION

Get started

  1. install library
yarn add segel-ui
  1. import specific css for tailwind

@import 'ui/src/styles/index.css';
  1. configure tailwindcss

Modify the file tailwind.config.js with next code:

module.exports = require('segel-ui').getDefaultConfig() 

You can pass your own configuration to modify the default from the library (NOT READY)

Development Notes

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.

In order to develop new components we need to setup the project with the command

yarn install

All components are located in src folder. The components that we want to expose on the library MUST be exported to outside on the index.ts file.

Folder Structure

  • src On this folder we can found all components that are available.

  • stories Here are located the component stories with some visual examples and how to use

Styling the components

In order to add styles to the components we MUST use the tailwindCSS style, that means use all utility classes defined by tailwind. When the property className is too long and becomes complicated to read or tailwind does not offer a specific solution you can add specific css in the index.css file. (RECOMMEND GUIDELINE)

Example:

/**
 *  Component using styles defined in tailwindcss. It's no necesary create css files unless the class name becomes unreadable or the style is not available
 */
function MyComponent () {
	return <div className="m-4 p-4 border border-blue-600 rounded text-gray-800 hover:bg-blue-100 w-full h-10">
		Hello world!
	</div>
}

Working with the theme

In order to mantain a standart with paddings, margings, etc. We MUST to style the component using the theme methods.

Example:

function MyComponent({ theme }) {
	const padding = theme.padding.sm;
	const maring = theme.margin.sm;
	return <div className={`${padding} ${margin} border border-blue-600 rounded text-gray-800 hover:bg-blue-100 w-full h-10`}>
		Hello world!
	</div>
}
export default withTheme(MyComponent);

ESLint

We use ESLint with the rules provided by airbnb with some modifications that makes sense for us. In order to keep the same style on the coding phase, pull requests are enforced to check the lint rules. If the ESLint rejects the checks you MUST fix it to make the merge with the main branch. You can check any time if you have any errors in ESLint using the command prompt with yarn lint. Or use the ESLint extension for Visual Studio Code.

Typescript

All components SHOULD be exported providing the types for its props and its references. The types MUST be named first with the name of the component and adding either Props or Ref at the end (e.g. BoxProbs view Box.tsx). In the event that you want to use all generic props for an HTML element in React, you SHOULD use the strategy outlined here: React Typescript Cheatsheet

Example with theme:

interface MyComponentProps extends ComponentTheme;

function MyComponent({ theme }: MyComponentProps) {
	const padding = theme.padding.sm;
	const maring = theme.margin.sm;
	return <div className={`${padding} ${margin} border border-blue-600 rounded text-gray-800 hover:bg-blue-100 w-full h-10`}>
		Hello world!
	</div>
}
export default withTheme<MyComponentProps>(MyComponent);

Use StoryBook to create the components

Storybook is an open source tool for building UI components and pages in isolation. So running the command

yarn storybook

you open the storybook panel to develop the components and its edge cases.

Manual Link to a project

Under construction

2.1.87

2 years ago

2.1.85

2 years ago

2.1.86

2 years ago

2.1.83

2 years ago

2.1.84

2 years ago

2.1.81

2 years ago

2.1.82

2 years ago

2.1.80

2 years ago

2.1.78

2 years ago

2.1.79

2 years ago

2.1.76

2 years ago

2.1.77

2 years ago

2.1.75

2 years ago

2.1.73

2 years ago

2.1.9

2 years ago

2.1.16

2 years ago

2.1.14

2 years ago

2.1.15

2 years ago

2.1.12

2 years ago

2.1.13

2 years ago

2.1.10

2 years ago

2.1.11

2 years ago

2.1.18

2 years ago

2.1.19

2 years ago

2.1.27

2 years ago

2.1.28

2 years ago

2.1.25

2 years ago

2.1.26

2 years ago

2.1.23

2 years ago

2.1.24

2 years ago

2.1.21

2 years ago

2.1.22

2 years ago

2.1.20

2 years ago

2.1.29

2 years ago

2.1.38

2 years ago

2.1.39

2 years ago

2.1.36

2 years ago

2.1.37

2 years ago

2.1.34

2 years ago

2.1.35

2 years ago

2.1.32

2 years ago

2.1.33

2 years ago

2.1.30

2 years ago

2.1.31

2 years ago

2.1.49

2 years ago

2.1.47

2 years ago

2.1.48

2 years ago

2.1.45

2 years ago

2.1.46

2 years ago

2.1.43

2 years ago

2.1.44

2 years ago

2.1.41

2 years ago

2.1.42

2 years ago

2.1.40

2 years ago

2.1.58

2 years ago

2.1.59

2 years ago

2.1.56

2 years ago

2.1.57

2 years ago

2.1.54

2 years ago

2.1.55

2 years ago

2.1.52

2 years ago

2.1.53

2 years ago

2.1.50

2 years ago

2.1.51

2 years ago

2.1.69

2 years ago

2.1.67

2 years ago

2.1.6

2 years ago

2.1.68

2 years ago

2.1.65

2 years ago

2.1.8

2 years ago

2.1.66

2 years ago

2.1.7

2 years ago

2.1.63

2 years ago

2.1.64

2 years ago

2.1.61

2 years ago

2.1.62

2 years ago

2.1.60

2 years ago

2.1.72

2 years ago

2.1.70

2 years ago

2.1.71

2 years ago

2.1.2

2 years ago

2.1.1

2 years ago

2.1.4

2 years ago

2.0.13

2 years ago

2.1.3

2 years ago

2.0.11

2 years ago

2.1.5

2 years ago

2.0.12

2 years ago

2.0.10

2 years ago

2.1.0

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.7

2 years ago

2.0.8

2 years ago

2.0.1

2 years ago

1.2.0

3 years ago

1.2.8

3 years ago

1.2.7

3 years ago

1.2.6

3 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.4.1

2 years ago

1.2.3

3 years ago

1.4.0

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.0.26

3 years ago

2.0.0

2 years ago

1.0.27

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.3.4

3 years ago

1.5.1

2 years ago

1.3.3

3 years ago

1.5.0

2 years ago

1.3.2

3 years ago

1.1.4

3 years ago

1.3.1

3 years ago

1.1.3

3 years ago

1.3.0

3 years ago

1.1.2

3 years ago

1.0.25

3 years ago

1.0.24

3 years ago

1.0.23

3 years ago

1.0.22

3 years ago

1.0.21

3 years ago

1.0.19

3 years ago

1.0.20

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.5

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago