Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core/message-bar): enable shadow dom #547

Merged
merged 2 commits into from
May 24, 2023
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
2 changes: 1 addition & 1 deletion packages/core/component-doc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6134,7 +6134,7 @@
"usage": {},
"docs": "",
"docsTags": [],
"encapsulation": "scoped",
"encapsulation": "shadow",
"dependents": [],
"dependencies": [
"ix-icon",
Expand Down
81 changes: 43 additions & 38 deletions packages/core/src/components/message-bar/message-bar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,48 +9,53 @@

@import 'common-variables';
@import 'mixins/text-truncation';
@import 'mixins/shadow-dom/component';

.message-container {
display: flex;
flex-direction: row;
align-items: flex-start;
flex-wrap: nowrap;
justify-content: space-between;
min-height: 3.375rem;
margin: $small-space $small-space 0rem $small-space;
padding: calc(#{$medium-space} - var(--theme-message-bar--border-thickness))
$medium-space
calc(#{$medium-space} - var(--theme-message-bar--border-thickness))
$default-space;
border-radius: var(--theme-message-bar--border-radius);
background-color: var(--theme-messagebar--background);
}
:host {
@include ix-component;

.danger {
border: solid var(--theme-message-bar--border-thickness)
var(--theme-color-alarm);
}
.message-container {
display: flex;
flex-direction: row;
align-items: flex-start;
flex-wrap: nowrap;
justify-content: space-between;
min-height: 3.375rem;
margin: $small-space $small-space 0rem $small-space;
padding: calc(#{$medium-space} - var(--theme-message-bar--border-thickness))
$medium-space
calc(#{$medium-space} - var(--theme-message-bar--border-thickness))
$default-space;
border-radius: var(--theme-message-bar--border-radius);
background-color: var(--theme-messagebar--background);
}

.warning {
border: solid var(--theme-message-bar--border-thickness)
var(--theme-color-warning);
}
.danger {
border: solid var(--theme-message-bar--border-thickness)
var(--theme-color-alarm);
}

.info {
border: solid var(--theme-message-bar--border-thickness)
var(--theme-color-info);
}
.warning {
border: solid var(--theme-message-bar--border-thickness)
var(--theme-color-warning);
}

.message-content {
@include ellipsis;
flex-grow: 1;
align-self: center;
min-height: 1.25rem;
padding: 0 $default-space;
font-weight: bold;
white-space: normal;
}
.info {
border: solid var(--theme-message-bar--border-thickness)
var(--theme-color-info);
}

.message-content {
@include ellipsis;
flex-grow: 1;
align-self: center;
min-height: 1.25rem;
padding: 0 $default-space;
font-weight: bold;
white-space: normal;
}

ix-icon {
margin-top: $tiny-space;
ix-icon {
margin-top: $tiny-space;
}
}
2 changes: 1 addition & 1 deletion packages/core/src/components/message-bar/message-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { NotificationColor } from '../utils/notification-color';
@Component({
tag: 'ix-message-bar',
styleUrl: 'message-bar.scss',
scoped: true,
shadow: true,
})
export class MessageBar {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

exports[`ix-message-bar renders 1`] = `
<ix-message-bar type="danger">
<!---->
<div class="danger message-container" role="alert">
<ix-icon color="color-alarm" name="error"></ix-icon>
<div class="message-content"></div>
<ix-icon-button data-testid="close-btn" ghost="" icon="close" size="24"></ix-icon-button>
</div>
<mock:shadow-root>
<div class="danger message-container" role="alert">
<ix-icon color="color-alarm" name="error"></ix-icon>
<div class="message-content">
<slot></slot>
</div>
<ix-icon-button data-testid="close-btn" ghost="" icon="close" size="24"></ix-icon-button>
</div>
</mock:shadow-root>
</ix-message-bar>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ describe('ix-message-bar', () => {
});

messageBar = document.querySelector('ix-message-bar');
closeButton = document.querySelector('[data-testid="close-btn"]');
closeButton = messageBar.shadowRoot.querySelector(
'[data-testid="close-btn"]'
);
});

it('renders', async () => {
Expand Down