Skip to content

Commit

Permalink
feat(tabbar): allow tabbar to have highlight in iOS theme with extra …
Browse files Browse the repository at this point in the history
…`tabbar-highlight` class
  • Loading branch information
nolimits4web committed Dec 13, 2021
1 parent 8e89a6a commit 3a141ad
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 33 deletions.
12 changes: 7 additions & 5 deletions src/core/components/tabs/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,13 @@ const Tab = {
if ($tabLinkEl && $tabLinkEl.length > 0) {
$tabLinkEl.addClass('tab-link-active');
// Material Highlight
if (app.theme !== 'ios' && app.toolbar) {
const $tabbarEl = $tabLinkEl.parents('.tabbar, .tabbar-labels');
if ($tabbarEl.length > 0) {
app.toolbar.setHighlight($tabbarEl);
}
const $tabbarEl = $tabLinkEl.parents('.tabbar, .tabbar-labels');
const hasHighlight =
app.toolbar &&
$tabbarEl.length > 0 &&
($tabbarEl.hasClass('tabbar-highlight') || app.theme !== 'ios');
if (hasHighlight) {
app.toolbar.setHighlight($tabbarEl);
}
}
}
Expand Down
13 changes: 0 additions & 13 deletions src/core/components/toolbar/toolbar-aurora.less
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,6 @@
}
.tabbar,
.tabbar-labels {
.tab-link-highlight {
position: absolute;
left: 0;
height: 2px;
background: var(--f7-tabbar-link-active-border-color, var(--f7-theme-color));
transition-duration: 300ms;
.ltr({
left: 0;
});
.rtl({
right: 0;
});
}
.toolbar-inner {
padding-left: 0;
padding-right: 0;
Expand Down
13 changes: 0 additions & 13 deletions src/core/components/toolbar/toolbar-md.less
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,6 @@
overflow: hidden;
position: relative;
}
.tab-link-highlight {
position: absolute;
left: 0;
height: 2px;
background: var(--f7-tabbar-link-active-border-color, var(--f7-theme-color));
transition-duration: 300ms;
.ltr({
left: 0;
});
.rtl({
right: 0;
});
}
}

.tabbar-labels {
Expand Down
3 changes: 1 addition & 2 deletions src/core/components/toolbar/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import { nextFrame, bindMethods } from '../../shared/utils';
const Toolbar = {
setHighlight(tabbarEl) {
const app = this;
if (app.theme === 'ios') return;

const $tabbarEl = $(tabbarEl);
if (app.theme === 'ios' && !$tabbarEl.hasClass('tabbar-highlight')) return;

if (
$tabbarEl.length === 0 ||
Expand Down
13 changes: 13 additions & 0 deletions src/core/components/toolbar/toolbar.less
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,19 @@
height: var(--f7-tabbar-icon-size);
line-height: var(--f7-tabbar-icon-size);
}
.tab-link-highlight {
position: absolute;
left: 0;
height: 2px;
background: var(--f7-tabbar-link-active-border-color, var(--f7-theme-color));
transition-duration: 300ms;
.ltr({
left: 0;
});
.rtl({
right: 0;
});
}
}
.tabbar-labels {
--f7-toolbar-height: var(--f7-tabbar-labels-height);
Expand Down

0 comments on commit 3a141ad

Please sign in to comment.