Skip to content

Commit

Permalink
Added inline style for kirby-modal-footer (#1982)
Browse files Browse the repository at this point in the history
* updated modal-footer component ts, scss and corresponding tests. Updated showcase component.

* corrected test

* rephrased description

* Change type inline/fixed

* removed f in fdescribe, refactor of hostbinding
  • Loading branch information
NikolajSkousen authored Feb 10, 2022
1 parent ed06349 commit 6828d5f
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ export class ModalShowcaseComponent implements AfterViewInit {
type: ['white', 'light'],
defaultValue: 'white',
},
{
name: 'type',
description:
'Sets the type of the footer. When inline the footer will have a transparent background and no shadow.',
type: ['fixed', 'inline'],
defaultValue: 'fixed',
},
];

events: ApiDescriptionEvent[] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,8 @@ ion-footer {
:host(.light) ion-footer {
background-color: utils.get-color('background-color');
}

:host(.inline) ion-footer {
background: transparent;
box-shadow: none;
}
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,31 @@ describe('ModalFooterComponent', () => {
});
});

describe('when inline type is set', () => {
it('should have a transparent background color', () => {
spectator = createHost(`<kirby-modal-footer type="inline"></kirby-modal-footer>`);
expect(spectator.query('ion-footer')).toHaveComputedStyle({
'background-color': 'transparent',
});
});

it('should have a transparent background even when themeColor is specified', () => {
spectator = createHost(
`<kirby-modal-footer type="inline" themeColor="primary"></kirby-modal-footer>`
);
expect(spectator.query('ion-footer')).toHaveComputedStyle({
'background-color': 'transparent',
});
});

it('should not show a box shadow', () => {
spectator = createHost(`<kirby-modal-footer type="inline"></kirby-modal-footer>`);
expect(spectator.query('ion-footer')).toHaveComputedStyle({
'box-shadow': 'none',
});
});
});

// utility functions
function setSafeAreaBottom() {
modalFooterElement.style.setProperty('--kirby-safe-area-bottom', SAFE_AREA_BOTTOM_PX);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Input, HostBinding } from '@angular/core';
import { Component, HostBinding, Input } from '@angular/core';

@Component({
selector: 'kirby-modal-footer',
Expand All @@ -9,4 +9,8 @@ export class ModalFooterComponent {
@HostBinding('class.snap-to-keyboard')
@Input()
snapToKeyboard = false;

@HostBinding('class')
@Input()
type: 'inline' | 'fixed' = 'fixed';
}

0 comments on commit 6828d5f

Please sign in to comment.