mirror of
https://github.com/pebble-dev/clay.git
synced 2026-09-03 23:57:43 -04:00
Add generic button component
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 124 KiB |
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
name: 'button',
|
||||
template: require('../../templates/components/button.tpl'),
|
||||
style: require('../../styles/clay/components/button.scss'),
|
||||
manipulator: 'button',
|
||||
defaults: {
|
||||
primary: false,
|
||||
attributes: {},
|
||||
description: ''
|
||||
}
|
||||
};
|
||||
@@ -10,5 +10,6 @@ module.exports = {
|
||||
text: require('./text'),
|
||||
toggle: require('./toggle'),
|
||||
radiogroup: require('./radiogroup'),
|
||||
checkboxgroup: require('./checkboxgroup')
|
||||
checkboxgroup: require('./checkboxgroup'),
|
||||
button: require('./button')
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@ module.exports = {
|
||||
name: 'submit',
|
||||
template: require('../../templates/components/submit.tpl'),
|
||||
style: require('../../styles/clay/components/submit.scss'),
|
||||
manipulator: 'html',
|
||||
manipulator: 'button',
|
||||
defaults: {
|
||||
attributes: {}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,19 @@ module.exports = {
|
||||
hide: hide,
|
||||
show: show
|
||||
},
|
||||
button: {
|
||||
get: function() {
|
||||
return this.$manipulatorTarget.get('innerHTML');
|
||||
},
|
||||
set: function(value) {
|
||||
this.$manipulatorTarget.set('innerHTML', value);
|
||||
return this.trigger('change');
|
||||
},
|
||||
disable: disable,
|
||||
enable: enable,
|
||||
hide: hide,
|
||||
show: show
|
||||
},
|
||||
val: {
|
||||
get: function() {
|
||||
return this.$manipulatorTarget.get('value');
|
||||
|
||||
@@ -183,6 +183,7 @@ label {
|
||||
padding: 0 $item-spacing-h $item-spacing-v ;
|
||||
@include font-size(0.9);
|
||||
color: $color-gray-9;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.inputs {
|
||||
|
||||
@@ -34,7 +34,7 @@ $color-gray-9: #a4a4a4 ;
|
||||
$color-gray-10: #ececec;
|
||||
$color-gray-11: #f2f2f2;
|
||||
|
||||
$button-padding: 0.7rem;
|
||||
$button-padding-ios: 0.6rem;
|
||||
$button-padding: 0.6rem;
|
||||
$button-padding-ios: 0.5rem;
|
||||
|
||||
$box-shadow-small-components: $color-gray-1 0 0.1rem 0.1rem;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
.component-button {
|
||||
text-align: center;
|
||||
|
||||
.section & {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.description {
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
}
|
||||
}
|
||||
@@ -3,52 +3,30 @@
|
||||
button,
|
||||
.button {
|
||||
@include font-pfdin(medium);
|
||||
@include font-size(1);
|
||||
text-transform: uppercase;
|
||||
background-color: $color-gray-4;
|
||||
background-color: $color-gray-7;
|
||||
border-radius: $border-radius;
|
||||
font-size: 1rem;
|
||||
line-height: 1;
|
||||
border: none;
|
||||
display: inline-block;
|
||||
|
||||
color: $color-white;
|
||||
min-width: 12rem;
|
||||
text-align: center;
|
||||
margin: 0 auto;
|
||||
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
||||
|
||||
margin: 0 auto $item-spacing-v;
|
||||
padding: $button-padding;
|
||||
|
||||
@include tap-highlight($color-gray-8);
|
||||
|
||||
.platform-ios & {
|
||||
padding: $button-padding-ios;
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
background-color: $color-gray-3;
|
||||
color: $color-gray-8;
|
||||
}
|
||||
|
||||
&:not(:disabled):active {
|
||||
background-color: $color-gray-8;
|
||||
}
|
||||
|
||||
&.orange, &[type="submit"] {
|
||||
&.primary, &[type="submit"] {
|
||||
background-color: $color-orange;
|
||||
|
||||
&:disabled {
|
||||
background-color: $color-orange-dark;
|
||||
color: $color-gray-3;
|
||||
}
|
||||
|
||||
&:not(:disabled):active {
|
||||
background-color: $color-red;
|
||||
}
|
||||
@include tap-highlight($color-red);
|
||||
}
|
||||
|
||||
&.light-grey {
|
||||
background-color: $color-gray-5;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
a.button {
|
||||
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
<div class="component component-button">
|
||||
<button
|
||||
type="button"
|
||||
data-manipulator-target
|
||||
class="{{primary ? 'primary' : ''}}"
|
||||
{{each key: attributes}}{{key}}="{{this}}"{{/each}}
|
||||
></button>
|
||||
{{if description}}
|
||||
<div class="description">{{{description}}}</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
Reference in New Issue
Block a user