mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-23 14:01:20 +08:00
idea(button): mockup for buttons
This commit is contained in:
@ -1,5 +1,349 @@
|
||||
// Buttons
|
||||
// -------------------------------
|
||||
|
||||
.button {
|
||||
background: gray;
|
||||
font-weight: bold;
|
||||
$button-color: #222 !default;
|
||||
$button-block-margin: 10px !default;
|
||||
$button-clear-padding: 6px !default;
|
||||
$button-border-radius: 2px !default;
|
||||
$button-border-width: 1px !default;
|
||||
|
||||
$button-font-size: 16px !default;
|
||||
$button-height: 42px !default;
|
||||
$button-padding: 12px !default;
|
||||
$button-icon-size: 24px !default;
|
||||
|
||||
$button-large-font-size: 20px !default;
|
||||
$button-large-height: 54px !default;
|
||||
$button-large-padding: 16px !default;
|
||||
$button-large-icon-size: 32px !default;
|
||||
|
||||
$button-small-font-size: 12px !default;
|
||||
$button-small-height: 28px !default;
|
||||
$button-small-padding: 4px !default;
|
||||
$button-small-icon-size: 16px !default;
|
||||
|
||||
$button-bar-button-font-size: 13px !default;
|
||||
$button-bar-button-height: 32px !default;
|
||||
$button-bar-button-padding: 8px !default;
|
||||
$button-bar-button-icon-size: 20px !default;
|
||||
|
||||
$button-light-bg: $light !default;
|
||||
$button-light-text: #444 !default;
|
||||
$button-light-border: #ddd !default;
|
||||
$button-light-active-bg: #fafafa !default;
|
||||
$button-light-active-border: #ccc !default;
|
||||
|
||||
$button-stable-bg: $stable !default;
|
||||
$button-stable-text: #444 !default;
|
||||
$button-stable-border: #b2b2b2 !default;
|
||||
$button-stable-active-bg: #e5e5e5 !default;
|
||||
$button-stable-active-border: #a2a2a2 !default;
|
||||
|
||||
$button-positive-bg: $positive !default;
|
||||
$button-positive-text: #fff !default;
|
||||
$button-positive-border: darken($positive, 10%) !default;
|
||||
$button-positive-active-bg: darken($positive, 10%) !default;
|
||||
$button-positive-active-border: darken($positive, 10%) !default;
|
||||
|
||||
$button-assertive-bg: $assertive !default;
|
||||
$button-assertive-text: #fff !default;
|
||||
$button-assertive-border: darken($assertive, 10%) !default;
|
||||
$button-assertive-active-bg: darken($assertive, 10%) !default;
|
||||
$button-assertive-active-border: darken($assertive, 10%) !default;
|
||||
|
||||
$button-dark-bg: $dark !default;
|
||||
$button-dark-text: #fff !default;
|
||||
$button-dark-border: #111 !default;
|
||||
$button-dark-active-bg: #262626 !default;
|
||||
$button-dark-active-border: #000 !default;
|
||||
|
||||
$button-default-bg: $button-stable-bg !default;
|
||||
$button-default-text: $button-stable-text !default;
|
||||
$button-default-border: $button-stable-border !default;
|
||||
$button-default-active-bg: $button-stable-active-bg !default;
|
||||
$button-default-active-border: $button-stable-active-border !default;
|
||||
|
||||
// Button Mixins
|
||||
// --------------------------------------------------
|
||||
|
||||
@mixin button-style($bg-color, $border-color, $active-bg-color, $active-border-color, $color) {
|
||||
border-color: $border-color;
|
||||
background-color: $bg-color;
|
||||
color: $color;
|
||||
|
||||
// Give desktop users something to play with
|
||||
&:hover {
|
||||
color: $color;
|
||||
text-decoration: none;
|
||||
}
|
||||
&.active,
|
||||
&.activated {
|
||||
border-color: $active-border-color;
|
||||
background-color: $active-bg-color;
|
||||
box-shadow: inset 0 1px 4px rgba(0,0,0,0.1);
|
||||
}
|
||||
}
|
||||
|
||||
@mixin button-clear($color, $font-size:"") {
|
||||
&.button-clear {
|
||||
border-color: transparent;
|
||||
background: none;
|
||||
box-shadow: none;
|
||||
color: $color;
|
||||
|
||||
@if $font-size != "" {
|
||||
font-size: $font-size;
|
||||
}
|
||||
}
|
||||
&.button-icon {
|
||||
border-color: transparent;
|
||||
background: none;
|
||||
}
|
||||
}
|
||||
|
||||
@mixin button-outline($color, $text-color:"") {
|
||||
&.button-outline {
|
||||
border-color: $color;
|
||||
background: transparent;
|
||||
@if $text-color == "" {
|
||||
$text-color: $color;
|
||||
}
|
||||
color: $text-color;
|
||||
&.active,
|
||||
&.activated {
|
||||
background-color: $color;
|
||||
box-shadow: none;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Buttons
|
||||
* --------------------------------------------------
|
||||
*/
|
||||
|
||||
button {
|
||||
// set the color defaults
|
||||
@include button-style($button-default-bg, $button-default-border, $button-default-active-bg, $button-default-active-border, $button-default-text);
|
||||
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
padding: 0 $button-padding;
|
||||
|
||||
min-width: ($button-padding * 3) + $button-font-size;
|
||||
min-height: $button-height + 5px;
|
||||
|
||||
border-width: $button-border-width;
|
||||
border-style: solid;
|
||||
border-radius: $button-border-radius;
|
||||
|
||||
vertical-align: top;
|
||||
text-align: center;
|
||||
|
||||
text-overflow: ellipsis;
|
||||
font-size: $button-font-size;
|
||||
line-height: $button-height - $button-border-width + 1px;
|
||||
|
||||
cursor: pointer;
|
||||
|
||||
&:after {
|
||||
// used to create a larger button "hit" area
|
||||
position: absolute;
|
||||
top: -6px;
|
||||
right: -6px;
|
||||
bottom: -6px;
|
||||
left: -6px;
|
||||
content: ' ';
|
||||
}
|
||||
|
||||
.icon {
|
||||
vertical-align: top;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.icon:before,
|
||||
&.icon:before,
|
||||
&.icon-left:before,
|
||||
&.icon-right:before {
|
||||
display: inline-block;
|
||||
padding: 0 0 $button-border-width 0;
|
||||
vertical-align: inherit;
|
||||
font-size: $button-icon-size;
|
||||
line-height: $button-height - $button-border-width;
|
||||
pointer-events: none;
|
||||
}
|
||||
&.icon-left:before {
|
||||
float: left;
|
||||
padding-right: .2em;
|
||||
padding-left: 0;
|
||||
}
|
||||
&.icon-right:before {
|
||||
float: right;
|
||||
padding-right: 0;
|
||||
padding-left: .2em;
|
||||
}
|
||||
|
||||
&.button-block, &.button-full {
|
||||
margin-top: $button-block-margin;
|
||||
margin-bottom: $button-block-margin;
|
||||
}
|
||||
|
||||
&[type="primary"] {
|
||||
@include button-style($button-light-bg, $button-light-border, $button-light-active-bg, $button-light-active-border, $button-light-text);
|
||||
@include button-clear($button-light-border);
|
||||
@include button-outline($button-light-border);
|
||||
}
|
||||
|
||||
&[type="secondary"] {
|
||||
@include button-style($button-stable-bg, $button-stable-border, $button-stable-active-bg, $button-stable-active-border, $button-stable-text);
|
||||
@include button-clear($button-stable-border);
|
||||
@include button-outline($button-stable-border);
|
||||
}
|
||||
|
||||
&[type="highlight"] {
|
||||
@include button-style($button-positive-bg, $button-positive-border, $button-positive-active-bg, $button-positive-active-border, $button-positive-text);
|
||||
@include button-clear($button-positive-bg);
|
||||
@include button-outline($button-positive-bg);
|
||||
}
|
||||
|
||||
&[type="exception"] {
|
||||
@include button-style($button-assertive-bg, $button-assertive-border, $button-assertive-active-bg, $button-assertive-active-border, $button-assertive-text);
|
||||
@include button-clear($button-assertive-bg);
|
||||
@include button-outline($button-assertive-bg);
|
||||
}
|
||||
|
||||
&[type="dark"] {
|
||||
@include button-style($button-dark-bg, $button-dark-border, $button-dark-active-bg, $button-dark-active-border, $button-dark-text);
|
||||
@include button-clear($button-dark-bg);
|
||||
@include button-outline($button-dark-bg);
|
||||
}
|
||||
}
|
||||
|
||||
.button-small {
|
||||
padding: 2px $button-small-padding 1px;
|
||||
min-width: $button-small-height;
|
||||
min-height: $button-small-height + 2;
|
||||
font-size: $button-small-font-size;
|
||||
line-height: $button-small-height - $button-border-width - 1;
|
||||
|
||||
.icon:before,
|
||||
&.icon:before,
|
||||
&.icon-left:before,
|
||||
&.icon-right:before {
|
||||
font-size: $button-small-icon-size;
|
||||
line-height: $button-small-icon-size + 3;
|
||||
margin-top: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
.button-large {
|
||||
padding: 0 $button-large-padding;
|
||||
min-width: ($button-large-padding * 3) + $button-large-font-size;
|
||||
min-height: $button-large-height + 5;
|
||||
font-size: $button-large-font-size;
|
||||
line-height: $button-large-height - $button-border-width;
|
||||
|
||||
.icon:before,
|
||||
&.icon:before,
|
||||
&.icon-left:before,
|
||||
&.icon-right:before {
|
||||
padding-bottom: ($button-border-width * 2);
|
||||
font-size: $button-large-icon-size;
|
||||
line-height: $button-large-height - ($button-border-width * 2) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
.button-icon {
|
||||
@include transition(opacity .1s);
|
||||
padding: 0 6px;
|
||||
min-width: initial;
|
||||
border-color: transparent;
|
||||
background: none;
|
||||
|
||||
&.button.active,
|
||||
&.button.activated {
|
||||
border-color: transparent;
|
||||
background: none;
|
||||
box-shadow: none;
|
||||
opacity: 0.3;
|
||||
}
|
||||
|
||||
.icon:before,
|
||||
&.icon:before {
|
||||
font-size: $button-large-icon-size;
|
||||
}
|
||||
}
|
||||
|
||||
.button-clear {
|
||||
@include button-clear($button-default-border);
|
||||
@include transition(opacity .1s);
|
||||
padding: 0 $button-clear-padding;
|
||||
max-height: $button-height;
|
||||
border-color: transparent;
|
||||
background: none;
|
||||
box-shadow: none;
|
||||
|
||||
&.active,
|
||||
&.activated {
|
||||
opacity: 0.3;
|
||||
}
|
||||
}
|
||||
|
||||
.button-outline {
|
||||
@include button-outline($button-default-border);
|
||||
@include transition(opacity .1s);
|
||||
background: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.padding > .button.button-block:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.button-block {
|
||||
display: block;
|
||||
clear: both;
|
||||
|
||||
&:after {
|
||||
clear: both;
|
||||
}
|
||||
}
|
||||
|
||||
.button-full,
|
||||
.button-full > .button {
|
||||
display: block;
|
||||
margin-right: 0;
|
||||
margin-left: 0;
|
||||
border-right-width: 0;
|
||||
border-left-width: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
button.button-block,
|
||||
button.button-full,
|
||||
.button-full > button.button,
|
||||
input.button.button-block {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
a.button {
|
||||
text-decoration: none;
|
||||
|
||||
.icon:before,
|
||||
&.icon:before,
|
||||
&.icon-left:before,
|
||||
&.icon-right:before {
|
||||
margin-top: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.button.disabled,
|
||||
.button[disabled] {
|
||||
opacity: .4;
|
||||
cursor: default !important;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
|
5
src/components/button/examples/index.html
Normal file
5
src/components/button/examples/index.html
Normal file
@ -0,0 +1,5 @@
|
||||
<button type="primary">Primary</button>
|
||||
<button type="secondary">Secondary</button>
|
||||
<button type="highlight">Highlight</button>
|
||||
<button type="exception">Exception</button>
|
||||
<button type="dark">Dark</button>
|
Reference in New Issue
Block a user