Skip to content

Commit

Permalink
feat: dont show card header border (#106)
Browse files Browse the repository at this point in the history
* feat: dont shot card header border

* fix: removed inverse property

* fix: updated coverage

* feat: removed header border
  • Loading branch information
Arne Vandoorslaer authored Nov 26, 2021
1 parent 361bdf6 commit 9d4b23b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class CardComponent extends LitElement {
${!this.hideHeader
? html`
<card-header inverse>
<card-header class="inverse">
<slot name="icon" slot="icon"></slot>
<slot name="title" slot="title"></slot>
<slot name="subtitle" slot="subtitle"></slot>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,4 @@ describe('ContentHeaderComponent', () => {

});

it.each([ true, false ])('should show set inverse class', async (inverse) => {

component.inverse = inverse;

window.document.body.appendChild(component);
await component.updateComplete;

if(inverse) {

expect(window.document.body.getElementsByTagName('card-header')[0].shadowRoot.querySelector('.header.inverse')).toBeFalsy();

} else {

expect(window.document.body.getElementsByTagName('card-header')[0].shadowRoot.querySelector('.header.inverse')).toBeTruthy();

}

});

});
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ import { Theme } from '@digita-ai/dgt-theme';
*/
export class ContentHeaderComponent extends LitElement {

/**
* Decides the color variant of this component (dark/light)
*/
@property({ type: Boolean })
public inverse = false;

/**
* Renders the component as HTML.
*
Expand All @@ -20,8 +14,6 @@ export class ContentHeaderComponent extends LitElement {
render() {

return html`
<div class="header ${this.inverse ? '' : 'inverse'}">
<div class="icon">
<slot name="icon"></slot>
</div>
Expand All @@ -34,8 +26,6 @@ export class ContentHeaderComponent extends LitElement {
<div class="actions">
<slot name="actions"></slot>
</div>
</div>
`;

}
Expand All @@ -49,63 +39,59 @@ export class ContentHeaderComponent extends LitElement {
unsafeCSS(Theme),
css`
:host {
display: block;
height: 99px;
min-height: 99px;
}
.header.inverse {
background-color: var(--colors-primary-dark);
color: var(--colors-foreground-inverse);
fill: var(--colors-foreground-inverse);
}
.header {
height: 100%;
padding: 0px var(--gap-large);
background-color: var( --colors-background-light);
color: var(--colors-foreground-normal);
fill: var(--colors-foreground-normal);
border-bottom: 1px solid var(--colors-primary-normal);
display: flex;
flex-direction: row;
align-items: center;
}
.header .icon {
:host.inverse {
background-color: var(--colors-primary-dark);
color: var(--colors-foreground-inverse);
fill: var(--colors-foreground-inverse);
}
.icon {
font-size: 25px;
}
.header.inverse .icon ::slotted(svg) {
inverse .icon ::slotted(svg) {
fill: var(--colors-foreground-inverse);
}
.header .icon ::slotted(*) {
.icon ::slotted(*) {
height: 25px;
width: 25px;
}
.header .content {
.content {
flex: 1 0;
margin: 0 var(--gap-normal);
}
.header .content slot[name="title"]::slotted(*) {
.content slot[name="title"]::slotted(*) {
overflow: hidden;
font-weight: var(--font-weight-bold);
font-size: var(--font-size-normal);
height: var(--gap-normal);
line-height: var(--gap-normal);
}
.header .content slot[name="subtitle"]::slotted(*) {
.content slot[name="subtitle"]::slotted(*) {
overflow: hidden;
margin-top: var(--gap-tiny);
font-size: var(--font-size-small);
height: var(--gap-normal);
line-height: var(--gap-normal);
}
.header .actions {
.actions {
margin-right: var(--gap-normal);
display: flex;
flex-direction: row;
}
.header .actions:last-child {
.actions:last-child {
margin-right: 0px;
}
.header .actions ::slotted(*) {
.actions ::slotted(*) {
max-height: var(--gap-normal);
max-width: var(--gap-normal);
height: var(--gap-normal);
Expand All @@ -115,7 +101,7 @@ export class ContentHeaderComponent extends LitElement {
cursor: pointer;
margin-left: var(--gap-normal);
}
.header.inverse .actions ::slotted(*) {
:host.inverse .actions ::slotted(*) {
fill: var(--colors-foreground-inverse);
color: var(--colors-foreground-inverse);
}
Expand Down
8 changes: 4 additions & 4 deletions packages/dgt-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@
],
"coverageThreshold": {
"global": {
"branches": 32.14,
"functions": 33.93,
"lines": 37.64,
"statements": 37.78
"branches": 31.44,
"functions": 33.63,
"lines": 37.55,
"statements": 37.62
}
},
"coveragePathIgnorePatterns": [
Expand Down

0 comments on commit 9d4b23b

Please sign in to comment.