-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(shape): Add MDC Shape with support for unelevated angled corners (…
- Loading branch information
1 parent
e68b053
commit dc87f18
Showing
15 changed files
with
487 additions
and
3 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,121 @@ | ||
<!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> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Shape - 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/shape.css"> | ||
<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"> | ||
<script src="/ready.js"></script> | ||
</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"> | ||
<a href="/" class="catalog-back mdc-toolbar__menu-icon"><i class="material-icons"></i></a> | ||
<span class="mdc-toolbar__title catalog-title">Shape</span> | ||
</section> | ||
</div> | ||
</header> | ||
|
||
<main class="mdc-toolbar-fixed-adjust"> | ||
<section class="hero"> | ||
<div class="mdc-shape-container four-corner-container"> | ||
<button class="mdc-button mdc-button--unelevated">Filled Button</button> | ||
<div class="mdc-shape-container__corner mdc-shape-container__corner--top-left"></div> | ||
<div class="mdc-shape-container__corner mdc-shape-container__corner--top-right"></div> | ||
<div class="mdc-shape-container__corner mdc-shape-container__corner--bottom-right"></div> | ||
<div class="mdc-shape-container__corner mdc-shape-container__corner--bottom-left"></div> | ||
</div> | ||
<div class="mdc-shape-container four-corner-container four-corner-container--stroked"> | ||
<button class="mdc-button mdc-button--stroked">Stroked Button</button> | ||
<div class="mdc-shape-container__corner mdc-shape-container__corner--top-left"></div> | ||
<div class="mdc-shape-container__corner mdc-shape-container__corner--top-right"></div> | ||
<div class="mdc-shape-container__corner mdc-shape-container__corner--bottom-right"></div> | ||
<div class="mdc-shape-container__corner mdc-shape-container__corner--bottom-left"></div> | ||
</div> | ||
</section> | ||
|
||
<section class="demo-wrapper"> | ||
<h1 class="mdc-typography--display2">Button</h1> | ||
|
||
<h2 class="mdc-typography--display1">Filled</h2> | ||
<div class="mdc-shape-container two-corner-container"> | ||
<button class="mdc-button mdc-button--unelevated">Skip</button> | ||
<div class="mdc-shape-container__corner mdc-shape-container__corner--top-left"></div> | ||
<div class="mdc-shape-container__corner mdc-shape-container__corner--bottom-right"></div> | ||
</div> | ||
<div class="mdc-shape-container four-corner-container"> | ||
<button class="mdc-button mdc-button--unelevated">Finish</button> | ||
<div class="mdc-shape-container__corner mdc-shape-container__corner--top-left"></div> | ||
<div class="mdc-shape-container__corner mdc-shape-container__corner--top-right"></div> | ||
<div class="mdc-shape-container__corner mdc-shape-container__corner--bottom-right"></div> | ||
<div class="mdc-shape-container__corner mdc-shape-container__corner--bottom-left"></div> | ||
</div> | ||
|
||
<h2 class="mdc-typography--display1">Stroked</h2> | ||
<div class="mdc-shape-container two-corner-container two-corner-container--stroked"> | ||
<button class="mdc-button mdc-button--stroked">Skip</button> | ||
<div class="mdc-shape-container__corner mdc-shape-container__corner--top-left"></div> | ||
<div class="mdc-shape-container__corner mdc-shape-container__corner--bottom-right"></div> | ||
</div> | ||
<div class="mdc-shape-container four-corner-container four-corner-container--stroked"> | ||
<button class="mdc-button mdc-button--stroked">Finish</button> | ||
<div class="mdc-shape-container__corner mdc-shape-container__corner--top-left"></div> | ||
<div class="mdc-shape-container__corner mdc-shape-container__corner--top-right"></div> | ||
<div class="mdc-shape-container__corner mdc-shape-container__corner--bottom-right"></div> | ||
<div class="mdc-shape-container__corner mdc-shape-container__corner--bottom-left"></div> | ||
</div> | ||
|
||
<h1 class="mdc-typography--display2">Card</h1> | ||
|
||
<div class="mdc-shape-container card-container"> | ||
<div class="mdc-card mdc-card--stroked demo-card"> | ||
<a class="mdc-card__primary-action demo-card__primary-action" href="#"> | ||
<div class="demo-card__row"> | ||
<div class="mdc-card__media mdc-card__media--square demo-card__media"></div> | ||
<div class="demo-card__info"> | ||
<div class="mdc-typography--headline">Title</div> | ||
<div class="mdc-typography--body1">Body text</div> | ||
</div> | ||
</div> | ||
</a> | ||
</div> | ||
<div class="mdc-shape-container__corner mdc-shape-container__corner--top-left"></div> | ||
<div class="mdc-shape-container__corner mdc-shape-container__corner--top-right"></div> | ||
<div class="mdc-shape-container__corner mdc-shape-container__corner--bottom-right"></div> | ||
<div class="mdc-shape-container__corner mdc-shape-container__corner--bottom-left"></div> | ||
</div> | ||
</section> | ||
</main> | ||
|
||
<script src="/assets/material-components-web.js" async></script> | ||
<script src="/assets/common.js" async></script> | ||
<script> | ||
demoReady(function() { | ||
// Attach ripples to demonstrate corner masking | ||
[].forEach.call(document.querySelectorAll('.mdc-button, .mdc-card__primary-action'), function(surface) { | ||
mdc.ripple.MDCRipple.attachTo(surface); | ||
}); | ||
}); | ||
</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,94 @@ | ||
// | ||
// 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 | ||
// | ||
// http://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. | ||
// | ||
|
||
@import "./common"; | ||
@import "../packages/mdc-button/mdc-button"; | ||
@import "../packages/mdc-button/mixins"; | ||
@import "../packages/mdc-button/variables"; | ||
@import "../packages/mdc-card/mdc-card"; | ||
@import "../packages/mdc-card/variables"; | ||
@import "../packages/mdc-shape/mdc-shape"; | ||
@import "../packages/mdc-shape/mixins"; | ||
|
||
.demo-wrapper { | ||
margin: 24px; | ||
} | ||
|
||
// Demo buttons | ||
// (TODO: padding, possibly through new button mixins) | ||
|
||
.two-corner-container { | ||
@include mdc-shape-angled-corner($mdc-theme-background, $mdc-button-height / 4, 0); | ||
} | ||
|
||
.four-corner-container { | ||
margin: 0 8px; | ||
@include mdc-shape-angled-corner($mdc-theme-background, $mdc-button-height / 4 + 1); | ||
} | ||
|
||
.two-corner-container--stroked, | ||
.four-corner-container--stroked { | ||
@include mdc-shape-angled-corner-stroke(2px, $mdc-theme-primary); | ||
} | ||
|
||
.hero { | ||
// Override background mask color for buttons in hero section | ||
@include mdc-shape-angled-corner-background($hero-background-color); | ||
|
||
// For whatever reason, this aligns the shape borders better in Chrome on OS X, | ||
// as opposed to having the buttons centered side by side. Other browsers don't seem to have an issue. | ||
flex-direction: column; | ||
|
||
.four-corner-container { | ||
margin: 8px 0; | ||
} | ||
} | ||
|
||
// Demo card | ||
|
||
.card-container { | ||
@include mdc-shape-angled-corner($mdc-theme-background, 24px, 4px); | ||
@include mdc-shape-angled-corner-stroke($mdc-card-stroke-width, $mdc-card-stroke-color); | ||
} | ||
|
||
.demo-card { | ||
@include mdc-card-corner-radius(24px 4px); | ||
|
||
@include mdc-rtl { | ||
@include mdc-card-corner-radius(4px 24px); | ||
} | ||
} | ||
|
||
.demo-card__row { | ||
display: flex; | ||
} | ||
|
||
.demo-card__media { | ||
background-image: url("/images/1-1.jpg"); | ||
width: 110px; | ||
border-top-left-radius: inherit; | ||
|
||
@include mdc-rtl { | ||
border-top-left-radius: 0; | ||
border-top-right-radius: inherit; | ||
} | ||
} | ||
|
||
.demo-card__info { | ||
display: flex; | ||
flex-direction: column; | ||
padding: 8px 16px; | ||
} |
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 |
---|---|---|
|
@@ -155,6 +155,7 @@ | |
"rtl", | ||
"select", | ||
"selection-control", | ||
"shape", | ||
"slider", | ||
"snackbar", | ||
"switch", | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// 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 | ||
// | ||
// http://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. | ||
// | ||
|
||
$mdc-card-stroke-color: #dbdbdb; | ||
$mdc-card-stroke-width: 1px; |
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.