Skip to content
This repository was archived by the owner on Sep 1, 2023. It is now read-only.

Commit e5883cc

Browse files
authored
docs: no inline component definitions (#255)
1 parent 48aae29 commit e5883cc

File tree

1 file changed

+45
-42
lines changed

1 file changed

+45
-42
lines changed

README.md

+45-42
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ You can have a real life look how this can be used within storybook [(source)](.
1414
[![npm downloads](https://img.shields.io/npm/dm/@farbenmeer/react-spring-slider.svg?style=flat-square)](https://www.npmjs.com/package/@farbenmeer/react-spring-slider?style=flat-square)
1515
</div>
1616

17-
1. [Installation](#installation)
18-
2. [Usage](#usage)
19-
3. [Configuration](#configuration)
20-
4. [More Examples](#more-examples)
21-
5. [Contribution](#contribution)
17+
- [Installation](#installation)
18+
- [Usage](#usage)
19+
- [Configuration](#configuration)
20+
- [More examples](#more-examples)
21+
- [Custom bulletStyle](#custom-bulletstyle)
22+
- [Fully customized](#fully-customized)
23+
- [Contribution](#contribution)
2224

2325

2426
## Installation
@@ -94,43 +96,6 @@ const App = () => {
9496
const onSlideChange = (index) => console.log(`changed to slide ${index}`);
9597
const setSlideCustom = () => 1;
9698

97-
const BulletComponent = ({ onClick, isActive }) => (
98-
<li
99-
style={{
100-
width: "25px",
101-
height: "25px",
102-
backgroundColor: "red",
103-
margin: "0 2px",
104-
opacity: isActive && "0.5",
105-
}}
106-
onClick={onClick}
107-
/>
108-
);
109-
110-
BulletComponent.propTypes = {
111-
onClick: PropTypes.func.isRequired,
112-
isActive: PropTypes.bool.isRequired,
113-
};
114-
115-
const ArrowComponent = ({ onClick, direction }) => {
116-
return (
117-
<div
118-
style={{
119-
border: "1px solid black",
120-
padding: "1em",
121-
backgroundColor: "white",
122-
}}
123-
onClick={onClick}
124-
>
125-
{direction}
126-
</div>
127-
);
128-
};
129-
130-
ArrowComponent.propTypes = {
131-
onClick: PropTypes.func.isRequired,
132-
direction: PropTypes.string.isRequired,
133-
};
13499

135100
return (
136101
<Slider
@@ -149,6 +114,44 @@ const App = () => {
149114
</Slider>
150115
);
151116
};
117+
118+
const BulletComponent = ({ onClick, isActive }) => (
119+
<li
120+
style={{
121+
width: "25px",
122+
height: "25px",
123+
backgroundColor: "red",
124+
margin: "0 2px",
125+
opacity: isActive && "0.5",
126+
}}
127+
onClick={onClick}
128+
/>
129+
);
130+
131+
BulletComponent.propTypes = {
132+
onClick: PropTypes.func.isRequired,
133+
isActive: PropTypes.bool.isRequired,
134+
};
135+
136+
const ArrowComponent = ({ onClick, direction }) => {
137+
return (
138+
<div
139+
style={{
140+
border: "1px solid black",
141+
padding: "1em",
142+
backgroundColor: "white",
143+
}}
144+
onClick={onClick}
145+
>
146+
{direction}
147+
</div>
148+
);
149+
};
150+
151+
ArrowComponent.propTypes = {
152+
onClick: PropTypes.func.isRequired,
153+
direction: PropTypes.string.isRequired,
154+
};
152155
```
153156

154157
For more examples have a look at [storybook](https://farbenmeer.github.io/react-spring-slider/) [(storybook source code)](./src/index.stories.tsx).

0 commit comments

Comments
 (0)