Files
2026-11-07 18:31:45 +04:00

39 lines
1.2 KiB
Plaintext

import Component from '@glimmer/component';
import { action } from '@ember/object';
import { on } from '@ember/modifier';
import { service } from '@ember/service';
import Greeting from './greeting.gjs';
import ClockForm from './settings/clock-form.gjs';
import { timeParts } from '../utils/time-format';
export default class DefaultClockComponent extends Component {
@service clock;
@service modal;
get parts() {
return timeParts(this.clock.time, this.clock.timeFormat);
}
@action
openSettings() {
this.modal.open({ component: ClockForm, size: 'sm' });
}
<template>
<div class="text-center text-white text-shadow-lg">
<button
type="button"
{{on "click" this.openSettings}}
aria-label="Edit clock settings"
class="cursor-pointer rounded-lg text-shadow-lg focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white/70"
>
<span class="text-[6rem] font-semibold">{{this.parts.time}}</span>
{{#if this.parts.period}}
<span class="ml-2 text-2xl font-semibold">{{this.parts.period}}</span>
{{/if}}
</button>
<Greeting />
</div>
</template>
}