Skip to content

Commit 7d632d9

Browse files
fixes typo, and updates Example
1 parent 9e5ae89 commit 7d632d9

File tree

4 files changed

+31
-6
lines changed

4 files changed

+31
-6
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ npm install --save show-more-less
1515
```tsx
1616
import React, { useState } from 'react'
1717
import styles from './ShowMoreLess.module.scss'
18-
import ShowLessMore from 'show-more-less'
18+
import ShowMoreLess from 'show-more-less'
1919
import 'show-more-less/dist/index.css'
2020

2121
function Example() {
@@ -25,7 +25,7 @@ function Example() {
2525
const [expanded, setExpanded] = useState(false)
2626

2727
return (
28-
<ShowLessMore
28+
<ShowMoreLess
2929
text={text}
3030
threshold={800}
3131
expanded={expanded}

example/src/App.module.scss

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.root {
2+
// root level style comes here
3+
}
4+
5+
.text {
6+
// text level style comes here
7+
}
8+
9+
.clickable {
10+
// show more/less level style comes here
11+
}

example/src/App.tsx

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
1-
import React from 'react'
1+
import React, { useState } from 'react'
22

3+
import styles from './App.module.scss'
34
import ShowMoreLess from 'show-more-less'
45
import 'show-more-less/dist/index.css'
56

67
const App = () => {
8+
const [expanded, setExpanded] = useState(false)
9+
710
const text = 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Optio, nobis excepturi accusamus ipsum, doloremque voluptatem nisi odio quis voluptates facilis quam sequi quibusdam quia, in doloribus? Quisquam dolorem earum natus.';
8-
console.log(text.substring(0, 100));
9-
return <ShowMoreLess text={text} threshold={100} />
11+
12+
return <ShowMoreLess
13+
text={text}
14+
threshold={100}
15+
expanded={expanded}
16+
onExpand={setExpanded}
17+
classes={{
18+
root: styles.root,
19+
text: styles.text,
20+
clickable: styles.clickable
21+
}}
22+
/>
1023
}
1124

1225
export default App

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"show less",
1212
"read more",
1313
"read less",
14-
"long text"
14+
"long text",
15+
"long paragraph"
1516
],
1617
"main": "dist/index.js",
1718
"module": "dist/index.modern.js",

0 commit comments

Comments
 (0)