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

Change position of tabbar badges #2555

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { ActionSheetComponent, ActionSheetItem } from '../modal';

import { FabSheetComponent } from './fab-sheet.component';

fdescribe('FabSheetComponent', () => {
describe('FabSheetComponent', () => {
let spectator: SpectatorHost<FabSheetComponent>;
let component: FabSheetComponent;
let ionFabButtonElement: HTMLIonFabButtonElement;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
select="kirby-icon[:not([selected-tab])]"
></ng-content>
<ng-content *ngIf="ionTabButton.selected" select="kirby-icon[selected-tab]"></ng-content>
<ng-content select="kirby-badge"></ng-content>
</div>
<ion-label>
<ng-content></ng-content>
</ion-label>
<ng-content select="kirby-badge"></ng-content>
</ion-tab-button>
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use 'sass:math';

@use '~@kirbydesign/core/src/scss/interaction-state';
@use '~@kirbydesign/core/src/scss/utils';

Expand All @@ -24,14 +26,19 @@ ion-tab-button {
font-size: utils.font-size('xxs');

--color-selected: utils.get-color('black');

// Magic values here as we have no tokens that gives
// badge the correct position in relation to the tab icon
mictro marked this conversation as resolved.
Show resolved Hide resolved
--kirby-badge-position: absolute;
--kirby-badge-top: 0;
--kirby-badge-right: 0;
--kirby-badge-top: 0.55em;
--kirby-badge-left: calc(50% + 0.4em);

@include utils.slotted(div kirby-badge) {
@include utils.slotted(kirby-badge) {
&.md {
--kirby-badge-top: -5px;
--kirby-badge-right: -5px;
// Magic values here as we have no tokens that gives
// badge the correct position in relation to the tab icon
--kirby-badge-top: 0.3em;
--kirby-badge-left: calc(50% + 0.2em);
}
}

Expand All @@ -41,16 +48,34 @@ ion-tab-button {

@include utils.media('>=medium') {
flex: none;
flex-direction: row;
padding: 0 utils.size('m');
margin-right: utils.size('m');
font-size: utils.font-size('s');

--color-selected: #{utils.get-color('black')};

// Magic values here as we have no tokens that gives
// badge the correct position in relation to the tab icon
--kirby-badge-position: absolute; // Repeated for readability
mictro marked this conversation as resolved.
Show resolved Hide resolved
--kirby-badge-top: calc(50% - 1.35em);
--kirby-badge-left: 1.6em;

@include utils.slotted(kirby-badge) {
&.md {
--kirby-badge-position: relative;
--kirby-badge-top: 0;
--kirby-badge-left: 0;

margin-left: utils.size('xxxxs');
margin-bottom: math.div(utils.size('xxxxs'), 2);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to import the math module (beginning of file):

@use 'sass:math';

Will fix https://github.com/kirbydesign/designsystem/actions/runs/3319146598/jobs/5483935259#step:4:36

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bummer... - fixed

}
}

&:last-child {
margin-right: 0;
}

font-size: utils.font-size('s');
flex-direction: row;

.icon-container {
margin-right: utils.size('xxs');
}
Expand Down