IMPR: Vanilla JS Datepicker

This commit is contained in:
Tony Air 2021-09-13 00:25:23 +02:00
parent caecfd72d9
commit 5900b5e25b
2 changed files with 45 additions and 0 deletions

13
src/js/ui/datepicker.js Normal file
View File

@ -0,0 +1,13 @@
import Events from '../_events';
import Datepicker from 'vanillajs-datepicker/Datepicker';
const init = () => {
document.querySelectorAll('.js-calendar').forEach((el, i) => {
const picker = new Datepicker(el);
});
};
window.addEventListener(`${Events.LODEDANDREADY}`, init);
window.addEventListener(`${Events.AJAX}`, init);
export default Datepicker;

View File

@ -0,0 +1,32 @@
@import "node_modules/vanillajs-datepicker/sass/mixins";
@mixin dp-button {
.button {
@extend .btn;
@extend .btn-secondary;
.datepicker-header & {
@include dp-header-button-common;
// Place style adjustment specific to the header buttons here, if needed
}
.datepicker-footer & {
@include dp-footer-button-common;
// Place style adjustment specific to the footer buttons here, if needed
}
}
}
$dp-background-color: $body-bg !default;
$dp-border-radius: .5rem !default;
$dp-cell-selected-color: $white !default;
$dp-cell-focus-background-color: invert($body-bg) !default;
$dp-cell-focus-color: invert($body-color) !default;
.datepicker-cell.focused:not(.selected) {
color: $dp-cell-focus-color;
}
@import "node_modules/vanillajs-datepicker/sass/datepicker";