Skip to content
This repository was archived by the owner on May 19, 2025. It is now read-only.

Commit 03b57e7

Browse files
committed
Refactoring
1 parent dc2d5a4 commit 03b57e7

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

src/components/DayCell/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ class DayCell extends Component {
150150
));
151151
};
152152
render() {
153-
const { styles } = this.props;
154153
return (
155154
<button
156155
type="button"
@@ -163,12 +162,12 @@ class DayCell extends Component {
163162
onPauseCapture={this.handleMouseEvent}
164163
onKeyDown={this.handleKeyEvent}
165164
onKeyUp={this.handleKeyEvent}
166-
className={this.getClassNames(styles)}
165+
className={this.getClassNames(this.props.styles)}
167166
{...(this.props.disabled || this.props.isPassive ? { tabIndex: -1 } : {})}
168167
style={{ color: this.props.color }}>
169168
{this.renderSelectionPlaceholders()}
170169
{this.renderPreviewPlaceholder()}
171-
<span className={styles.dayNumber}>
170+
<span className={this.props.styles.dayNumber}>
172171
<span>{format(this.props.day, this.props.dayDisplayFormat)}</span>
173172
</span>
174173
</button>

src/components/DefinedRange/index.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,23 @@ class DefinedRange extends Component {
4545
}
4646

4747
render() {
48-
const { onPreviewChange, ranges, renderStaticRangeLabel, rangeColors, className } = this.props;
48+
const {
49+
headerContent,
50+
footerContent,
51+
onPreviewChange,
52+
inputRanges,
53+
staticRanges,
54+
ranges,
55+
renderStaticRangeLabel,
56+
rangeColors,
57+
className,
58+
} = this.props;
4959

5060
return (
5161
<div className={cx(styles.definedRangesWrapper, className)}>
52-
{this.props.headerContent}
62+
{headerContent}
5363
<div className={styles.staticRanges}>
54-
{this.props.staticRanges.map((staticRange, i) => {
64+
{staticRanges.map((staticRange, i) => {
5565
const { selectedRange, focusedRangeIndex } = this.getSelectedRange(ranges, staticRange);
5666
let labelContent;
5767

@@ -79,7 +89,7 @@ class DefinedRange extends Component {
7989
onPreviewChange && onPreviewChange(staticRange.range(this.props))
8090
}
8191
onMouseLeave={() => {
82-
this.props.onPreviewChange && this.props.onPreviewChange();
92+
onPreviewChange && onPreviewChange();
8393
}}>
8494
<span tabIndex={-1} className={styles.staticRangeLabel}>
8595
{labelContent}
@@ -89,7 +99,7 @@ class DefinedRange extends Component {
8999
})}
90100
</div>
91101
<div className={styles.inputRanges}>
92-
{this.props.inputRanges.map((rangeOption, i) => (
102+
{inputRanges.map((rangeOption, i) => (
93103
<InputRangeField
94104
key={i}
95105
styles={styles}
@@ -101,7 +111,7 @@ class DefinedRange extends Component {
101111
/>
102112
))}
103113
</div>
104-
{this.props.footerContent}
114+
{footerContent}
105115
</div>
106116
);
107117
}

0 commit comments

Comments
 (0)