Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions projects/hestia-ui/src/lib/menu/menu.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
Component,
Directive,
TemplateRef,
booleanAttribute,
contentChildren,
input,
model,
Expand Down Expand Up @@ -46,7 +45,8 @@ export class HMenuItemTemplateDirective<T = string> {
[menu]="menuRef"
type="button"
class="h-dropdown-trigger"
[class.h-dropdown-trigger--icon]="iconTrigger()"
[class.h-dropdown-trigger--icon]="iconTrigger() === 'ghost'"
[class.h-dropdown-trigger--icon-outline]="iconTrigger() === 'outline'"
>
<ng-content select="[hTrigger]" />
</button>
Expand Down Expand Up @@ -130,6 +130,20 @@ export class HMenuItemTemplateDirective<T = string> {
background: var(--h-muted);
}

.h-dropdown-trigger--icon-outline {
padding: 0;
width: 36px;
height: 36px;
justify-content: center;
border: 1px solid var(--h-border);
background: var(--h-card);
color: var(--h-foreground);
border-radius: 10px;
}
.h-dropdown-trigger--icon-outline:hover {
background: var(--h-muted);
}

.h-dropdown-panel {
position: absolute;
top: calc(100% + 6px);
Expand Down Expand Up @@ -198,6 +212,9 @@ export class HMenuItemTemplateDirective<T = string> {
})
export class HDropdownComponent<T = string> {
readonly items = input<HMenuItemData<T>[]>([]);
readonly iconTrigger = input(false, { transform: booleanAttribute });
readonly iconTrigger = input<'ghost' | 'outline' | false, 'ghost' | 'outline' | boolean | string>(
false,
{ transform: (v) => (v === true || v === '' ? 'ghost' : (v || false) as 'ghost' | 'outline' | false) }
);
readonly itemSelected = output<T>();
}
24 changes: 22 additions & 2 deletions projects/hestia-ui/src/lib/menu/menu.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const WithIcons: Story = {
}),
};

export const IconTrigger: Story = {
export const IconTriggerGhost: Story = {
render: () => ({
props: {
items: [
Expand All @@ -68,7 +68,27 @@ export const IconTrigger: Story = {
},
template: `
<div style="height:200px;padding:16px;">
<h-dropdown [items]="items" [iconTrigger]="true">
<h-dropdown [items]="items" iconTrigger="ghost">
<span hTrigger>⋯</span>
</h-dropdown>
</div>
`,
moduleMetadata: { imports: [HDropdownComponent] },
}),
};

export const IconTriggerOutline: Story = {
render: () => ({
props: {
items: [
{ value: 'template1', label: 'Acabamento Básico' },
{ value: 'template2', label: 'Instruções de Etiqueta' },
{ value: 'template3', label: 'Lavagem Stone Wash' },
],
},
template: `
<div style="height:200px;padding:16px;">
<h-dropdown [items]="items" iconTrigger="outline">
<span hTrigger>⋯</span>
</h-dropdown>
</div>
Expand Down