Skip to content
This repository was archived by the owner on May 31, 2020. It is now read-only.

Commit 555952e

Browse files
freedomlangjuliankrispel
authored andcommitted
docs: update example for counter
1 parent 3c12ff5 commit 555952e

File tree

2 files changed

+6
-22
lines changed

2 files changed

+6
-22
lines changed

examples/counter/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"private": true,
66
"license": "MIT",
77
"dependencies": {
8-
"@djsp/counter": "latest",
8+
"@djsp/utils": "latest",
99
"@djsp/editor": "latest",
1010
"react": "^16.2.0",
1111
"react-dom": "^16.2.0",

examples/counter/src/index.js

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,13 @@ import ReactDOM from 'react-dom'
33

44
import { EditorState, ContentState } from 'draft-js'
55
import { EditorContainer, Editor } from '@djsp/editor'
6-
import Counter, {
7-
getCharCount,
8-
getWordCount,
9-
getLineCount,
10-
} from '@djsp/counter'
6+
import { getCharCount, getWordCount, getLineCount } from '@djsp/utils'
117
import './styles.css'
128

139
class App extends Component {
1410
state = {
1511
editorState: EditorState.createWithContent(
16-
ContentState.createFromText('Have a nice day!')
12+
ContentState.createFromText('Just type!')
1713
),
1814
}
1915

@@ -25,21 +21,9 @@ class App extends Component {
2521
<EditorContainer
2622
editorState={this.state.editorState}
2723
onChange={this.onChange}>
28-
<Counter>
29-
{editorState => (
30-
<span>Char count: {getCharCount(editorState)}</span>
31-
)}
32-
</Counter>
33-
<Counter>
34-
{editorState => (
35-
<span>Word count: {getWordCount(editorState)}</span>
36-
)}
37-
</Counter>
38-
<Counter>
39-
{editorState => (
40-
<span>Line count: {getLineCount(editorState)}</span>
41-
)}
42-
</Counter>
24+
<div>Char count: {getCharCount(this.state.editorState)}</div>
25+
<div>Word count: {getWordCount(this.state.editorState)}</div>
26+
<div>Line count: {getLineCount(this.state.editorState)}</div>
4327
<Editor />
4428
</EditorContainer>
4529
</div>

0 commit comments

Comments
 (0)