1 import {onSelect} from '../services/dom.ts';
2 import {Component} from './component';
4 export class OptionalInput extends Component {
7 this.removeButton = this.$refs.remove;
8 this.showButton = this.$refs.show;
9 this.input = this.$refs.input;
10 this.setupListeners();
14 onSelect(this.removeButton, () => {
15 this.input.value = '';
16 this.input.classList.add('hidden');
17 this.removeButton.classList.add('hidden');
18 this.showButton.classList.remove('hidden');
21 onSelect(this.showButton, () => {
22 this.input.classList.remove('hidden');
23 this.removeButton.classList.remove('hidden');
24 this.showButton.classList.add('hidden');