import '../buttons/tool-icon-button.js';
import { WithDisposable } from '@blockeditor/lit';
import { css, html, LitElement } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import { classMap } from 'lit/directives/class-map.js';
import type { EmbedCardStyle } from '../../../../_common/types.js';
import { getEmbedCardIcons } from '../../../../_common/utils/url.js';
@customElement('embed-card-style-panel')
export class EmbedCardStylePanel extends WithDisposable(LitElement) {
static override styles = css`
:host {
border-radius: 8px;
padding: 8px;
gap: 8px;
display: flex;
justify-content: space-between;
align-items: center;
background: var(--affine-background-overlay-panel-color);
box-shadow: var(--affine-shadow-2);
}
icon-button {
padding: var(--1, 0px);
}
icon-button.selected {
border: 1px solid var(--affine-brand-color);
}
`;
@property({ attribute: false })
value!: string;
@property({ attribute: false })
onSelect!: (value: EmbedCardStyle) => void;
override render() {
const {
EmbedCardHorizontalIcon,
EmbedCardListIcon,
EmbedCardVerticalIcon,
EmbedCardCubeIcon,
} = getEmbedCardIcons();
return html`
this.onSelect('horizontal')}
>
${EmbedCardHorizontalIcon}
${'Large horizontal style'}
this.onSelect('list')}
>
${EmbedCardListIcon}
${'Small horizontal style'}
this.onSelect('vertical')}
>
${EmbedCardVerticalIcon}
${'Large vertical style'}
this.onSelect('cube')}
>
${EmbedCardCubeIcon}
${'Small vertical style'}
`;
}
}
declare global {
interface HTMLElementTagNameMap {
'embed-card-style-panel': EmbedCardStylePanel;
}
}