Skip to content

Commit 7a72c5b

Browse files
authored
Merge pull request #5 from cyntler/update-readme-custom-component
Update readme custom component
2 parents 3d663c3 + 04e411c commit 7a72c5b

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed

Diff for: README.md

+20-10
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,26 @@ render(
5151

5252
**When the countdown is over (0 seconds left) then the `children` prop will be rendered.**
5353

54-
Children will also be rendered if you give a wrong date format.
54+
> Children will also be rendered if you give a wrong date format.
55+
56+
## Custom render component
57+
58+
If you want, you can pass `customComponent` prop to the Coming component to render your own component instead of the default countdown page.
59+
60+
Passed component will receive countdown data as props:
61+
`days`, `hours`, `minutes`, `seconds`.
62+
63+
You can use the countdown data to display inside your own component.
5564

5665
## Available Props
5766

58-
| Name | Type | Description | Default value |
59-
| ------------ | ------- | ---------------------------------------------------------------------- | ----------------------- |
60-
| enabled | boolean | Prop that indicates whether the Coming component should be rendered. | true |
61-
| toDate | string | Date in the format `YYYY-MM-DD` to which the component will countdown. | Current date + 3 months |
62-
| toTime | string | Time in `HH:MM` format to which the component will countdown. | 00:00 |
63-
| daysLabel | string | Label text for days. | days |
64-
| hoursLabel | string | Label text for hours. | hours |
65-
| minutesLabel | string | Label text for minutes. | minutes |
66-
| secondsLabel | string | Label text for seconds. | seconds |
67+
| Name | Type | Description | Default value |
68+
| --------------- | --------- | ---------------------------------------------------------------------- | ----------------------- |
69+
| enabled | boolean | Prop that indicates whether the Coming component should be rendered. | true |
70+
| toDate | string | Date in the format `YYYY-MM-DD` to which the component will countdown. | Current date + 3 months |
71+
| toTime | string | Time in `HH:MM` format to which the component will countdown. | 00:00 |
72+
| daysLabel | string | Label text for days. | days |
73+
| hoursLabel | string | Label text for hours. | hours |
74+
| minutesLabel | string | Label text for minutes. | minutes |
75+
| secondsLabel | string | Label text for seconds. | seconds |
76+
| customComponent | ReactNode | Custom React node to render instead of default Coming countdown page | - |

Diff for: package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-coming",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"description": "React component rendering a simple page with a countdown timer.",
55
"keywords": [
66
"react",

0 commit comments

Comments
 (0)