`](./ui/wy-button.ts)
*
* @csspart wy-post - Root post container.
*
* @fires {PostRestoreEventType} restore - Emitted when the trashed post should be restored.
*/
@customElement("wy-post-trashed")
@localized()
export class WyPostTrashed extends LitElement {
static override styles = [postCss, hostContentsCss];
protected exportParts = new ShadowPartsController(this);
/**
* Post data.
*/
@property({ attribute: false })
post!: PostType;
/**
* Emit a `restore` event requesting restoration of the trashed post.
*
* @returns {boolean} True if the event was not canceled.
*/
private dispatchRestore() {
const event: PostRestoreEventType = new (CustomEvent as NamedEvent)("restore", { detail: { id: this.post.id } });
return this.dispatchEvent(event);
}
override render() {
return html`
${msg("Post was trashed.")}
this.dispatchRestore()} color="variant"
>${msg("Undo")}
`;
}
}