-
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 to match MD design and remove transforms (#16348)
Updates the tab-bar to match the MD bottom navigation spec: https://material.io/design/components/bottom-navigation.html#specs Changes proposed in this pull request: - moved flex properties to host, inherit in child anchor element - this allows the user to customize the tab-button flex properties & fixes #16231 - increased letter spacing - removed transforms / transitions on active tab - decreased badge size, add badge styling when empty for MD - fix badge positioning on both iOS and MD - updates e2e tests, adds a preview test for tab-bar - updates documentation surrounding tabs fixes #16231 fixes ionic-team/ionic-docs#175 fixes ionic-team/ionic-docs#163
- Loading branch information
1 parent
d336054
commit bc3e192
Showing
18 changed files
with
940 additions
and
363 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
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: preview', async () => { | ||
const page = await newE2EPage({ | ||
url: '/src/components/tab-bar/test/preview?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 - Preview</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> | ||
<!-- Default --> | ||
<ion-tab-bar selected-tab="1"> | ||
|
||
<ion-tab-button tab="1"> | ||
<ion-label>Recents</ion-label> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="2"> | ||
<ion-label>Favorites</ion-label> | ||
<ion-badge>23</ion-badge> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="3"> | ||
<ion-label>Settings</ion-label> | ||
</ion-tab-button> | ||
|
||
</ion-tab-bar> | ||
|
||
<!-- Badges --> | ||
<ion-tab-bar selected-tab="1"> | ||
<ion-tab-button tab="1" layout="icon-top"> | ||
<ion-icon name="heart"></ion-icon> | ||
<ion-label>Favorites</ion-label> | ||
<ion-badge color="danger"></ion-badge> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="2"> | ||
<ion-icon name="musical-note"></ion-icon> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="3"> | ||
<ion-icon name="today"></ion-icon> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="4"> | ||
<ion-icon name="calendar"></ion-icon> | ||
<ion-badge color="danger">47</ion-badge> | ||
</ion-tab-button> | ||
</ion-tab-bar> | ||
|
||
<ion-tab-bar selected-tab="1"> | ||
<ion-tab-button tab="1"> | ||
<ion-icon name="musical-note"></ion-icon> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="2" layout="icon-bottom"> | ||
<ion-icon name="heart"></ion-icon> | ||
<ion-label>Favorites</ion-label> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="3"> | ||
<ion-icon name="today"></ion-icon> | ||
<ion-badge color="danger">88</ion-badge> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="4"> | ||
<ion-icon name="calendar"></ion-icon> | ||
</ion-tab-button> | ||
</ion-tab-bar> | ||
|
||
<ion-tab-bar selected-tab="1"> | ||
<ion-tab-button tab="1"> | ||
<ion-icon name="heart"></ion-icon> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="2"> | ||
<ion-icon name="musical-note"></ion-icon> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="3"> | ||
<ion-icon name="today"></ion-icon> | ||
</ion-tab-button> | ||
</ion-tab-bar> | ||
|
||
|
||
<!-- Icons on top of text --> | ||
<ion-tab-bar color="secondary" selected-tab="1"> | ||
<ion-tab-button tab="1"> | ||
<ion-label>Location</ion-label> | ||
<ion-icon name="navigate"></ion-icon> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="2"> | ||
<ion-badge color="danger">44</ion-badge> | ||
<ion-icon name="heart"></ion-icon> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="3"> | ||
<ion-label>Radio</ion-label> | ||
<ion-icon name="musical-notes"></ion-icon> | ||
</ion-tab-button> | ||
|
||
</ion-tab-bar> | ||
|
||
|
||
<!-- Icons below text --> | ||
<ion-tab-bar color="dark" selected-tab="1"> | ||
<ion-tab-button tab="1" layout="icon-bottom"> | ||
<ion-label>Recents</ion-label> | ||
<ion-icon name="call"></ion-icon> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="2" layout="icon-top"> | ||
<ion-badge>16</ion-badge> | ||
<ion-label>Favorites</ion-label> | ||
<ion-icon name="heart"></ion-icon> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="3" layout="icon-bottom"> | ||
<ion-label>Settings</ion-label> | ||
<ion-icon name="settings"></ion-icon> | ||
</ion-tab-button> | ||
</ion-tab-bar> | ||
|
||
|
||
<!-- Icons right of text --> | ||
<ion-tab-bar color="danger" selected-tab="1"> | ||
<ion-tab-button tab="1" layout="icon-end"> | ||
<ion-label>Recents</ion-label> | ||
<ion-icon name="call"></ion-icon> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="2" layout="icon-end"> | ||
<ion-label>Favorites</ion-label> | ||
<ion-icon name="heart"></ion-icon> | ||
<ion-badge color="dark">33</ion-badge> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="3" layout="icon-end"> | ||
<ion-label>Settings</ion-label> | ||
<ion-icon name="settings"></ion-icon> | ||
</ion-tab-button> | ||
|
||
</ion-tab-bar> | ||
|
||
|
||
<!-- Icons left of text --> | ||
<ion-tab-bar color="light" selected-tab="1"> | ||
<ion-tab-button tab="1" layout="icon-start"> | ||
<ion-label>Recents</ion-label> | ||
<ion-icon name="call"></ion-icon> | ||
<ion-badge color="danger">12</ion-badge> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="2" layout="icon-start"> | ||
<ion-label>Favorites</ion-label> | ||
<ion-icon name="heart"></ion-icon> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="3" layout="icon-start"> | ||
<ion-label>Settings</ion-label> | ||
<ion-icon name="settings"></ion-icon> | ||
</ion-tab-button> | ||
|
||
</ion-tab-bar> | ||
|
||
|
||
<!-- No icons --> | ||
<ion-tab-bar color="primary" selected-tab="1"> | ||
<ion-tab-button tab="1" layout="icon-hide"> | ||
<ion-label>Recents</ion-label> | ||
<ion-icon name="call"></ion-icon> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="2" layout="icon-hide"> | ||
<ion-label>Favorites</ion-label> | ||
<ion-icon name="heart"></ion-icon> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="3" layout="icon-hide"> | ||
<ion-label>Settings</ion-label> | ||
<ion-icon name="settings"></ion-icon> | ||
<ion-badge color="danger">2</ion-badge> | ||
</ion-tab-button> | ||
</ion-tab-bar> | ||
|
||
<style> | ||
body { | ||
background: #f6f6f6; | ||
} | ||
|
||
ion-tab-bar { | ||
margin-bottom: 10px; | ||
} | ||
|
||
</style> | ||
</body> | ||
|
||
</html> |
Oops, something went wrong.