aboutsummaryrefslogtreecommitdiff
path: root/static/widgets/month-select/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/widgets/month-select/index.js')
-rw-r--r--static/widgets/month-select/index.js87
1 files changed, 0 insertions, 87 deletions
diff --git a/static/widgets/month-select/index.js b/static/widgets/month-select/index.js
deleted file mode 100644
index 7e4d583..0000000
--- a/static/widgets/month-select/index.js
+++ /dev/null
@@ -1,87 +0,0 @@
-import icons from 'icons';
-import * as sfw from 'sfw';
-const { Div } = sfw.element.native;
-
-import stylesheet from './index.css';
-
-const css = await sfw.css.sheet(stylesheet);
-
-export default class MonthSelect extends sfw.element.Container {
- #container
- #month_container
-
- constructor() {
- super({ css });
-
- this.onscroll = (e) => e.stopPropagate();
- this.onmonth = () => {};
-
- this.body.append(
- this.#container = Div.new({
- id: 'container',
- children: [
- Div.new({ id: 'title', innerText: 'Select Month' }),
- Div.new({
- id: 'close-button',
- children: [ icons.close ],
- onclick: () => this.hide(),
- }),
- this.#month_container = Div.new({
- id: 'month-container',
- }),
- ],
- }),
- );
- }
-
- show() {
- this.#container.classList.add('visible');
- }
-
- hide() {
- this.#container.classList.remove('visible');
- }
-
- set months(months) {
- months.sort((a, b) => a.is_before(b));
-
- this.#month_container.innerHTML = '';
-
- let last = null;
-
- for (const month of months) {
- if (last != null && !last.is_same_year(month)) {
- this.#month_container.append(
- Div.new({
- className: 'year-item',
- innerText: last.year,
- })
- );
- }
-
- this.#month_container.append(
- Div.new({
- className: 'month-item',
- innerText: month.name,
- onclick: () => {
- this.hide();
- this.onmonth(month);
- }
- })
- );
-
- last = month;
- }
-
- this.#month_container.append(
- Div.new({
- className: 'month-item none',
- innerText: 'No Date',
- onclick: () => {
- this.hide();
- this.onmonth(null);
- }
- })
- );
- }
-}