Skip to content

Commit 9e27329

Browse files
author
Fatih Erikli
committed
Merge pull request hypeserver#3 from Adphorus/feature/cssClasses
Added css class names for extended styling support
2 parents 8b3fdcd + fb5fee8 commit 9e27329

File tree

4 files changed

+30
-9
lines changed

4 files changed

+30
-9
lines changed

src/Calendar.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,21 @@ class Calendar extends Component {
8484
const { styles } = this;
8585

8686
return (
87-
<div style={styles['MonthAndYear']}>
87+
<div style={styles['MonthAndYear']} className='rdr-MonthAndYear-innerWrapper'>
8888
<button
8989
style={{ ...styles['MonthButton'], float : 'left' }}
90+
className='rdr-MonthAndYear-button prev'
9091
onClick={this.changeMonth.bind(this, -1, false)}>
9192
<i style={{ ...styles['MonthArrow'], ...styles['MonthArrowPrev'] }}></i>
9293
</button>
93-
<span>{month} - {year}</span>
94+
<span>
95+
<span className='rdr-MonthAndYear-month'>{month}</span>
96+
<span className='rdr-MonthAndYear-divider'> - </span>
97+
<span className='rdr-MonthAndYear-year'>{year}</span>
98+
</span>
9499
<button
95100
style={{ ...styles['MonthButton'], float : 'right' }}
101+
className='rdr-MonthAndYear-button next'
96102
onClick={this.changeMonth.bind(this, +1, false)}>
97103
<i style={{ ...styles['MonthArrow'], ...styles['MonthArrowNext'] }}></i>
98104
</button>
@@ -109,7 +115,7 @@ class Calendar extends Component {
109115
const day = moment.weekdaysMin(i);
110116

111117
weekdays.push(
112-
<span style={styles['Weekday']} key={day}>{day}</span>
118+
<span style={styles['Weekday']} className='rdr-WeekDay' key={day}>{day}</span>
113119
);
114120
}
115121

@@ -181,10 +187,10 @@ class Calendar extends Component {
181187
const { styles } = this;
182188

183189
return (
184-
<div style={{ ...styles['Calendar'], ...this.props.style }}>
185-
<div>{ this.renderMonthAndYear() }</div>
186-
<div>{ this.renderWeekdays() }</div>
187-
<div>{ this.renderDays() }</div>
190+
<div style={{ ...styles['Calendar'], ...this.props.style }} className='rdr-Calendar'>
191+
<div className='rdr-MonthAndYear'>{ this.renderMonthAndYear() }</div>
192+
<div className='rdr-WeekDays'>{ this.renderWeekdays() }</div>
193+
<div className='rdr-Days'>{ this.renderDays() }</div>
188194
</div>
189195
)
190196
}

src/DateRange.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class DateRange extends Component {
9595
const { styles } = this;
9696

9797
return (
98-
<div style={{ ...styles['DateRange'], ...style }}>
98+
<div style={{ ...styles['DateRange'], ...style }} className='rdr-DateRange'>
9999
{ ranges && (
100100
<PredefinedRanges
101101
format={ format }

src/DayCell.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,23 @@ class DayCell extends Component {
6767
};
6868
}
6969

70+
getClassNames() {
71+
const { isSelected, isInRange, isPassive } = this.props;
72+
73+
let classNames = 'rdr-Day ';
74+
75+
classNames = (isSelected) ? classNames + 'is-selected ' : classNames;
76+
classNames = (isInRange) ? classNames + 'is-inRange ' : classNames;
77+
classNames = (isPassive) ? classNames + 'is-passive ' : classNames;
78+
79+
return classNames;
80+
}
81+
7082
render() {
7183
const { styles } = this;
7284
const { dayMoment } = this.props;
7385
const stateStyle = this.getStateStyles();
86+
const classNames = this.getClassNames();
7487

7588
return (
7689
<span
@@ -79,6 +92,7 @@ class DayCell extends Component {
7992
onMouseDown={ this.handleMouseEvent.bind(this) }
8093
onMouseUp={ this.handleMouseEvent.bind(this) }
8194
onClick={ this.handleSelect.bind(this) }
95+
className={ classNames }
8296
style={{...styles['Day'], ...stateStyle}}>
8397
{ dayMoment.date() }
8498
</span>

src/PredefinedRanges.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class PredefinedRanges extends Component {
3131
<a
3232
href='#'
3333
key={'range-' + name}
34+
className='rdr-PredefinedRangeItem'
3435
style={styles['PredefinedRangeItem']}
3536
onClick={this.handleSelect.bind(this, name)}>
3637
{name}
@@ -44,7 +45,7 @@ class PredefinedRanges extends Component {
4445
const { styles } = this;
4546

4647
return (
47-
<div style={{ ...styles['PredefinedRanges'], ...style }}>
48+
<div style={{ ...styles['PredefinedRanges'], ...style }} className='rdr-PredefinedRanges'>
4849
{this.renderRangeList()}
4950
</div>
5051
);

0 commit comments

Comments
 (0)