From 503abf5225c6926c7e2e80e876cd87b521071c91 Mon Sep 17 00:00:00 2001 From: Brandy Carney Date: Mon, 16 Nov 2015 15:51:01 -0500 Subject: [PATCH] refactor(item): moved iOS styling from the list file to the item file references #387 --- ionic/components/item/item.scss | 2 +- ionic/components/item/modes/ios.scss | 108 +++++++++++++++++++++++++- ionic/components/list/modes/ios.scss | 112 +-------------------------- 3 files changed, 111 insertions(+), 111 deletions(-) diff --git a/ionic/components/item/item.scss b/ionic/components/item/item.scss index 9ce65209c1..ad2822a028 100644 --- a/ionic/components/item/item.scss +++ b/ionic/components/item/item.scss @@ -55,7 +55,7 @@ } a.item, -button.item.item { +button.item { margin: 0; padding: 0; width: 100%; diff --git a/ionic/components/item/modes/ios.scss b/ionic/components/item/modes/ios.scss index c8a78d40c9..6913705139 100644 --- a/ionic/components/item/modes/ios.scss +++ b/ionic/components/item/modes/ios.scss @@ -29,7 +29,6 @@ $item-ios-divider-padding: 5px 15px !default; $item-ios-sliding-content-bg: $background-color !default; $item-ios-sliding-transition: transform 250ms ease-in-out !default; - .item-group-title { padding: $item-ios-padding-top $item-ios-padding-right $item-ios-padding-bottom $item-ios-padding-left; background-color: $item-ios-divider-bg; @@ -52,6 +51,12 @@ ion-note { } } +.item { + border-radius: 0; + padding-left: $item-ios-padding-left; + font-size: $item-ios-font-size; +} + .item.activated, a.item.activated, button.item.activated { @@ -64,3 +69,104 @@ a.item, button.item { transition-duration: 200ms; } + +.item-inner { + padding-right: ($item-ios-padding-right / 2); + border-bottom: 1px solid $item-ios-border-color; +} + +ion-item-content { + margin: $item-ios-padding-top ($item-ios-padding-right / 2) $item-ios-padding-bottom 0; +} + +// TODO clean up Sass variables +[item-left] { + margin: ($item-ios-padding-top / 2) $item-ios-padding-right ($item-ios-padding-bottom / 2) 0; +} + +[item-right] { + margin: ($item-ios-padding-top / 2) ($item-ios-padding-right / 2) ($item-ios-padding-bottom / 2) ($item-ios-padding-left / 2); +} + +icon[item-left], +icon[item-right] { + margin-top: $item-ios-padding-icon-top; + margin-bottom: $item-ios-padding-icon-bottom; +} + +ion-avatar[item-left], +ion-thumbnail[item-left] { + margin: ($item-ios-padding-right / 2) $item-ios-padding-right ($item-ios-padding-right / 2) 0; +} + +ion-avatar[item-right], +ion-thumbnail[item-right] { + margin: ($item-ios-padding-right / 2); +} + +button[item-left], +button[item-right], +[button][item-left], +[button][item-right] { + padding: 0 0.5em; + font-size: 1.3rem; + min-height: 25px; + margin-top: 9px; +} + +[item-left].icon-only, +[item-right].icon-only, +[item-left].icon-only icon, +[item-right].icon-only icon, +[item-left][clear], +[item-right][clear] { + padding: 0 1px; +} + +[item-left].icon-left icon, +[item-right].icon-left icon { + margin-left: 0; + margin-bottom: 1px; + padding-right: 0.3em; +} + +[item-left].icon-right icon, +[item-right].icon-right icon { + margin-right: 0; + margin-bottom: 1px; +} + +ion-avatar { + min-width: $item-ios-avatar-size; + min-height: $item-ios-avatar-size; + + img { + max-width: $item-ios-avatar-size; + max-height: $item-ios-avatar-size; + border-radius: $item-ios-avatar-size / 2; + } +} + +ion-thumbnail { + min-width: $item-ios-thumbnail-size; + min-height: $item-ios-thumbnail-size; + + img { + max-width: $item-ios-thumbnail-size; + max-height: $item-ios-thumbnail-size; + } +} + +button.item:not([detail-none]) .item-inner, +a.item:not([detail-none]) .item-inner, +.item[detail-push] .item-inner { + @include ios-detail-push-icon($item-ios-detail-push-color); + background-repeat: no-repeat; + background-position: right ($item-ios-padding-right - 2) center; + background-size: 14px 14px; + padding-right: 32px; +} + +&.hairlines .item-inner { + border-bottom-width: 0.55px; +} diff --git a/ionic/components/list/modes/ios.scss b/ionic/components/list/modes/ios.scss index fde73e9679..6016fedefe 100644 --- a/ionic/components/list/modes/ios.scss +++ b/ionic/components/list/modes/ios.scss @@ -38,17 +38,10 @@ $list-ios-header-color: #333 !default; } ion-header, - ion-item-group-title , { + ion-item-group-title { border-bottom: 1px solid $item-ios-border-color; } - .item { - border-radius: 0; - // TODO this makes the border not show on sticky - padding-left: $item-ios-padding-left; - font-size: $item-ios-font-size; - } - > .item:first-child { border-top: 1px solid $item-ios-border-color; } @@ -62,16 +55,8 @@ $list-ios-header-color: #333 !default; } } - .item { - - .item-inner { - padding-right: ($item-ios-padding-right / 2); - border-bottom: 1px solid $item-ios-border-color; - } - - ion-item-content { - margin: $item-ios-padding-top ($item-ios-padding-right / 2) $item-ios-padding-bottom 0; - } + .item-inner { + border-bottom: 1px solid $item-ios-border-color; } // If the item has the no-lines attribute remove the bottom border from: @@ -82,84 +67,6 @@ $list-ios-header-color: #333 !default; border-width: 0; } - [item-left] { - margin: ($item-ios-padding-top / 2) $item-ios-padding-right ($item-ios-padding-bottom / 2) 0; - } - - [item-right] { - margin: ($item-ios-padding-top / 2) ($item-ios-padding-right / 2) ($item-ios-padding-bottom / 2) ($item-ios-padding-left / 2); - } - - // TODO clean up Sass variables - icon[item-left], - icon[item-right] { - margin-top: $item-ios-padding-icon-top; - margin-bottom: $item-ios-padding-icon-bottom; - } - - ion-avatar[item-left], - ion-thumbnail[item-left] { - margin: ($item-ios-padding-right / 2) $item-ios-padding-right ($item-ios-padding-right / 2) 0; - } - - ion-avatar[item-right], - ion-thumbnail[item-right] { - margin: ($item-ios-padding-right / 2); - } - - button[item-left], - button[item-right], - [button][item-left], - [button][item-right] { - padding: 0 0.5em; - font-size: 1.3rem; - min-height: 25px; - margin-top: 9px; - } - - [item-left].icon-only, - [item-right].icon-only, - [item-left].icon-only icon, - [item-right].icon-only icon, - [item-left][clear], - [item-right][clear] { - padding: 0 1px; - } - - [item-left].icon-left icon, - [item-right].icon-left icon { - margin-left: 0; - margin-bottom: 1px; - padding-right: 0.3em; - } - - [item-left].icon-right icon, - [item-right].icon-right icon { - margin-right: 0; - margin-bottom: 1px; - } - - ion-avatar { - min-width: $item-ios-avatar-size; - min-height: $item-ios-avatar-size; - - img { - max-width: $item-ios-avatar-size; - max-height: $item-ios-avatar-size; - border-radius: $item-ios-avatar-size / 2; - } - } - - ion-thumbnail { - min-width: $item-ios-thumbnail-size; - min-height: $item-ios-thumbnail-size; - - img { - max-width: $item-ios-thumbnail-size; - max-height: $item-ios-thumbnail-size; - } - } - ion-item-options { border-bottom: 1px solid $item-ios-border-color; @@ -181,19 +88,6 @@ $list-ios-header-color: #333 !default; } } -.list, -ion-card { - button.item:not([detail-none]) .item-inner, - a.item:not([detail-none]) .item-inner, - .item[detail-push] .item-inner { - @include ios-detail-push-icon($item-ios-detail-push-color); - background-repeat: no-repeat; - background-position: right ($item-ios-padding-right - 2) center; - background-size: 14px 14px; - padding-right: 32px; - } -} - .list + .list { margin-top: $list-ios-margin-top + $list-ios-margin-bottom;