Skip to content

Commit

Permalink
fix(checkbox): add ability to align checkboxes to the right
Browse files Browse the repository at this point in the history
closes #5925
  • Loading branch information
brandyscarney committed May 4, 2016
1 parent 4c5dd0b commit e075ccd
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 8 deletions.
10 changes: 7 additions & 3 deletions ionic/components/checkbox/checkbox.ios.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ $checkbox-ios-icon-checkmark-width: 1px !default;
$checkbox-ios-icon-checkmark-style: solid !default;
$checkbox-ios-icon-checkmark-color: color-contrast($colors-ios, $checkbox-ios-background-color-on) !default;

$checkbox-ios-media-margin: $item-ios-padding-media-top $item-ios-padding-right $item-ios-padding-media-bottom 2px !default;

$checkbox-ios-disabled-opacity: .3 !default;

$checkbox-ios-item-left-margin: $item-ios-padding-media-top $item-ios-padding-right $item-ios-padding-media-bottom 2px !default;
$checkbox-ios-item-right-margin: 10px 8px 9px 0 !default;

ion-checkbox {
position: relative;
Expand Down Expand Up @@ -92,7 +92,11 @@ ion-checkbox {
position: static;
display: block;

margin: $checkbox-ios-media-margin;
margin: $checkbox-ios-item-left-margin;

&[item-right] {
margin: $checkbox-ios-item-right-margin;
}
}


Expand Down
10 changes: 8 additions & 2 deletions ionic/components/checkbox/checkbox.md.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ $checkbox-md-border-bottom-style: solid !default;
$checkbox-md-border-bottom-color: $list-md-border-color !default;
$checkbox-md-padding: $item-md-padding-top ($item-md-padding-right / 2) $item-md-padding-bottom 0 !default;
$checkbox-md-margin: 0 !default;
$checkbox-md-media-margin: $item-md-padding-media-top 36px $item-md-padding-media-bottom 4px !default;
$checkbox-md-disabled-opacity: .3 !default;

$checkbox-md-icon-background-color-off: $list-md-background-color !default;
Expand All @@ -28,6 +27,9 @@ $checkbox-md-icon-border-color-on: color($colors-md, primary) !default;
$checkbox-md-transition-duration: 280ms !default;
$checkbox-md-transition-easing: cubic-bezier(.4, 0, .2, 1) !default;

$checkbox-md-item-left-margin: $item-md-padding-media-top 36px $item-md-padding-media-bottom 4px !default;
$checkbox-md-item-right-margin: 11px 10px 10px 0 !default;


ion-checkbox {
position: relative;
Expand Down Expand Up @@ -103,7 +105,11 @@ ion-checkbox {
position: static;
display: block;

margin: $checkbox-md-media-margin;
margin: $checkbox-md-item-left-margin;

&[item-right] {
margin: $checkbox-md-item-right-margin;
}
}

ion-checkbox + .item-inner ion-label {
Expand Down
10 changes: 8 additions & 2 deletions ionic/components/checkbox/checkbox.wp.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ $checkbox-wp-border-bottom-style: solid !default;
$checkbox-wp-border-bottom-color: $list-wp-border-color !default;
$checkbox-wp-padding: $item-wp-padding-top ($item-wp-padding-right / 2) $item-wp-padding-bottom 0 !default;
$checkbox-wp-margin: 0 !default;
$checkbox-wp-media-margin: $item-wp-padding-media-top $item-wp-padding-right $item-wp-padding-media-bottom 4px !default;
$checkbox-wp-disabled-opacity: .3 !default;

$checkbox-wp-icon-background-color-off: $list-wp-background-color !default;
Expand All @@ -25,6 +24,9 @@ $checkbox-wp-icon-border-radius: 0 !default;
$checkbox-wp-icon-border-color-off: #333 !default;
$checkbox-wp-icon-border-color-on: color($colors-wp, primary) !default;

$checkbox-wp-item-left-margin: $item-wp-padding-media-top $item-wp-padding-right $item-wp-padding-media-bottom 4px !default;
$checkbox-wp-item-right-margin: 11px 10px 10px 0 !default;


ion-checkbox {
position: relative;
Expand Down Expand Up @@ -96,7 +98,11 @@ ion-checkbox {
position: static;
display: block;

margin: $checkbox-wp-media-margin;
margin: $checkbox-wp-item-left-margin;

&[item-right] {
margin: $checkbox-wp-item-right-margin;
}
}

ion-checkbox + .item-inner ion-label {
Expand Down
15 changes: 15 additions & 0 deletions ionic/components/checkbox/test/basic/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@
<ion-checkbox light (change)="strawberryChange($event)" [checked]="true"></ion-checkbox>
</ion-item>

<ion-item>
<ion-label>Checkbox right, checked, really long text that should ellipsis</ion-label>
<ion-checkbox item-right danger checked></ion-checkbox>
</ion-item>

<button ion-item detail-none>
<ion-label>Checkbox right side</ion-label>
<ion-checkbox item-right checked></ion-checkbox>
</button>

<button ion-item detail-none>
Button w/ right side default icon, really long text that should ellipsis
<ion-icon name="information-circle" item-right></ion-icon>
</button>

</ion-list>

</form>
Expand Down
2 changes: 1 addition & 1 deletion ionic/components/item/item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import {Label} from '../label/label';
@Component({
selector: 'ion-item,[ion-item]',
template:
'<ng-content select="[item-left],ion-checkbox"></ng-content>' +
'<ng-content select="[item-left],ion-checkbox:not([item-right])"></ng-content>' +
'<div class="item-inner">' +
'<div class="input-wrapper">' +
'<ng-content select="ion-label"></ng-content>' +
Expand Down

0 comments on commit e075ccd

Please sign in to comment.