Skip to content

Commit 37ef94a

Browse files
committed
feat(components/dialog/helper): add content to open method
1 parent 491b5d5 commit 37ef94a

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

demo/dialog/scripts.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ render(
7373
class="flex items-center justify-around gap-4 text-bodyMedium text-onSurface text-pretty capitalize mb-6"
7474
>
7575
${gecutButton({
76-
onClick: () => helper.open(),
76+
onClick: () =>
77+
helper.open({
78+
headline: 'headline' in helper.content ? helper.content.headline + '*' : '',
79+
}),
7780
type: 'filled',
7881
label: 'headline' in helper.content ? helper.content.headline : 'Open',
7982
})}

packages/components/src/dialog/helper.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export class DialogHelper {
1212
this.content = content;
1313

1414
this.html = html`${gecutContext<'open' | 'close'>()(this.controller, (status) => {
15-
const dialogContent: DialogContent = {...content, controller: this.controller, provider: this.provider};
15+
const dialogContent: DialogContent = {...this.content, controller: this.controller, provider: this.provider};
1616
1717
return gecutDialog(dialogContent, status === 'open');
1818
})}`;
@@ -25,7 +25,9 @@ export class DialogHelper {
2525
html: RenderResult;
2626
content: DialogHelperContent;
2727

28-
open() {
28+
open(content: Partial<DialogHelperContent> = {}) {
29+
this.content = {...this.content, ...content} as DialogHelperContent;
30+
2931
this.controller.setValue('open');
3032
}
3133

0 commit comments

Comments
 (0)