@talend/react-components
Version:
Set of react components.
50 lines • 1.65 kB
JavaScript
import PropTypes from 'prop-types';
import { Action } from '../../../Actions';
import MonthPicker from '../../pickers/MonthPicker';
import ViewLayout from '../ViewLayout';
import HeaderTitle from '../HeaderTitle';
import getDefaultT from '../../../translate';
import { jsx as _jsx } from "react/jsx-runtime";
function MonthYearView(props) {
const header = {
leftElement: /*#__PURE__*/_jsx(Action, {
label: "",
"aria-label": props.t('DATEPICKER_TO_DATE_VIEW', {
defaultValue: 'Switch to date-and-time view'
}),
icon: "talend-arrow-left",
onClick: props.onBackClick,
tabIndex: props.allowFocus ? 0 : -1,
className: "btn-tertiary btn-info"
}),
middleElement: /*#__PURE__*/_jsx(HeaderTitle, {
monthIndex: props.selectedMonthIndex,
year: props.selectedYear,
onSelectYear: props.onSelectYear
})
};
const bodyElement = /*#__PURE__*/_jsx(MonthPicker, {
allowFocus: props.allowFocus,
selectedMonthIndex: props.selectedMonthIndex,
selectedYear: props.selectedYear,
onSelect: props.onSelectMonth
});
return /*#__PURE__*/_jsx(ViewLayout, {
header: header,
bodyElement: bodyElement
});
}
MonthYearView.propTypes = {
allowFocus: PropTypes.bool,
selectedMonthIndex: PropTypes.number.isRequired,
selectedYear: PropTypes.number.isRequired,
onBackClick: PropTypes.func.isRequired,
onSelectMonth: PropTypes.func.isRequired,
onSelectYear: PropTypes.func.isRequired,
t: PropTypes.func.isRequired
};
MonthYearView.defaultProps = {
t: getDefaultT()
};
export default MonthYearView;
//# sourceMappingURL=MonthYearView.component.js.map