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 4a9bce2
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 19 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const Template: Story = ({
heading="${heading}"
backdrop-dismiss="${backdropDismiss}"
esc-dismiss="${escDismiss}">
<b2b-icon slot="header-icon" icon="b2b_icon-info"></b2b-icon>
<b2b-icon-100 slot="header-icon" icon="b2b_icon-info"></b2b-icon-100>
<div>${content}</div>
<b2b-paragraph slot="footer-left">* Left Slot</b2b-paragraph>
<b2b-button @click=${closeModal} slot="footer-right">Close</b2b-button>
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-100 slot="header-icon" icon="b2b_icon-info"></b2b-icon-100>
<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 4a9bce2

Please sign in to comment.