aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Wright <martin@mynameismartin.com>2015-08-06 11:06:21 +0100
committerGareth Rees <gareth@mysociety.org>2015-08-21 11:03:26 +0100
commitdce870b62ad381ef7cd7327b2d37c4c69ff28d86 (patch)
tree796b14eae4a69e584eceedc54cf11d2482d7e8c3
parentc92c4245a18136dba5d5fc34706e11504f41c7d9 (diff)
buttons are now built with mixins, rather than extends
Remove all button utlity classes
-rw-r--r--assets/stylesheets/responsive/custom.scss109
1 files changed, 52 insertions, 57 deletions
diff --git a/assets/stylesheets/responsive/custom.scss b/assets/stylesheets/responsive/custom.scss
index 971e6c8..8bc6b21 100644
--- a/assets/stylesheets/responsive/custom.scss
+++ b/assets/stylesheets/responsive/custom.scss
@@ -122,93 +122,88 @@ input.use-datepicker[type=text] {
}
/* Button styles */
-.button-base {
- padding: 0.5em 1.25em;
- border-radius: 3px;
- display: inline-block;
- font-weight: 600;
+
+@mixin button-base($size: normal, $disabled: false) {
+ padding: 0.5em 1.25em;
+ border-radius: 3px;
+ display: inline-block;
+ font-weight: 600;
+ text-decoration: none;
+ transition: background-color 300ms ease-out;
+ margin-bottom: 0;
+ font-family: $font-family;
+ @if $size == large {
+ font-size: 2.2em;
+ }
+ &:hover,
+ &:active,
+ &:focus {
text-decoration: none;
transition: background-color 300ms ease-out;
- margin-bottom: 0;
- font-family: $font-family;
+ }
+ @if $disabled {
+ opacity: 0.333;
&:hover,
&:active,
&:focus {
- text-decoration: none;
- transition: background-color 300ms ease-out;
+ background-color: inherit;
+ color: inherit;
+ cursor: default;
}
+ }
}
-a.button,
-.button,
-.button:visited {
- @extend .button-base;
- color: #fff;
- background-color: $button-bg;
- border: none;
- &:hover,
- &:active,
- &:focus,
- &:visited:hover,
- &:visited:active,
- &:visited:focus {
- background-color: darken($button-bg, 10%);
- color: #fff;
- }
+@mixin button-primary($args...) {
+ @include button-base($args...);
+ color: #fff;
+ background-color: $button-bg;
+ border: none;
+ &:hover,
+ &:active,
+ &:focus,
+ &:visited:hover,
+ &:visited:active,
+ &:visited:focus {
+ background-color: darken($button-bg, 10%);
+ color: #fff;
+ }
}
-a.button-secondary,
-.button-secondary,
-.button-secondary:visited {
- @extend .button-base;
+@mixin button-secondary($args...) {
+ @include button-base($args...);
background-color: $color_light_grey;
color: $color_black;
font-weight: normal;
&:hover,
&:active,
&:focus {
- color: #333;
- background-color: darken($color_light_grey, 7.5%);
- color: $color_black;
- }
-}
-
-.button-tertiary {
- @extend .button-base;
- background-color: transparent;
- color: #333;
- font-weight: normal;
- border: 1px solid #e9e9e9;
- &:hover,
- &:active,
- &:focus {
- background-color: darken(#edece8, 7.5%);
- border: 1px solid #ddd;
+ color: #333;
+ background-color: darken($color_light_grey, 7.5%);
+ color: $color_black;
}
}
-.button-large {
- font-size: 2.2em;
-}
-
-.button-disabled {
- opacity: 0.333;
+@mixin button-tertiary($args...) {
+ @include button-base($args...);
+ background-color: transparent;
+ color: #333;
+ font-weight: normal;
+ border: 1px solid #e9e9e9;
&:hover,
&:active,
&:focus {
- background-color: inherit;
- color: inherit;
+ background-color: darken(#edece8, 7.5%);
+ border: 1px solid #ddd;
}
}
form input[type=submit], a.link_button_green, a.link_button_green_large {
- @extend .button;
+ @include button-primary;
text-decoration: none;
}
a.link_button_green_large {
- @extend .button;
- @extend .button-large;
+ @include button-primary($size: large);
}
/* Popups */