-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(tab-bar): update tab-bar to set the color/background of tab-button (
#16641) similar to the PR for segment: #16590, this implements the color/background in the tab-bar and inherits it in tab-button closes #14853
- Loading branch information
1 parent
9167fb4
commit 2f63049
Showing
12 changed files
with
253 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,25 @@ | ||
@import "./tab-bar"; | ||
@import "../../themes/ionic.globals.ios"; | ||
@import "../tab-button/tab-button.ios.vars"; | ||
|
||
// iOS Tabs | ||
// -------------------------------------------------- | ||
|
||
:host { | ||
// default color / background | ||
--background: #{$tabbar-ios-background}; | ||
--background-focused: #{$tabbar-ios-background-focused}; | ||
--border: #{$hairlines-width solid $tabbar-ios-border-color}; | ||
--color: #{$tab-button-ios-text-color}; | ||
--color-selected: #{$tabbar-ios-color-activated}; | ||
|
||
height: 50px; | ||
} | ||
|
||
// iOS Translucent Tab bar | ||
// -------------------------------------------------- | ||
|
||
:host(.tabbar-translucent) { | ||
:host(.tab-bar-translucent) { | ||
background-color: #{current-color(base, .8)}; | ||
backdrop-filter: saturate(210%) blur(20px); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
@import "./tab-bar"; | ||
@import "../../themes/ionic.globals.md"; | ||
@import "../tab-button/tab-button.md.vars"; | ||
|
||
:host { | ||
// default color / background | ||
--background: #{$tabbar-md-background}; | ||
--background-focused: #{$tabbar-md-background-focused}; | ||
--border: #{1px solid $tabbar-md-border-color}; | ||
--color: #{$tab-button-md-text-color}; | ||
--color-selected: #{$tabbar-md-color-activated}; | ||
|
||
height: 56px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { newE2EPage } from '@stencil/core/testing'; | ||
|
||
test('tab-bar: custom', async () => { | ||
const page = await newE2EPage({ | ||
url: '/src/components/tab-bar/test/custom?ionic:_testing=true' | ||
}); | ||
|
||
const compare = await page.compareScreenshot(); | ||
expect(compare).toMatchScreenshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,202 @@ | ||
<!DOCTYPE html> | ||
<html dir="ltr"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Tab Bar - Custom</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"> | ||
<script src="../../../../../dist/ionic.js"></script> | ||
<link rel="stylesheet" href="../../../../../css/ionic.bundle.css"> | ||
<link rel="stylesheet" href="../../../../../scripts/testing/styles.css"> | ||
</head> | ||
|
||
<body> | ||
<ion-app> | ||
<ion-content> | ||
<!-- Default --> | ||
<ion-tab-bar selected-tab="1"> | ||
<ion-tab-button tab="1"> | ||
<ion-icon name="clock"></ion-icon> | ||
<ion-label>Recents</ion-label> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="2"> | ||
<ion-icon name="star"></ion-icon> | ||
<ion-label>Favorites</ion-label> | ||
<ion-badge>6</ion-badge> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="3"> | ||
<ion-icon name="cog"></ion-icon> | ||
<ion-label>Settings</ion-label> | ||
</ion-tab-button> | ||
</ion-tab-bar> | ||
|
||
<!-- Custom Class --> | ||
<ion-tab-bar selected-tab="11" class="custom-tab-bar-color"> | ||
<ion-tab-button tab="11"> | ||
<ion-icon name="clock"></ion-icon> | ||
<ion-label>Recents</ion-label> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="22"> | ||
<ion-icon name="star"></ion-icon> | ||
<ion-label>Favorites</ion-label> | ||
<ion-badge>6</ion-badge> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="33"> | ||
<ion-icon name="cog"></ion-icon> | ||
<ion-label>Settings</ion-label> | ||
</ion-tab-button> | ||
</ion-tab-bar> | ||
|
||
<!-- Color & Custom Class --> | ||
<ion-tab-bar selected-tab="111" color="danger" class="custom-tab-bar-color"> | ||
<ion-tab-button tab="111"> | ||
<ion-icon name="clock"></ion-icon> | ||
<ion-label>Recents</ion-label> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="222"> | ||
<ion-icon name="star"></ion-icon> | ||
<ion-label>Favorites</ion-label> | ||
<ion-badge>6</ion-badge> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="333"> | ||
<ion-icon name="cog"></ion-icon> | ||
<ion-label>Settings</ion-label> | ||
</ion-tab-button> | ||
</ion-tab-bar> | ||
|
||
<!-- Custom Background Buttons --> | ||
<ion-tab-bar selected-tab="1111" class="custom-tab-button-bar"> | ||
<ion-tab-button tab="1111" class="custom-tab-button-background-red"> | ||
<ion-icon name="clock"></ion-icon> | ||
<ion-label>Recents</ion-label> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="2222" class="custom-tab-button-background-yellow"> | ||
<ion-icon name="star"></ion-icon> | ||
<ion-label>Favorites</ion-label> | ||
<ion-badge>6</ion-badge> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="3333" class="custom-tab-button-background-green"> | ||
<ion-icon name="cog"></ion-icon> | ||
<ion-label>Settings</ion-label> | ||
</ion-tab-button> | ||
</ion-tab-bar> | ||
|
||
<!-- Custom Color Buttons --> | ||
<ion-tab-bar selected-tab="1111"> | ||
<ion-tab-button tab="1111" class="custom-tab-button-color-red"> | ||
<ion-icon name="clock"></ion-icon> | ||
<ion-label>Recents</ion-label> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="2222" class="custom-tab-button-color-yellow"> | ||
<ion-icon name="star"></ion-icon> | ||
<ion-label>Favorites</ion-label> | ||
<ion-badge>6</ion-badge> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="3333" class="custom-tab-button-color-green"> | ||
<ion-icon name="cog"></ion-icon> | ||
<ion-label>Settings</ion-label> | ||
</ion-tab-button> | ||
</ion-tab-bar> | ||
|
||
<!-- Custom All --> | ||
<ion-tab-bar selected-tab="11111" class="custom-all"> | ||
<ion-tab-button tab="11111"> | ||
<ion-icon name="clock"></ion-icon> | ||
<ion-label>Recents</ion-label> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="22222"> | ||
<ion-icon name="star" class="custom-icon"></ion-icon> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="33333"> | ||
<ion-icon name="cog"></ion-icon> | ||
<ion-label>Settings</ion-label> | ||
</ion-tab-button> | ||
</ion-tab-bar> | ||
</ion-content> | ||
</ion-app> | ||
|
||
<style> | ||
.custom-tab-bar-color { | ||
--background: #7044ff; | ||
--color: rgb(255, 0, 234, .6); | ||
--color-selected: #ff00ea; | ||
} | ||
|
||
.custom-tab-bar-color ion-badge { | ||
background: rgba(255, 255, 255, 0.8); | ||
color: rgba(0, 0, 0, .5); | ||
} | ||
|
||
.custom-tab-button-bar { | ||
--background: #178fb8; | ||
--color: rgba(255, 255, 255, .6); | ||
--color-selected: #ffffff; | ||
} | ||
|
||
.custom-tab-button-background-red { | ||
--background: #a32b2b; | ||
} | ||
|
||
.custom-tab-button-background-yellow { | ||
--background: #b7b915; | ||
} | ||
|
||
.custom-tab-button-background-green { | ||
--background: #5a9b2e; | ||
} | ||
|
||
.custom-tab-button-color-red { | ||
--color: rgba(163, 43, 43, .6); | ||
--color-selected: #a32b2b; | ||
} | ||
|
||
.custom-tab-button-color-yellow { | ||
--color: rgba(183, 185, 21, .6); | ||
--color-selected: #b7b915; | ||
} | ||
|
||
.custom-tab-button-color-green { | ||
--color: rgb(90, 155, 46, .6); | ||
--color-selected: #5a9b2e; | ||
} | ||
|
||
.custom-all { | ||
margin-top: 30px; | ||
margin-bottom: 30px; | ||
contain: none; | ||
|
||
--background: #f6f6f6; | ||
--color-selected: #1b8472; | ||
|
||
--border: none; | ||
} | ||
|
||
.custom-all ion-tab-button:nth-child(2) { | ||
--background: #1b8472; | ||
--color: rgba(255, 255, 255, .6); | ||
--color-selected: #ffffff; | ||
|
||
border-radius: 50%; | ||
max-width: 80px; | ||
height: 80px; | ||
} | ||
|
||
.custom-icon { | ||
font-size: 50px; | ||
} | ||
</style> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.