Skip to content

Commit fff0d85

Browse files
committed
readme updated
1 parent 6ee4a00 commit fff0d85

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

README.md

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ You’ll need to install React separately since it isn't included in the package
2424
React Star Rating Summary can be directly used in your project by just providing the `ratings` props like this:
2525

2626
```jsx
27-
import React, { useState } from 'react';
28-
import RatingSummary from '@keyvaluesystems/react-star-rating-summary';
27+
import React, { useState } from 'react';
28+
import RatingSummary from '@keyvaluesystems/react-star-rating-summary';
2929

30-
function App() {
30+
function App() {
3131
const ratingsVal = {
3232
5: 100,
3333
4: 200,
@@ -42,7 +42,7 @@ function App() {
4242
);
4343
};
4444

45-
export default App;
45+
export default App;
4646
```
4747
The `ratings` prop expects an object with star rating number as key (can be 1, 2, 3, 4 and 5) and count of the respective ratings as the value.
4848

@@ -87,39 +87,41 @@ Props that can be passed to the component are listed below:
8787
<td><code>true</code></td>
8888
</tr>
8989
<td><code><b>styles?:</b> object</code></td>
90-
<td>Provides you with a bunch of callback functions to override the default styles.(refer [Style Customizations](<#style-customizations>).</td>
90+
<td>Provides you with a bunch of callback functions to override the default styles.(refer
91+
<a href="#style-customizations">Style Customizations</a>)
9192
<td><code>undefined</code></td>
9293
</tr>
9394
</tbody>
9495
</table>
9596

96-
>Note: The numbers from 1 to 5 are only taken as `ratingIds`
97+
>Note: The numbers from 1 to 5 are only taken as `ratingIds`
9798
99+
<a name="style-customizations"></a>
98100
## Style Customizations
99101

100-
Basic customization like changing the chart color for each ratings can be done using the `chartColors` prop:
102+
Basic customization like changing the chart color for each ratings can be done using the `chartColors` prop:
101103

102104
```jsx
103105
<RatingSummary
104106
ratings={ratingsVal}
105107
chartColors={{
106-
5: '#000',
107-
4: 'yellow',
108-
3: 'orange',
109-
2: 'blue',
110-
1: 'green'
108+
5: '#000',
109+
4: 'yellow',
110+
3: 'orange',
111+
2: 'blue',
112+
1: 'green'
111113
}}
112114
/>
113115
```
114116
Further customizations can by done by overriding default styles using the `styles` prop,
115117
the below code shows all the overridable styles:
116118

117119
```jsx
118-
import React from 'react';
119-
import RatingSummary from '@keyvaluesystems/react-star-rating-summary';
120+
import React from 'react';
121+
import RatingSummary from '@keyvaluesystems/react-star-rating-summary';
120122

121-
function App() {
122-
const stylesOverride = {
123+
function App() {
124+
const stylesOverride = {
123125
Chart: (ratingId) => ({...styles}),
124126
Count: (ratingId) => ({...styles})
125127
};
@@ -131,9 +133,11 @@ function App() {
131133
);
132134
}
133135

134-
export default App;
136+
export default App;
135137
```
136-
- `Chart` - overrides the Chart style for each rating.
137-
- `Count` - overrides the rating count style for each rating.
138+
- `Chart` - overrides the Chart style for each rating.
139+
- `Count` - overrides the rating count style for each rating.
140+
141+
>Note: if you provides both `chartColors` prop and overrides `Chart` styles using `styles` prop, the customizations via `styles` prop are given more priority.
142+
138143

139-
>Note: if you provides both `chartColors` prop and overrides `Chart` styles using `styles` prop, the customizations via `styles` prop are given more priority.

0 commit comments

Comments
 (0)