Skip to content

Commit 820dc9b

Browse files
fix: make dot children prop optional (#276)
* make dot children prop optional * update typing for dot Co-authored-by: Zhongde Liu <[email protected]>
1 parent 7904327 commit 820dc9b

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ A Dot component is a HTML button. Dots directly correlate to slides. Clicking
296296

297297
| property | type | default | required | purpose |
298298
| -------- | ---- | ------- | -------- | ------- |
299-
| **children** | [string&#124;node] | | **Yes** | Children is a special React property. Basically, the Dot component needs to wrap other components and/or JSX |
299+
| children | [string&#124;null&#124;node] | null | No | Children is a special React property. Basically, the Dot component wraps other components and/or JSX |
300300
| className | [string&#124;null] | null | No | Optional className string that will be appended to the component's className string. |
301301
| disabled | [boolean&#124;null] | null | No | Null means Dot will automatically determine if this button is disabled. Setting this to true will force the button to be disabled. Setting this to false will prevent the button from ever being disabled. |
302302
| onClick | [function&#124;null] | null | No | Optional callback function that is called after the internal onClick function is called. It is passed the React synthetic event |

src/Dot/Dot.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import s from './Dot.scss';
66
const Dot = class Dot extends React.Component {
77
static propTypes = {
88
carouselStore: PropTypes.object.isRequired,
9-
children: CarouselPropTypes.children.isRequired,
9+
children: CarouselPropTypes.children,
1010
className: PropTypes.string,
1111
currentSlide: PropTypes.number.isRequired,
1212
disabled: PropTypes.bool,
@@ -18,6 +18,7 @@ const Dot = class Dot extends React.Component {
1818
}
1919

2020
static defaultProps = {
21+
children: null,
2122
className: null,
2223
disabled: null,
2324
onClick: null,

typings/carouselElements.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ declare const DotGroup: DotGroupInterface
110110

111111

112112
interface DotProps {
113-
readonly children: React.ReactChild
113+
readonly children?: React.ReactChild
114114
readonly className?: string
115115
readonly disabled?: boolean
116116
readonly onClick?: () => void

0 commit comments

Comments
 (0)