Skip to content
This repository was archived by the owner on Jun 2, 2024. It is now read-only.

Commit 65ecef6

Browse files
author
Christian Svenkerud
committed
Updates readme
1 parent 4fefcd1 commit 65ecef6

File tree

2 files changed

+73
-23
lines changed

2 files changed

+73
-23
lines changed

README.md

Lines changed: 73 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
1-
<h1 align="center">
2-
<br>
3-
react-semantics
4-
<br>
5-
</h1>
1+
<div align="center">
2+
<img src='./media/logo.png' width="25%" alt='logo' />
3+
</div>
64

7-
<h4 align="center">Semantic helper components for working with <a href="https://reactjs.org/" target="_blank">React</a>.</h4>
5+
<div align="center">
6+
<h1><br>react-semantics<br></h1>
7+
</div>
8+
9+
<h3 align="center">Semantic helper components for working with <a href="https://reactjs.org/" target="_blank">React</a>.</h4>
810

911
<p align="center">
1012
<a href="https://badge.fury.io/js/react-semantics">
11-
<img src="https://badge.fury.io/js/react-semantics.svg" alt="Gitter">
13+
<img src="https://badge.fury.io/js/react-semantics.svg" alt="npm package">
1214
</a>
1315
<a href="">
14-
<img src="https://travis-ci.com/csvenke/react-semantics.svg?branch=master" alt="Gitter">
16+
<img src="https://travis-ci.com/csvenke/react-semantics.svg?branch=master" alt="build status">
1517
</a>
1618
<a href="">
17-
<img src="https://david-dm.org/csvenke/react-semantics.svg" alt="Gitter">
19+
<img src="https://david-dm.org/csvenke/react-semantics.svg" alt="dependencies status">
1820
</a>
1921
</p>
2022

@@ -35,11 +37,16 @@ Multiple studies from reputable anonymous sources have shown that projects using
3537
Does this sound too good to be true?
3638
Does the rational part of your brain see through this shallow pitch for yet another mediocre react library?
3739

38-
Reject those thoughts and allow me to demonstrate the might of this library with a simple example below!
40+
Reject those thoughts and allow me to demonstrate the overwhelming might of this library with a simple example below!
3941

4042
### Before
4143

42-
```javascript
44+
Here you see two common use cases where you have to show something when a condition is true and map content from an array of data.
45+
This is normally solved by inline arrow functions that are hard to read and easily becomes unmanageable in more complex components.
46+
47+
```jsx
48+
import React from 'react';
49+
4350
const Menu = ({ showMenuItems }) => (
4451
<nav>
4552
<a href="/">Home</a>
@@ -58,7 +65,13 @@ const Menu = ({ showMenuItems }) => (
5865

5966
### After
6067

61-
```javascript
68+
Here you see all inline arrow functions replaced by semantic components that are easy to read and understand.
69+
What they do are intuitively obvious due to careful naming and all the noise from inline arrow functions are removed.
70+
71+
It's components all the way down.
72+
73+
```jsx
74+
import React from 'react';
6275
import { Map, Show } from 'react-semantics';
6376

6477
const Menu = ({ showMenuItems }) => (
@@ -88,15 +101,49 @@ $ npm install react-semantics
88101

89102
## Example usage
90103

91-
```javascript
92-
import React from 'react';
104+
### Show
105+
106+
```jsx
93107
import { Show } from 'react-semantics';
94108

95109
<Show when={5 > 4}>
96110
<div>Render me!</div>
97111
</Show>
98112
```
99113

114+
### Map
115+
116+
```jsx
117+
import { Map } from 'react-semantics';
118+
119+
<Map
120+
array={[1, 2, 3, 4, 5]}
121+
render={n => (
122+
<div key={n}>{`Render ${n}!`}</div>
123+
)}
124+
/>
125+
```
126+
127+
### Switch
128+
129+
```jsx
130+
import { Switch } from 'react-semantics';
131+
132+
<Switch value={3}>
133+
<Switch.Case value={1}>
134+
<div>Render me!</div>
135+
</Switch.Case>
136+
137+
<Switch.Case value={2}>
138+
<div>No, render me!</div>
139+
</Switch.Case>
140+
141+
<Switch.Default>
142+
<div>Nobody renders better than me!</div>
143+
</Switch.Default>
144+
</Switch>
145+
```
146+
100147
## API
101148

102149
Coming soon...
@@ -107,21 +154,24 @@ Coming soon...
107154
# Install dependencies
108155
$ npm install
109156

157+
# Run linters
158+
$ npm run lint
159+
110160
# Run tests
111-
npm run test
161+
$ npm run test
112162

113-
# Build
114-
npm run build
163+
# Build project
164+
$ npm run build
115165
```
116166

117167
## Contributing
118168

119-
1. Fork it
120-
1. Create your feature branch
121-
1. Commit your changes
122-
1. Push to the branch
123-
1. Create a new pull request
169+
1. Fork repository
170+
1. Create feature branch
171+
1. Commit changes
172+
1. Push to branch
173+
1. Create new pull request
124174

125175
## License
126176

127-
This project is licensed under the MIT License - see the [LICENSE](https://github.com/csvenke/react-semantics/blob/master/LICENSE) file for details.
177+
This project is licensed under the MIT License - see [LICENSE](https://github.com/csvenke/react-semantics/blob/master/LICENSE) file for details.

media/logo.png

159 KB
Loading

0 commit comments

Comments
 (0)