Skip to content

Commit 1fd3776

Browse files
committed
Rename ChunkProperty to ChunkFieldValue
1 parent 155a1f4 commit 1fd3776

File tree

3 files changed

+37
-27
lines changed

3 files changed

+37
-27
lines changed

README.md

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
Editmode allows you to turn plain text in your React app into easily inline-editable bits of content that can be managed by anyone with no technical knowledge.
44

55
## Installation
6+
67
Use npm to install Editmode:
8+
79
```
810
npm install editmode-react
911
```
@@ -12,40 +14,46 @@ npm install editmode-react
1214

1315
### Step 1:
1416

15-
Within your React app, navigate to the index file within your src directory.
16-
Import the Editmode wrapper and wrap your App within.
17+
Within your React app, navigate to the index file within your src directory.
18+
Import the Editmode wrapper and wrap your App within.
1719

18-
```
20+
```js
1921
import { Editmode } from "editmode-react";
2022

23+
// 👉 `project_id` can be found in the URL:
24+
// https://editmode.com/projects/{project_id}/chunks
25+
2126
ReactDOM.render(
2227
<React>
23-
<Editmode>
24-
<App />
25-
</Editmode>
28+
<Editmode projectId={project_id}>
29+
<App />
30+
</Editmode>
2631
</React>,
27-
document.getElementById("root")
32+
document.getElementById("root")
2833
);
2934
```
3035

31-
3236
### Step 2:
3337

3438
#### Rendering a chunk:
3539

36-
If you have already created the chunk you would like to render on the Editmode CMS, you can simply pass the identifier as a prop and begin editing.
40+
If you have already created the chunk you would like to render on the Editmode CMS, you can simply pass the identifier as a prop and begin editing.
3741
You can provide default content as a fallback should anything go wrong trying to retrieve the data from the API:
3842

39-
```
43+
```js
4044
import { Chunk } from "editmode-react";
4145

4246
function Example() {
43-
return (
44-
<div>
45-
<p> <Chunk identifier="cnk_123"/> </p>
46-
<p> <Chunk identifier="cnk_321"> I have default content </Chunk> </p>
47-
</div>
48-
);
47+
return (
48+
<div>
49+
<p>
50+
<Chunk identifier="cnk_123" />
51+
</p>
52+
<p>
53+
<Chunk identifier="cnk_321"> I have default content </Chunk>
54+
</p>
55+
</div>
56+
);
4957
}
5058
```
5159

@@ -56,23 +64,24 @@ Alternatively, if you are using one of our **text editor plugins** and would lik
5664
Chunk collections are simply a way to categorise chunks and can be used to render repeatable content.
5765
Each collection can contain many properties and each property can hold different types of information.
5866

59-
A good use case example would be creating a "Team Member" collection. It may have `Full Name`, `Title` and `Headshot` properties. Within your React app, you may want to display the name, title and headshot of all your team members (ie all chunks within the Team Member collection). You can do this by passing the chunk collection identifier as a prop to the ChunkCollection component. To render the name, title and headshot for each team member, pass the identifiers for each property as a prop to the ChunkProperty component:
67+
A good use case example would be creating a "Team Member" collection. It may have `Full Name`, `Title` and `Headshot` properties. Within your React app, you may want to display the name, title and headshot of all your team members (ie all chunks within the Team Member collection). You can do this by passing the chunk collection identifier as a prop to the ChunkCollection component. To render the name, title and headshot for each team member, pass the identifiers for each property as a prop to the ChunkFieldValue component:
6068

61-
```
62-
import { ChunkCollection, ChunkProperty } from "editmode-react";
69+
```js
70+
import { ChunkCollection, ChunkFieldValue } from "editmode-react";
6371

6472
function Example() {
6573
return (
6674
<section className="meet_the_team">
6775
<ChunkCollection identifier="lst_123" className="team_member">
68-
<h2> <ChunkProperty identifier="prop_001" className="name"/> <h2>
69-
<h5> <ChunkProperty identifier="prop_002" className="title"/> </h5>
70-
<ChunkProperty identifier="prop_003" className="headshot"/>
76+
<h2> <ChunkFieldValue identifier="prop_001" className="name"/> <h2>
77+
<h5> <ChunkFieldValue identifier="prop_002" className="title"/> </h5>
78+
<ChunkFieldValue identifier="prop_003" className="headshot"/>
7179
</ChunkCollection>
7280
</section>
7381
);
7482
}
7583
```
84+
7685
This will render editable headings containing the name and title and an image containing the headshot for every person in the "Team Member" collection.
7786

7887
### Step 3:
@@ -94,6 +103,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
94103

95104
<!-- markdownlint-enable -->
96105
<!-- prettier-ignore-end -->
106+
97107
<!-- ALL-CONTRIBUTORS-LIST:END -->
98108

99-
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
109+
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

src/ChunkProperty.jsx renamed to src/ChunkFieldValue.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from "react";
22
import { renderChunk } from "./utils/renderChunk.jsx";
33
import { CollectionContext } from "./ChunkCollection.jsx";
44

5-
export default class ChunkProperty extends React.Component {
5+
export default class ChunkFieldValue extends React.Component {
66
constructor(props) {
77
super();
88
this.identifier = props.identifier;
@@ -23,4 +23,4 @@ export default class ChunkProperty extends React.Component {
2323
</CollectionContext.Consumer>
2424
);
2525
}
26-
}
26+
}

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import Editmode from "./Editmode.jsx";
44
import Chunk from "./Chunk.jsx";
55
import ChunkCollection from "./ChunkCollection.jsx";
6-
import ChunkProperty from "./ChunkProperty.jsx";
6+
import ChunkFieldValue from "./ChunkFieldValue.jsx";
77

88
export { useChunk } from "./useChunk";
9-
export { Editmode, Chunk, ChunkProperty, ChunkCollection };
9+
export { Editmode, Chunk, ChunkFieldValue, ChunkCollection };

0 commit comments

Comments
 (0)