This repository has been archived by the owner on Jan 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat(tab): Add tab indicator #2461
Merged
Merged
Changes from 62 commits
Commits
Show all changes
68 commits
Select commit
Hold shift + click to select a range
1b3bac3
WIP start of mdc-tab
patrickrodee 8bd43c0
WIP updated with "hasClass" on foundation
patrickrodee 9d33e3b
WIP testing
patrickrodee 0bbfe73
WIP added tests; updated styles for custom indicator
patrickrodee d531675
WIP adding demo
patrickrodee 8753c18
WIP more progess
patrickrodee 7fe42d5
WIP demo
patrickrodee 9f1053c
WIP added material-icons because i'm a fool
patrickrodee 2205fcb
WIP got ripples and custom theme working; need to update layout and RTL
patrickrodee dbb6a3d
WIP made mdc-tab private
patrickrodee 0feb3ab
WIP added readme; fixed up demo to look nice
patrickrodee f1c3097
WIP added ripple exposure from MDCTab
patrickrodee 52187c1
WIP fixed spelling of "event"
patrickrodee 3cc11f3
WIP added ripple foundation back to checkbox
patrickrodee 0f2e7fa
WIP updated all the tests...
patrickrodee 2cc6387
WIP merged master
patrickrodee b6b7380
WIP cleaned up tab mixins file
patrickrodee d130f43
WIP rewrote ripple test
patrickrodee 22a5656
WIP re-rewrote ripple test
patrickrodee 047a45f
WIP re-re-rewrote ripple test and implementation
patrickrodee a016ecf
WIP changed ripple import order
patrickrodee 3744249
WIP moved getters/setters
patrickrodee f15e991
WIP changed static method order
patrickrodee 1c0d1cc
WIP upgraded tab to 0.33.0; upgraded ripple in tab to 0.33.0
patrickrodee fa5be74
Merge branch 'master' into feat/tabs/tab
patrickrodee 5fa0260
WIP starting
patrickrodee dab80ce
WIP merge master
patrickrodee dd8554e
WIP progress
patrickrodee 55d9f5e
WIP progress
patrickrodee 88dae47
WIP progress
patrickrodee d1a7de3
WIP progress again
patrickrodee f63bfea
WIP removed tab-indicator package
patrickrodee 2e0f946
WIP added tests
patrickrodee 352bc66
WIP removed tab ripple
patrickrodee 3820453
WIP fixed tests and typing
patrickrodee 6239108
WIP added ripple test
patrickrodee 80bb55d
WIP set transform origin for IE testing [skip-ci]
patrickrodee 915e572
Merge branch 'master' into feat/tabs/tab-indicator
patrickrodee 06093c7
WIP updated demo and event handler registration naming scheme
patrickrodee 394d115
Merge branch 'feat/tabs/tab-indicator' of github.com:material-compone…
patrickrodee 4a27603
WIP fixed some stylelint issues i should've caught
patrickrodee 0c52e85
WIP readme progress; mdc-tab commenting [ci skip]
patrickrodee d9739ef
WIP updated demos and tests
patrickrodee 3a65619
WIP adding moar tests
patrickrodee c80c9f5
WIP progress; need to fix outstanding closure issues
patrickrodee d42b3ad
WIP added a whole bunch; time for an updated PR
patrickrodee 56aebed
WIP reset all tab changes so this PR is just tab-indicator
patrickrodee 35ba5d2
Merge branch 'master' into feat/tabs/tab-indicator
patrickrodee 961f84b
WIP removed package-lock.json
patrickrodee 6aaf004
Merge branch 'feat/tabs/tab-indicator' of github.com:material-compone…
patrickrodee 6ba4fbe
WIP got tests passing
patrickrodee 8603321
WIP added demo for tab indicator
patrickrodee 1ba59fc
WIP updated demo; reworked icon visual centering
patrickrodee e015586
WIP adding appendChild/removeChild to gBCR test
patrickrodee 00af9db
Merge branch 'master' into feat/tabs/tab-indicator
patrickrodee 5841b72
WIP removed overrides from icon foundation
patrickrodee 38c868f
WIP updated from review
patrickrodee 164089a
WIP separating content from animation
patrickrodee 8a41020
Merge branch 'feat/tabs/tabs' into feat/tabs/tab-indicator
patrickrodee 6b563c2
Merge branch 'feat/tabs/tab-indicator' of github.com:material-compone…
patrickrodee e4d6b76
WIP updated from review
patrickrodee 6e1b1a4
WIP set travis to run for merges to feat/tabs/tabs
patrickrodee 66b550f
WIP DONE
patrickrodee 058998e
WIP saved the day
patrickrodee 7aa0362
WIP party time ✨
patrickrodee c5ca744
WIP updated from review ✌️
patrickrodee 60463e4
WIP renamed "bar" to "underline"
patrickrodee ad27e5c
WIP updated test names
patrickrodee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ language: node_js | |
branches: | ||
only: | ||
- master | ||
- feat/tabs/tabs | ||
matrix: | ||
include: | ||
- node_js: 8 | ||
|
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,232 @@ | ||
<!DOCTYPE html> | ||
<!-- | ||
Copyright 2018 Google Inc. All rights reserved. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
https://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License | ||
--> | ||
<html> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add more cases where the tabs are different widths. And remove the fading bar demo. |
||
<head> | ||
<meta charset="utf-8"> | ||
<title>Tab Indicator - Material Components Catalog</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link rel="icon" type="image/png" href="/images/logo_components_color_2x_web_48dp.png"> | ||
<link rel="stylesheet" href="/assets/tab-indicator.css"> | ||
<script src="/ready.js"></script> | ||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Mono"> | ||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500"> | ||
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> | ||
</head> | ||
|
||
<body class="mdc-typography"> | ||
<header class="mdc-toolbar mdc-toolbar--fixed"> | ||
<div class="mdc-toolbar__row"> | ||
<section class="mdc-toolbar__section mdc-toolbar__section--align-start"> | ||
<span class="catalog-back"> | ||
<a href="/" class="mdc-toolbar__menu-icon"><i class="material-icons"></i></a> | ||
</span> | ||
<span class="mdc-toolbar__title catalog-title">Tab Indicator</span> | ||
</section> | ||
</div> | ||
</header> | ||
|
||
<main class="mdc-toolbar-fixed-adjust"> | ||
<section class="hero"> | ||
<div class="demo"> | ||
<div class="demo-item hero-demo-item"> | ||
<span class="mdc-tab-indicator mdc-tab-indicator--active"> | ||
<span class="mdc-tab-indicator__bar"></span> | ||
</span> | ||
</div> | ||
<div class="demo-item hero-demo-item"> | ||
<span class="mdc-tab-indicator"> | ||
<span class="mdc-tab-indicator__bar"></span> | ||
</span> | ||
</div> | ||
</div> | ||
</section> | ||
|
||
<section class="example"> | ||
<h2>Sliding Bar Indicator</h2> | ||
<div class="demo"> | ||
<div class="demo-item"> | ||
<span class="mdc-tab-indicator mdc-tab-indicator--active demo-indicator custom-sliding-bar"> | ||
<span class="mdc-tab-indicator__bar"></span> | ||
</span> | ||
</div> | ||
<div class="demo-item"> | ||
<span class="mdc-tab-indicator custom-sliding-bar"> | ||
<span class="mdc-tab-indicator__bar"></span> | ||
</span> | ||
</div> | ||
</div> | ||
|
||
<br> | ||
|
||
<h4>Custom Color</h4> | ||
<div class="demo"> | ||
<div class="demo-item"> | ||
<span class="mdc-tab-indicator mdc-tab-indicator--active custom-color"> | ||
<span class="mdc-tab-indicator__bar"></span> | ||
</span> | ||
</div> | ||
<div class="demo-item"> | ||
<span class="mdc-tab-indicator custom-color"> | ||
<span class="mdc-tab-indicator__bar"></span> | ||
</span> | ||
</div> | ||
</div> | ||
|
||
<br> | ||
|
||
<h4>Custom Height</h4> | ||
<div class="demo"> | ||
<div class="demo-item"> | ||
<span class="mdc-tab-indicator mdc-tab-indicator--active custom-height"> | ||
<span class="mdc-tab-indicator__bar"></span> | ||
</span> | ||
</div> | ||
<div class="demo-item"> | ||
<span class="mdc-tab-indicator custom-height"> | ||
<span class="mdc-tab-indicator__bar"></span> | ||
</span> | ||
</div> | ||
</div> | ||
|
||
<br> | ||
|
||
<h4>Custom Border Radius</h4> | ||
<div class="demo"> | ||
<div class="demo-item"> | ||
<span class="mdc-tab-indicator mdc-tab-indicator--active custom-border-radius"> | ||
<span class="mdc-tab-indicator__bar"></span> | ||
</span> | ||
</div> | ||
<div class="demo-item"> | ||
<span class="mdc-tab-indicator custom-border-radius"> | ||
<span class="mdc-tab-indicator__bar"></span> | ||
</span> | ||
</div> | ||
</div> | ||
</section> | ||
|
||
<section class="example"> | ||
<h2>Fading Icon Indicator</h2> | ||
<div class="demo"> | ||
<div class="demo-item"> | ||
<span class="mdc-tab-indicator mdc-tab-indicator--fade mdc-tab-indicator--active"> | ||
<span class="mdc-tab-indicator__icon material-icons">favorite</span> | ||
</span> | ||
</div> | ||
<div class="demo-item"> | ||
<span class="mdc-tab-indicator mdc-tab-indicator--fade"> | ||
<span class="mdc-tab-indicator__icon material-icons">star</span> | ||
</span> | ||
</div> | ||
</div> | ||
|
||
<br> | ||
|
||
<h4>Custom Color</h4> | ||
<div class="demo"> | ||
<div class="demo-item"> | ||
<span class="mdc-tab-indicator mdc-tab-indicator--fade mdc-tab-indicator--active custom-color"> | ||
<span class="mdc-tab-indicator__icon material-icons">favorite</span> | ||
</span> | ||
</div> | ||
<div class="demo-item"> | ||
<span class="mdc-tab-indicator mdc-tab-indicator--fade custom-color"> | ||
<span class="mdc-tab-indicator__icon material-icons">star</span> | ||
</span> | ||
</div> | ||
</div> | ||
|
||
<br> | ||
|
||
<h4>Custom Height</h4> | ||
<div class="demo"> | ||
<div class="demo-item"> | ||
<span class="mdc-tab-indicator mdc-tab-indicator--fade mdc-tab-indicator--active custom-height-icon"> | ||
<span class="mdc-tab-indicator__icon material-icons">favorite</span> | ||
</span> | ||
</div> | ||
<div class="demo-item"> | ||
<span class="mdc-tab-indicator mdc-tab-indicator--fade custom-height-icon"> | ||
<span class="mdc-tab-indicator__icon material-icons">star</span> | ||
</span> | ||
</div> | ||
</div> | ||
</section> | ||
|
||
<section class="example"> | ||
<h2>Mix and Match</h2> | ||
<p>These demos show how to use a fading indicator with bar content or a sliding indicator with icon content.</p> | ||
<h4>Fading Bar</h4> | ||
<div class="demo"> | ||
<div class="demo-item"> | ||
<span class="mdc-tab-indicator mdc-tab-indicator--fade mdc-tab-indicator--active custom-fading-bar"> | ||
<span class="mdc-tab-indicator__bar"></span> | ||
</span> | ||
</div> | ||
<div class="demo-item"> | ||
<span class="mdc-tab-indicator mdc-tab-indicator--fade custom-fading-bar"> | ||
<span class="mdc-tab-indicator__bar"></span> | ||
</span> | ||
</div> | ||
</div> | ||
|
||
<br> | ||
|
||
<h4>Sliding Icon</h4> | ||
<div class="demo"> | ||
<div class="demo-item"> | ||
<span class="mdc-tab-indicator mdc-tab-indicator--active custom-sliding-icon"> | ||
<span class="mdc-tab-indicator__icon material-icons">lens</span> | ||
</span> | ||
</div> | ||
<div class="demo-item"> | ||
<span class="mdc-tab-indicator custom-sliding-icon"> | ||
<span class="mdc-tab-indicator__icon material-icons">lens</span> | ||
</span> | ||
</div> | ||
</div> | ||
</section> | ||
</main> | ||
|
||
<script src="/assets/material-components-web.js" async></script> | ||
<script> | ||
demoReady(function() { | ||
|
||
function initDemo(demoRoot) { | ||
var demoItems = demoRoot.querySelectorAll('.demo-item'); | ||
var activeIndicator; | ||
[].forEach.call(demoItems, function (demoItem) { | ||
var indicatorEl = demoItem.querySelector('.mdc-tab-indicator'); | ||
var indicator = new mdc.tabIndicator.MDCTabIndicator(indicatorEl); | ||
if (indicatorEl.classList.contains('mdc-tab-indicator--active')) { | ||
activeIndicator = indicator; | ||
} | ||
|
||
demoItem.addEventListener('click', function() { | ||
activeIndicator.deactivate(); | ||
indicator.activate(activeIndicator.computeClientRect()); | ||
activeIndicator = indicator; | ||
}); | ||
}); | ||
} | ||
|
||
var demos = document.querySelectorAll('.demo'); | ||
[].forEach.call(demos, initDemo); | ||
}); | ||
</script> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
@import "./common"; | ||
@import "../packages/mdc-tab-indicator/mixins"; | ||
@import "../packages/mdc-tab-indicator/mdc-tab-indicator"; | ||
@import "../packages/mdc-elevation/mixins"; | ||
@import "../packages/mdc-theme/color-palette"; | ||
|
||
.hero { | ||
flex-direction: column; | ||
} | ||
|
||
.demo { | ||
@include mdc-elevation(1); | ||
|
||
display: flex; | ||
align-items: center; | ||
width: 301px; | ||
height: 50px; | ||
margin: 2rem 0; | ||
} | ||
|
||
.demo-item { | ||
position: relative; | ||
flex: 1 0 auto; | ||
width: 150px; | ||
max-width: 150px; | ||
height: inherit; | ||
background-color: $material-color-grey-50; | ||
cursor: pointer; | ||
} | ||
|
||
.demo-item:hover { | ||
background-color: white; | ||
} | ||
|
||
.demo > .demo-item:nth-child(n + 2) { | ||
border-left: 1px solid $material-color-grey-300; | ||
} | ||
|
||
.demo-item--wide { | ||
width: 250px; | ||
max-width: 250px; | ||
} | ||
|
||
.demo-item--narrow { | ||
width: 100px; | ||
max-width: 100px; | ||
} | ||
|
||
.demo-label { | ||
position: relative; | ||
z-index: 2; | ||
} | ||
|
||
.custom-color { | ||
@include mdc-tab-indicator-color($material-color-orange-a400); | ||
} | ||
|
||
.custom-height { | ||
@include mdc-tab-indicator-height(8px); | ||
} | ||
|
||
.custom-height-icon { | ||
@include mdc-tab-indicator-height(44px); | ||
} | ||
|
||
.custom-border-radius { | ||
@include mdc-tab-indicator-height(5px); | ||
@include mdc-tab-indicator-bar-top-corner-radius(5px); | ||
} | ||
|
||
.custom-fading-bar { | ||
@include mdc-tab-indicator-height(4px); | ||
@include mdc-tab-indicator-color($material-color-green-a400); | ||
@include mdc-tab-indicator-bar-top-corner-radius(4px); | ||
} | ||
|
||
.custom-sliding-icon { | ||
@include mdc-tab-indicator-height(24px); | ||
@include mdc-tab-indicator-color($material-color-pink-a400); | ||
} |
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This demo page needs some restructure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated