your personal website on atproto - mirror
blento.app
1import type { CardDefinition } from '../types';
2import ClockCard from './ClockCard.svelte';
3import ClockCardSettings from './ClockCardSettings.svelte';
4
5export type ClockCardData = {
6 timezone?: string;
7};
8
9export const ClockCardDefinition = {
10 type: 'clock',
11 contentComponent: ClockCard,
12 settingsComponent: ClockCardSettings,
13
14 createNew: (card) => {
15 card.w = 4;
16 card.h = 2;
17 card.mobileW = 8;
18 card.mobileH = 3;
19 card.cardData = {
20 timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
21 } as ClockCardData;
22 },
23
24 allowSetColor: true,
25 name: 'Clock',
26 minW: 4,
27 canHaveLabel: true,
28 groups: ['Utilities'],
29 keywords: ['time', 'timezone', 'watch'],
30 icon: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="size-4"><path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" /></svg>`
31} as CardDefinition & { type: 'clock' };