Skip to content

Commit 5ec01b5

Browse files
committed
feat: add styled-components support
1 parent f776d8f commit 5ec01b5

File tree

6 files changed

+620
-329
lines changed

6 files changed

+620
-329
lines changed

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,27 @@ onEditingStart|function|No||Function that will be called when the editing mode i
7878
showButtonsOnHover|bool|No|`false`|Set it to `true` if you want to display action buttons **only** when the text hovered by the user. See [here](https://alioguzhan.github.io/react-editext/#show-on-hover)
7979
submitOnEnter|bool|No|`false`|Set it to `true` if you want to submit the form when `Enter` is pressed. __Be careful if you have multiple instances of `<EdiText/>` on the same page.__
8080

81+
## Styling with `styled-components`
82+
83+
84+
You can style your `<EdiText/>` components with `styled-components` or similar libraries. You can either target internal HTML elements by their `type` ( or `order`) , or you can you can select them by attribute values.
85+
86+
Each customizable HTML element has a `editext=xxx` attribute. Use below as a reference table:
87+
88+
|Attr. Name|Description|
89+
|----------|-----------|
90+
|`view-container`| the container in `view` mode|
91+
|`edit-container`| the container in `edit` mode|
92+
|`button-container`| the container for the `save` and `cancel` buttons|
93+
|`edit-button`| use this to style the __edit button__|
94+
|`save-button`| use this to style the __save button__|
95+
|`cancel-button`| use this to style the __cancel button__|
96+
|`input`| There is only one input. You can select it directly or just use this attr value. |
97+
|`hint`| To style the hint container. |
98+
99+
> See [the example code](https://alioguzhan.github.io/react-editext/#styled-components).
100+
101+
81102
## Browser Support
82103

83104
|[<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Safari | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari-ios/safari-ios_48x48.png" alt="iOS Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>iOS Safari | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/opera/opera_48x48.png" alt="Opera" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Opera | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>IE / Edge |

example/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"react-dom": "^16.10.1",
1111
"react-editext": "link:..",
1212
"react-scripts": "^3.1.2",
13-
"react-syntax-highlighter": "^11.0.2"
13+
"react-syntax-highlighter": "^11.0.2",
14+
"styled-components": "^4.4.1"
1415
},
1516
"scripts": {
1617
"start": "react-scripts start",

0 commit comments

Comments
 (0)