import { Component, ChangeDetectionStrategy, input, output, OnInit, inject, DestroyRef, } from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms'; import { Tower, HslColor } from '../../models'; import { ColorPickerComponent } from '../shared/color-picker/color-picker.component'; export interface TowerSettingsResult { name: string; base_color: HslColor; } @Component({ selector: 'lt-tower-settings', standalone: true, imports: [ReactiveFormsModule, ColorPickerComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: `
`, styles: ` @import '../../../library/main'; :host { @include card(); width: 66vw; max-width: 400px; @media (max-width: $mobile-width) { width: 88vw; max-width: 88vw; padding: var(--medium-padding); } box-sizing: border-box; padding: var(--large-padding); padding-top: calc(var(--large-padding) + var(--medium-padding)); position: relative; box-shadow: $shadow; display: block; .exit { position: absolute; top: var(--medium-padding); right: var(--medium-padding); @include exit(); } form { @include inner-spacing(var(--large-padding)); } .title-input { @include title-text(); text-align: center; width: 100%; background: transparent; border: 0; } button { display: block; // Stay full-width on mobile, but switch to flex so forms.scss's // bottom-alignment keeps the underline hugging the label in the 42px // tap target (plain block centres the text and strands the underline). @media (max-width: $mobile-width) { display: flex; } } } `, }) export class TowerSettingsComponent implements OnInit { readonly tower = input