Skip to content

Issue 375 #407

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ exports[`Matches shallow shapshot 1`] = `
/>
</div>
<div
className="src-shared-components-challenge-listing-Filters-FiltersPanel-___style__filter___1-QUz src-shared-components-challenge-listing-Filters-FiltersPanel-___style__dates___3kH3c"
className="src-shared-components-challenge-listing-Filters-FiltersPanel-___style__filter___1-QUz src-shared-components-challenge-listing-Filters-FiltersPanel-___style__dates___3kH3c src-shared-components-challenge-listing-Filters-FiltersPanel-___style__hidetwomonthdatepicker___OurWT"
>
<label
htmlFor="date-range-picker"
Expand All @@ -123,6 +123,23 @@ exports[`Matches shallow shapshot 1`] = `
<DateRangePicker
endDate={undefined}
id="date-range-picker"
numberOfMonths="1"
onDatesChange={[Function]}
startDate={undefined}
/>
</div>
<div
className="src-shared-components-challenge-listing-Filters-FiltersPanel-___style__filter___1-QUz src-shared-components-challenge-listing-Filters-FiltersPanel-___style__dates___3kH3c src-shared-components-challenge-listing-Filters-FiltersPanel-___style__hideonemonthdatepicker___2zdTb"
>
<label
htmlFor="date-range-picker"
>
Date range
</label>
<DateRangePicker
endDate={undefined}
id="date-range-picker"
numberOfMonths="2"
onDatesChange={[Function]}
startDate={undefined}
/>
Expand Down Expand Up @@ -239,7 +256,23 @@ exports[`Matches shallow shapshot 2`] = `
/>
</div>
<div
className="src-shared-components-challenge-listing-Filters-FiltersPanel-___style__filter___1-QUz src-shared-components-challenge-listing-Filters-FiltersPanel-___style__dates___3kH3c"
className="src-shared-components-challenge-listing-Filters-FiltersPanel-___style__filter___1-QUz src-shared-components-challenge-listing-Filters-FiltersPanel-___style__dates___3kH3c src-shared-components-challenge-listing-Filters-FiltersPanel-___style__hidetwomonthdatepicker___OurWT"
>
<label
htmlFor="date-range-picker"
>
Date range
</label>
<DateRangePicker
endDate={undefined}
id="date-range-picker"
numberOfMonths="1"
onDatesChange={[Function]}
startDate={undefined}
/>
</div>
<div
className="src-shared-components-challenge-listing-Filters-FiltersPanel-___style__filter___1-QUz src-shared-components-challenge-listing-Filters-FiltersPanel-___style__dates___3kH3c src-shared-components-challenge-listing-Filters-FiltersPanel-___style__hideonemonthdatepicker___2zdTb"
>
<label
htmlFor="date-range-picker"
Expand All @@ -249,6 +282,7 @@ exports[`Matches shallow shapshot 2`] = `
<DateRangePicker
endDate={undefined}
id="date-range-picker"
numberOfMonths="2"
onDatesChange={[Function]}
startDate={undefined}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class DateRangePicker extends React.Component {
render() {
return (
<WrappedDateRangePicker
numberOfMonths={this.props.numberOfMonths}
focusedInput={this.state.focusedInput}
isOutsideRange={() => false}
onDatesChange={this.props.onDatesChange}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,28 @@ export default function FiltersPanel({
}
/>
</div>
<div styleName="filter dates">
<div styleName="filter dates hidetwomonthdatepicker">
<label htmlFor="date-range-picker">Date range</label>
<DateRangePicker
numberOfMonths="1"
endDate={filterState.endDate && moment(filterState.endDate)}
id="date-range-picker"
onDatesChange={(dates) => {
let d = dates.endDate ? dates.endDate.toISOString() : null;
let state = Filter.setEndDate(filterState, d);
d = dates.startDate ? dates.startDate.toISOString() : null;
state = Filter.setStartDate(state, d);
setFilterState(state);
}}
startDate={
filterState.startDate && moment(filterState.startDate)
}
/>
</div>
<div styleName="filter dates hideonemonthdatepicker">
<label htmlFor="date-range-picker">Date range</label>
<DateRangePicker
numberOfMonths="2"
endDate={filterState.endDate && moment(filterState.endDate)}
id="date-range-picker"
onDatesChange={(dates) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ $panel-radius-4: $corner-radius * 2;
right: 0;
background: $tc-white;
padding: 15px;
overflow-y: scroll;
}

&.hidden {
Expand Down Expand Up @@ -85,6 +86,7 @@ $panel-radius-4: $corner-radius * 2;
width: 100%;
padding-left: 0;
border-left: none;
margin-bottom: $panel-space-100;
}

button {
Expand Down Expand Up @@ -197,6 +199,18 @@ $panel-radius-4: $corner-radius * 2;
@include xxs-to-sm {
margin-top: 20px;
}

&.hidetwomonthdatepicker {
@media screen and (min-width: $screen-md) {
display: none;
}
}

&.hideonemonthdatepicker {
@media screen and (max-width: $screen-md - 1px) {
display: none;
}
}
}
}
}
Expand Down