mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 17:40:23 +03:00
Added support to disable date inputs
This commit is contained in:
parent
8f42e65ccd
commit
c67a23c988
4 changed files with 10 additions and 3 deletions
|
@ -12,6 +12,7 @@ const propTypes = {
|
||||||
isClearable: PropTypes.bool,
|
isClearable: PropTypes.bool,
|
||||||
selected: PropTypes.oneOfType([ PropTypes.string, PropTypes.object ]),
|
selected: PropTypes.oneOfType([ PropTypes.string, PropTypes.object ]),
|
||||||
ref: PropTypes.object,
|
ref: PropTypes.object,
|
||||||
|
disabled: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
const DateInput = (props) => {
|
const DateInput = (props) => {
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
.date-input-container__input {
|
.date-input-container__input {
|
||||||
padding-right: 35px !important;
|
padding-right: 35px !important;
|
||||||
|
}
|
||||||
|
.date-input-container__input:not(:disabled) {
|
||||||
background-color: #fff !important;
|
background-color: #fff !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,10 @@ const propTypes = {
|
||||||
endDate: dateType,
|
endDate: dateType,
|
||||||
onStartDateChange: PropTypes.func.isRequired,
|
onStartDateChange: PropTypes.func.isRequired,
|
||||||
onEndDateChange: PropTypes.func.isRequired,
|
onEndDateChange: PropTypes.func.isRequired,
|
||||||
|
disabled: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
const DateRangeRow = ({ startDate, endDate, onStartDateChange, onEndDateChange }) => (
|
const DateRangeRow = ({ startDate, endDate, onStartDateChange, onEndDateChange, disabled = false }) => (
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="col-md-6">
|
<div className="col-md-6">
|
||||||
<DateInput
|
<DateInput
|
||||||
|
@ -19,6 +20,7 @@ const DateRangeRow = ({ startDate, endDate, onStartDateChange, onEndDateChange }
|
||||||
placeholderText="Since"
|
placeholderText="Since"
|
||||||
isClearable
|
isClearable
|
||||||
maxDate={endDate}
|
maxDate={endDate}
|
||||||
|
disabled={disabled}
|
||||||
onChange={onStartDateChange}
|
onChange={onStartDateChange}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -29,6 +31,7 @@ const DateRangeRow = ({ startDate, endDate, onStartDateChange, onEndDateChange }
|
||||||
placeholderText="Until"
|
placeholderText="Until"
|
||||||
isClearable
|
isClearable
|
||||||
minDate={startDate}
|
minDate={startDate}
|
||||||
|
disabled={disabled}
|
||||||
onChange={onEndDateChange}
|
onChange={onEndDateChange}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -175,6 +175,7 @@ const ShortUrlVisits = ({ processStatsFromVisits, normalizeVisits }, OpenMapModa
|
||||||
<div className="row flex-md-row-reverse">
|
<div className="row flex-md-row-reverse">
|
||||||
<div className="col-lg-8 col-xl-6">
|
<div className="col-lg-8 col-xl-6">
|
||||||
<DateRangeRow
|
<DateRangeRow
|
||||||
|
disabled={loading}
|
||||||
startDate={startDate}
|
startDate={startDate}
|
||||||
endDate={endDate}
|
endDate={endDate}
|
||||||
onStartDateChange={setStartDate}
|
onStartDateChange={setStartDate}
|
||||||
|
@ -184,8 +185,8 @@ const ShortUrlVisits = ({ processStatsFromVisits, normalizeVisits }, OpenMapModa
|
||||||
<div className="col-lg-4 col-xl-6 mt-4 mt-lg-0">
|
<div className="col-lg-4 col-xl-6 mt-4 mt-lg-0">
|
||||||
{showTableControls && (
|
{showTableControls && (
|
||||||
<Button outline block={isMobileDevice} onClick={toggleTable}>
|
<Button outline block={isMobileDevice} onClick={toggleTable}>
|
||||||
{showTable ? 'Hide' : 'Show'} table{' '}
|
{showTable ? 'Hide' : 'Show'} table
|
||||||
<FontAwesomeIcon icon={chevronDown} rotation={showTable ? 180 : undefined} />
|
<FontAwesomeIcon icon={chevronDown} rotation={showTable ? 180 : undefined} className="ml-2" />
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue