Skip to content

Commit

Permalink
feat(Modal): [BLA-803] Add slot for icons in modal header
Browse files Browse the repository at this point in the history
  • Loading branch information
geethag-tw committed Jul 11, 2024
1 parent 5709fa4 commit ac21728
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 18 deletions.
14 changes: 12 additions & 2 deletions packages/core-components/src/components/modal/modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,18 @@
align-items: center;
margin-bottom: var(--b2b-size-space-75);

b2b-icon {
padding-left: 8px;
&-left {
display: flex;
justify-content: flex-start;

b2b-headline {
padding-right: 8px;
}
}

&-right {
display: flex;
justify-content: flex-end;
}
}

Expand Down
36 changes: 20 additions & 16 deletions packages/core-components/src/components/modal/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,22 +161,26 @@ export class ModalComponent {
[`b2b-modal__dialog--${this.variant}`]: true,
}}>
<div class="b2b-modal__dialog__header">
<b2b-headline align="center" size="200" noMargin={true}>
{this.heading}
</b2b-headline>
<slot name="header-icon"></slot>
<button
type="button"
class="b2b-modal__dialog__close"
onMouseEnter={this.toggleIconHover}
onMouseLeave={this.toggleIconHover}
onClick={this.handleClickDismiss}
ref={el => (this.closeButton = el)}>
<b2b-icon
clickable
icon="b2b_icon-close"
color={this.iconHover ? 'primary' : 'secondary'}></b2b-icon>
</button>
<div class="b2b-modal__dialog__header-left">
<b2b-headline align="center" size="200" noMargin={true}>
{this.heading}
</b2b-headline>
<slot name="header-icon"></slot>
</div>
<div class="b2b-modal__dialog__header-right">
<button
type="button"
class="b2b-modal__dialog__close"
onMouseEnter={this.toggleIconHover}
onMouseLeave={this.toggleIconHover}
onClick={this.handleClickDismiss}
ref={el => (this.closeButton = el)}>
<b2b-icon
clickable
icon="b2b_icon-close"
color={this.iconHover ? 'primary' : 'secondary'}></b2b-icon>
</button>
</div>
</div>
<div class="b2b-modal__dialog__body">
<slot></slot>
Expand Down
1 change: 1 addition & 0 deletions packages/core-components/src/html/status.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
backdrop-dismiss
esc-dismiss="false">
<div>This is a test modal</div>
<b2b-icon slot="header-icon" icon="b2b_icon-info"></b2b-icon>
<b2b-paragraph slot="footer-left">* Mandatory</b2b-paragraph>
<b2b-button id="modal-close-button" slot="footer-right"
>Close</b2b-button
Expand Down

0 comments on commit ac21728

Please sign in to comment.