import {
DeesElement,
customElement,
html,
css,
cssManager,
property,
type TemplateResult,
} from '@design.estate/dees-element';
declare global {
interface HTMLElementTagNameMap {
'sz-quick-actions-card': SzQuickActionsCard;
}
}
export interface IQuickAction {
label: string;
icon?: string;
primary?: boolean;
url?: string;
}
@customElement('sz-quick-actions-card')
export class SzQuickActionsCard extends DeesElement {
public static demo = () => html`
`;
public static demoGroups = ['Dashboard'];
@property({ type: Array })
public accessor actions: IQuickAction[] = [];
public static styles = [
cssManager.defaultStyles,
css`
:host {
display: block;
height: 100%;
}
.card {
background: ${cssManager.bdTheme('#ffffff', '#09090b')};
border: 1px solid ${cssManager.bdTheme('#e4e4e7', '#27272a')};
border-radius: 8px;
padding: 20px;
height: 100%;
box-sizing: border-box;
}
.header {
margin-bottom: 16px;
}
.title {
font-size: 16px;
font-weight: 600;
color: ${cssManager.bdTheme('#18181b', '#fafafa')};
}
.subtitle {
font-size: 13px;
color: ${cssManager.bdTheme('#71717a', '#a1a1aa')};
margin-top: 2px;
}
.actions {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
.action-button {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 10px 16px;
border-radius: 6px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: all 200ms ease;
border: none;
outline: none;
}
.action-button.primary {
background: ${cssManager.bdTheme('#2563eb', '#3b82f6')};
color: white;
}
.action-button.primary:hover {
background: ${cssManager.bdTheme('#1d4ed8', '#2563eb')};
}
.action-button.secondary {
background: ${cssManager.bdTheme('#ffffff', '#09090b')};
color: ${cssManager.bdTheme('#18181b', '#fafafa')};
border: 1px solid ${cssManager.bdTheme('#e4e4e7', '#27272a')};
}
.action-button.secondary:hover {
background: ${cssManager.bdTheme('#f4f4f5', '#18181b')};
border-color: ${cssManager.bdTheme('#d4d4d8', '#3f3f46')};
}
.action-icon {
width: 16px;
height: 16px;
}
`,
];
public render(): TemplateResult {
return html`
${this.actions.map(
(action) => html`
`
)}
`;
}
private handleActionClick(action: IQuickAction) {
this.dispatchEvent(
new CustomEvent('action-click', {
detail: action,
bubbles: true,
composed: true,
})
);
}
}