Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
feat: add feature targeting for styles to tab-related packages
Browse files Browse the repository at this point in the history
Adds support for style feature targeting to the `tab`, `tab-bar`, `tab-indicator` and `tab-scroller` packages.
  • Loading branch information
crisbeto committed Jun 17, 2019
1 parent 1c34f8b commit 6da9ed5
Show file tree
Hide file tree
Showing 10 changed files with 686 additions and 371 deletions.
41 changes: 11 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 38 additions & 24 deletions packages/mdc-tab-bar/_mixins.scss
Original file line number Diff line number Diff line change
@@ -1,26 +1,40 @@
/**
* @license
* Copyright 2018 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
//
// Copyright 2018 Google Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

@mixin mdc-tab-bar-width($width) {
width: $width;
@import "@material/feature-targeting/functions";
@import "@material/feature-targeting/mixins";

@mixin mdc-tab-bar-core-styles($query: mdc-feature-all()) {
// postcss-bem-linter: define tab-bar
.mdc-tab-bar {
@include mdc-tab-bar-width(100%, $query);
}
// postcss-bem-linter: end
}

@mixin mdc-tab-bar-width($width, $query: mdc-feature-all()) {
$feat-structure: mdc-feature-create-target($query, structure);

@include mdc-feature-targets($feat-structure) {
width: $width;
}
}
9 changes: 1 addition & 8 deletions packages/mdc-tab-bar/mdc-tab-bar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,4 @@
*/

@import "./mixins";

// postcss-bem-linter: define tab-bar

.mdc-tab-bar {
@include mdc-tab-bar-width(100%);
}

// postcss-bem-linter: end
@include mdc-tab-bar-core-styles;
Loading

0 comments on commit 6da9ed5

Please sign in to comment.