From 64128734e4cc551046d0aea49626817e5aa3209d Mon Sep 17 00:00:00 2001 From: Marcy Sutton Date: Mon, 23 Mar 2015 15:17:43 -0700 Subject: [PATCH] fix(button): alignment of FAB + mini anchor btns Also includes .md-mini documentation Closes #1607, #2009, #1690 --- docs/app/css/style.css | 2 +- src/components/button/button.js | 19 ++++++++--- src/components/button/button.scss | 33 +++++++++++++------ .../button/demoBasicUsage/index.html | 16 ++++++--- .../button/demoBasicUsage/style.css | 5 ++- src/components/dialog/dialog.scss | 1 + src/core/style/mixins.scss | 15 --------- 7 files changed, 53 insertions(+), 38 deletions(-) diff --git a/docs/app/css/style.css b/docs/app/css/style.css index 3471fa41528..34481daf7a6 100644 --- a/docs/app/css/style.css +++ b/docs/app/css/style.css @@ -496,7 +496,7 @@ md-content.demo-source-container > hljs > pre > code.highlight { } .dashed-bottom { - border-bottom: dashed 1px rgb(224, 224, 224);; + border-bottom: dashed 1px rgb(224, 224, 224); padding-bottom: 10px; } diff --git a/src/components/button/button.js b/src/components/button/button.js index 157c0e79029..b3adec288ff 100644 --- a/src/components/button/button.js +++ b/src/components/button/button.js @@ -39,13 +39,22 @@ angular.module('material.components.button', [ * @usage * * - * Button + * Flat Button * - * - * I'm a link + * + * Flat link * - * - * I'm a disabled button + * + * Raised Button + * + * + * Disabled Button + * + * + * + * + * + * * * */ diff --git a/src/components/button/button.scss b/src/components/button/button.scss index 084a1498d70..b5218c990d1 100644 --- a/src/components/button/button.scss +++ b/src/components/button/button.scss @@ -1,12 +1,15 @@ -$button-line-height: 25px !default; -$button-padding: 2px 6px 3px !default; +$button-line-height: 2.250rem !default; +$button-padding: 0 0.375rem !default; +$button-margin: 0.375rem 0.500rem !default; // Fab buttons -$button-fab-width: 56px !default; -$button-fab-height: 56px !default; -$button-fab-padding: 16px !default; -$button-fab-mini-width: 40px !default; -$button-fab-mini-height: 40px !default; +$button-fab-width: 3.500rem !default; +$button-fab-height: 3.500rem !default; +$button-fab-line-height: 3.500rem !default; +$button-fab-padding: 1rem !default; +$button-fab-mini-width: 2.500rem !default; +$button-fab-mini-height: 2.500rem !default; +$button-fab-mini-line-height: 2.500rem !default; $button-fab-toast-offset: $button-fab-height * 0.75; @@ -24,6 +27,7 @@ $button-fab-toast-offset: $button-fab-height * 0.75; } .md-button { + box-sizing: border-box; color: currentColor; user-select: none; @@ -31,8 +35,10 @@ $button-fab-toast-offset: $button-fab-height * 0.75; outline: none; border: 0; - padding: 6px; - margin: 0; + display: inline-block; + padding: $button-padding; + margin: $button-margin; + line-height: $button-line-height; background: transparent; white-space: nowrap; @@ -45,7 +51,6 @@ $button-fab-toast-offset: $button-fab-height * 0.75; font-style: inherit; font-variant: inherit; font-family: inherit; - line-height: inherit; text-decoration: none; cursor: pointer; @@ -54,6 +59,11 @@ $button-fab-toast-offset: $button-fab-height * 0.75; transition: box-shadow $swift-ease-out-duration $swift-ease-out-timing-function, background-color $swift-ease-out-duration $swift-ease-out-timing-function; + *, + *:before, + *:after { + box-sizing: border-box; + } &:focus { outline: none; } @@ -94,8 +104,10 @@ $button-fab-toast-offset: $button-fab-height * 0.75; z-index: $z-index-fab; + line-height: $button-fab-line-height; width: $button-fab-width; height: $button-fab-height; + vertical-align: middle; @extend .md-shadow-bottom-z-1; border-radius: 50%; @@ -117,6 +129,7 @@ $button-fab-toast-offset: $button-fab-height * 0.75; } &.md-mini { + line-height: $button-fab-mini-line-height; width: $button-fab-mini-width; height: $button-fab-mini-height; } diff --git a/src/components/button/demoBasicUsage/index.html b/src/components/button/demoBasicUsage/index.html index d8ccf60c110..5318a9076c9 100644 --- a/src/components/button/demoBasicUsage/index.html +++ b/src/components/button/demoBasicUsage/index.html @@ -18,13 +18,13 @@
- + - - - + + + @@ -33,6 +33,14 @@ + + + + + + + +
FAB
diff --git a/src/components/button/demoBasicUsage/style.css b/src/components/button/demoBasicUsage/style.css index 856a03ad04e..25e935418a2 100644 --- a/src/components/button/demoBasicUsage/style.css +++ b/src/components/button/demoBasicUsage/style.css @@ -10,9 +10,8 @@ md-content { margin-right: 7px; } section .md-button { - display: block; - margin: 1em; - line-height: 25px; + margin-top: 16px; + margin-bottom: 16px; } .label { position: absolute; diff --git a/src/components/dialog/dialog.scss b/src/components/dialog/dialog.scss index c7154b14a94..98f9fbf9b42 100644 --- a/src/components/dialog/dialog.scss +++ b/src/components/dialog/dialog.scss @@ -59,6 +59,7 @@ md-dialog { > * { margin-left: 8px; + margin-right: 0; } } &.md-content-overflow .md-actions { diff --git a/src/core/style/mixins.scss b/src/core/style/mixins.scss index 257d1819c8c..9c0348903b6 100644 --- a/src/core/style/mixins.scss +++ b/src/core/style/mixins.scss @@ -31,18 +31,3 @@ } @return $map-str + '}'; } - -@function map-to-string($map) { - $map-str: '{'; - $keys: map-keys($map); - $len: length($keys); - @for $i from 1 through $len { - $key: nth($keys, $i); - $value: map-get($map, $key); - $map-str: $map-str + '_' + $key + '_: _' + map-get($map, $key) + '_'; - @if $i != $len { - $map-str: $map-str + ','; - } - } - @return $map-str + '}'; -}