diff --git a/CHANGELOG.md b/CHANGELOG.md index a5c03b8..7e4a721 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [1.3.x] - 2019-09-19 +- added border radius variable to button mixin +- added text-transform variable to button mixin +- added border radius to pager mixin +- added optional background icon and colour choise for ratings summary stars (as we needed to have outlines of the stars for unselected state) + + +## [1.3.2] - 2019-08-07 +- removed concatination from `Magento_Catalog/styles/module/_listings.scss` (starting to remove concatination wherever it appears, in favour of css that is meant for a human to read, not a computer) + + +## [1.3.1] - 2019-07-18 +Removed lib-css mixins + ## [Unreleased] ## [1.3.0] - 2019-07-06 @@ -11,3 +25,4 @@ ### Removed - xml decleration that were removed in Magento 2.3 sass blank theme (#208) + diff --git a/Magento_Catalog/styles/module/_listings.scss b/Magento_Catalog/styles/module/_listings.scss index 393fb92..11479b2 100644 --- a/Magento_Catalog/styles/module/_listings.scss +++ b/Magento_Catalog/styles/module/_listings.scss @@ -6,166 +6,161 @@ margin: $indent__l 0; } -.product { - &-items { - @extend .abs-reset-list; - } +.product-items { + @extend .abs-reset-list; +} - &-item { - @extend .abs-add-box-sizing; - vertical-align: top; +.product-item { + @extend .abs-add-box-sizing; + vertical-align: top; - .products-grid & { - display: inline-block; - width: 50%; - } + .products-grid & { + display: inline-block; + width: 50%; + } - &-name { - @extend .abs-product-link; - display: block; - margin: $indent__xs 0; - word-wrap: break-word; - hyphens: auto; - } + .product-item-name { + @extend .abs-product-link; + display: block; + margin: $indent__xs 0; + word-wrap: break-word; + hyphens: auto; + } - &-info { - max-width: 100%; - width: 152px; + .product-item-info { + max-width: 100%; + width: 152px; - .page-products & { - width: 240px; - } + .page-products & { + width: 240px; } + } - &-actions { - display: none; + .product-item-actions { + display: none; - .actions-secondary { - & > .action { - @extend .abs-actions-addto-gridlist; - &:before { - margin: 0; - } + .actions-secondary { + & > .action { + @extend .abs-actions-addto-gridlist; + &:before { + margin: 0; + } - span { - @extend .abs-visually-hidden; - } + span { + @extend .abs-visually-hidden; } } } + } - &-description { - margin: $indent__m 0; - } - - .product-reviews-summary { - .rating-summary { - margin: 0 4px 0 0; - } + .product-item-description { + margin: $indent__m 0; + } - .reviews-actions { - font-size: $font-size__s; - margin-top: 5px; - text-transform: lowercase; - } + .product-reviews-summary { + .rating-summary { + margin: 0 4px 0 0; } - .price-box { - margin: $indent__s 0 $indent__m; - - .price { - font-size: 14px; - font-weight: $font-weight__bold; - white-space: nowrap; - } + .reviews-actions { + font-size: $font-size__s; + margin-top: 5px; + text-transform: lowercase; + } + } - .price-label { - font-size: $font-size__s; + .price-box { + margin: $indent__s 0 $indent__m; - &:after { - content: ':'; - } - } + .price { + font-size: 14px; + font-weight: $font-weight__bold; + white-space: nowrap; } - .special-price, - .minimal-price { - .price { - font-size: 14px; - font-weight: $font-weight__bold; - } + .price-label { + font-size: $font-size__s; - .price-wrapper { - display: inline-block; - } - - .price-including-tax + .price-excluding-tax { - display: block; + &:after { + content: ":"; } } + } - .special-price { - display: block; + .special-price, + .minimal-price { + .price { + font-size: 14px; + font-weight: $font-weight__bold; } - .old-price { - .price { - font-weight: $font-weight__regular; - } + .price-wrapper { + display: inline-block; } - .minimal-price { - .price-container { - display: block; - } + .price-including-tax + .price-excluding-tax { + display: block; } + } - .minimal-price-link { - margin-top: 5px; - - .price-label { - color: $link__color; - font-size: 14px; - } + .special-price { + display: block; + } - .price { - font-weight: $font-weight__regular; - } + .old-price { + .price { + font-weight: $font-weight__regular; } + } - .minimal-price-link, - .price-excluding-tax, - .price-including-tax { + .minimal-price { + .price-container { display: block; - white-space: nowrap; } + } - .price-from, - .price-to { - margin: 0; - } + .minimal-price-link { + margin-top: 5px; - .action.tocompare { - @include lib-icon-font-symbol($icon-compare-empty); + .price-label { + color: $link__color; + font-size: 14px; } - .tocart { - white-space: nowrap; + .price { + font-weight: $font-weight__regular; } } + + .minimal-price-link, + .price-excluding-tax, + .price-including-tax { + display: block; + white-space: nowrap; + } + + .price-from, + .price-to { + margin: 0; + } + + .action.tocompare { + @include lib-icon-font-symbol($icon-compare-empty); + } + + .tocart { + white-space: nowrap; + } } .column.main { - .product { - &-items { - margin-left: -$indent__base; - } - - &-item { - padding-left: $indent__base; - } + .product-items { + margin-left: -$indent__base; } + .product-item { + padding-left: $indent__base; + } } .price-container { @@ -189,43 +184,41 @@ .weee { &:before { - content: '('attr(data-label) ': '; + content: "(" attr(data-label) ": "; } &:after { - content: ')'; + content: ")"; } + .price-excluding-tax { &:before { - content: attr(data-label) ': '; + content: attr(data-label) ": "; } } } } .products-list { - .product { - &-item { - display: table; - width: 100%; + .product-item { + display: table; + width: 100%; + } - &-info { - display: table-row; - } + .product-item-info { + display: table-row; + } - &-photo { - display: table-cell; - padding: 0 $indent__l $indent__l 0; - vertical-align: top; - width: 1%; - } + .product-item-photo { + display: table-cell; + padding: 0 $indent__l $indent__l 0; + vertical-align: top; + width: 1%; + } - &-details { - display: table-cell; - vertical-align: top; - } - } + .product-item-details { + display: table-cell; + vertical-align: top; } .product-image-wrapper { @@ -238,11 +231,10 @@ // _____________________________________________ @include max-screen($screen__s) { - .products-list .product { - &-item { + .products-list { + .product-item { table-layout: fixed; - - &-photo { + .product-item-photo { padding: 0 $indent__s $indent__s 0; width: 30%; } @@ -251,32 +243,30 @@ } @include min-screen($screen__s) { - .product { - &-item { - .products-grid & { - margin-bottom: $indent__l; - } + .product-item { + .products-grid & { + margin-bottom: $indent__l; + } - &-actions { - display: block; + .product-item-actions { + display: block; - .products-grid & { - margin: $indent__s 0; - } + .products-grid & { + margin: $indent__s 0; + } - .actions-primary + .actions-secondary { - display: table-cell; - padding-left: 5px; - white-space: nowrap; - width: 50%; - & > * { - white-space: normal; - } + .actions-primary + .actions-secondary { + display: table-cell; + padding-left: 5px; + white-space: nowrap; + width: 50%; + & > * { + white-space: normal; } + } - .actions-primary { - display: table-cell; - } + .actions-primary { + display: table-cell; } } } diff --git a/composer.json b/composer.json index 41f581d..77f9d5e 100755 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "SASS based version of Magento 2 Blank theme", "license": "MIT", "type": "magento2-theme", - "version": "1.2.3", + "version": "1.2.4", "require": { "magento/framework": "^101.0.0|^102.0.0" }, diff --git a/styles/mixins/_text-crop.scss b/styles/mixins/_text-crop.scss new file mode 100644 index 0000000..1d8894a --- /dev/null +++ b/styles/mixins/_text-crop.scss @@ -0,0 +1,82 @@ +@mixin text-crop( + $line-height: 1.3, + $top-adjustment: 0px, + $bottom-adjustment: 0px +) { + // Configured in Step 1 + $top-crop: 5; + $bottom-crop: 13; + $crop-font-size: 36; + $crop-line-height: 1.2; + + // Apply values to calculate em-based margins that work with any font size + $dynamic-top-crop: max( + ( + $top-crop + ($line-height - $crop-line-height) * + ($crop-font-size / 2) + ), + 0 + ) / $crop-font-size; + $dynamic-bottom-crop: max( + ( + $bottom-crop + ($line-height - $crop-line-height) * + ($crop-font-size / 2) + ), + 0 + ) / $crop-font-size; + + // Mixin output + line-height: $line-height; + + &::before, + &::after { + content: ""; + display: block; + height: 0; + width: 0; + } + + &::before { + margin-bottom: calc(-#{$dynamic-top-crop}em + #{$top-adjustment}); + } + + &::after { + margin-top: calc(-#{$dynamic-bottom-crop}em + #{$bottom-adjustment}); + } +} +// Mixin generated at: http://text-crop.eightshapes.com/? + +/* Usage Examples + .my-level-1-heading-class { + @include text-crop; // Will use default line height of 1.3 + font-size: 48px; + margin: 0 0 0 16px; + } + + .my-level-2-heading-class { + @include text-crop; // Will use default line height of 1.3 + font-size: 32px; // Don't need to change any settings, will work with any font size automatically + margin: 0 0 0 16px; + } + + .my-body-copy-class { + @include text-crop($line-height: 2); // Larger line height desired, set the line height via the mixin + font-size: 16px; + } + + // Sometimes depending on the font-size, the rendering, the browser, etc. you may need to tweak the output. + // You can adjust the top and bottom cropping when invoking the component using the $top-adjustment and $bottom-adjustment settings + + .slight-adjustment-needed { + @include text-crop($top-adjustment: -0.5px, $bottom-adjustment: 2px); + font-size: 17px; + } + + .dont-do-this { + @include text-crop; + font-size: 16px; + line-height: 3; // DO NOT set line height outside of the mixin, the mixin needs the line height value to calculate the crop correctly + } + + http://text-crop.eightshapes.com/?typeface-selection=custom-font&typeface=Lato&custom-typeface-name=BebasNeueBold&custom-typeface-url=http%3A%2F%2Fcustomer-attachatag.sam-attachatag.dev.edge-servers.com%2Fstatic%2Fversion1560172074%2Ffrontend%2Fattachatag%2Fdefault%2Fen_GB%2Ffonts%2FBebasNeue%2FBebasNeueBold.woff2&custom-typeface-weight=400&custom-typeface-style=normal&weight-and-style=100&size=36&line-height=1.2&top-crop=5&bottom-crop=13 +*/ diff --git a/styles/styles.scss b/styles/styles.scss index 73cafaf..c9bc088 100644 --- a/styles/styles.scss +++ b/styles/styles.scss @@ -1,5 +1,6 @@ // Mixins @import "mixins/media-queries"; +@import "mixins/text-crop"; // Vendor libs @import 'vendor/normalize/lib'; // Normalize.css diff --git a/styles/vendor/magento-ui/_buttons.scss b/styles/vendor/magento-ui/_buttons.scss index 6a58c2c..0008209 100644 --- a/styles/vendor/magento-ui/_buttons.scss +++ b/styles/vendor/magento-ui/_buttons.scss @@ -10,6 +10,7 @@ $_button-font-family : $button__font-family, $_button-font-size : $button__font-size, $_button-font-weight : $button__font-weight, + $_button-text-transform : $button__text-transform, $_button-cursor : $button__cursor, $_button-display : $button__display, $_button-disabled-opacity : $button__disabled__opacity, @@ -20,6 +21,7 @@ $_button-color : $button__color, $_button-background : $button__background, $_button-border : $button__border, + $_button-border-radius : $button__border__radius, $_button-color-hover : $button__hover__color, $_button-background-hover : $button__hover__background, @@ -59,6 +61,7 @@ $_button-gradient ); border: $_button-border; + border-radius: $_button-border-radius; color: $_button-color; cursor: $_button-cursor; display: $_button-display; @@ -67,6 +70,7 @@ margin: $_button-margin; padding: $_button-padding; width: $_button-width; + text-transform: $_button-text-transform; @include lib-font-size($_button-font-size); @include lib-line-height($_button-line-height); box-sizing: border-box; diff --git a/styles/vendor/magento-ui/_pages.scss b/styles/vendor/magento-ui/_pages.scss index 35368e4..c583b0b 100644 --- a/styles/vendor/magento-ui/_pages.scss +++ b/styles/vendor/magento-ui/_pages.scss @@ -22,6 +22,7 @@ $_pager-current-color : $pager-current__color, $_pager-current-background : $pager-current__background, $_pager-current-border : $pager-current__border, + $_pager-current-border-radius : $pager-current__border__radius, $_pager-current-gradient : $pager-current__gradient, $_pager-current-gradient-direction : $pager-current__gradient-direction, $_pager-current-gradient-color-start : $pager-current__gradient-color-start, @@ -41,6 +42,7 @@ // Page item - border $_pager-border : $pager__border, + $_pager-border-radius : $pager__border__radius, $_pager-border-visited : $pager__visited__border, $_pager-border-hover : $pager__hover__border, $_pager-border-active : $pager__active__border, @@ -152,6 +154,7 @@ $_pager-gradient ); border: $_pager-border; + border-radius: $_pager-border-radius; color: $_pager-color; display: $_pager-item-display; padding: $_pager-item-padding; @@ -204,6 +207,7 @@ $_pager-current-gradient ); border: $_pager-current-border; + border-radius: $_pager-current-border-radius; @include _lib-pager-inline-block-spaces-item( $_pager-reset-spaces, $_pager-item-display, diff --git a/styles/vendor/magento-ui/_rating.scss b/styles/vendor/magento-ui/_rating.scss index 8f7665f..2c00e25 100644 --- a/styles/vendor/magento-ui/_rating.scss +++ b/styles/vendor/magento-ui/_rating.scss @@ -4,13 +4,14 @@ // Rating-vote mixin @mixin lib-rating-vote( - $_icon-count : $rating-icon__count, - $_icon-content : $rating-icon__content, - $_icon-font : $rating-icon__font, - $_icon-font-size : $rating-icon__font-size, - $_icon-letter-spacing : $rating-icon__letter-spacing, - $_icon-color : $rating-icon__color, - $_icon-color-active : $rating-icon__active__color + $_icon-count: $rating-icon__count, + $_icon-content: $rating-icon__content, + $_icon-background-content: $rating-icon__background-content, + $_icon-font: $rating-icon__font, + $_icon-font-size: $rating-icon__font-size, + $_icon-letter-spacing: $rating-icon__letter-spacing, + $_icon-color: $rating-icon__color, + $_icon-color-active: $rating-icon__active__color ) { overflow: hidden; @@ -21,10 +22,7 @@ $_icon-letter-spacing, $_icon-color ); - @include lib-rating-icons-content( - $_icon-count, - $_icon-content - ); + @include lib-rating-icons-content($_icon-count, $_icon-content); display: block; position: absolute; z-index: 1; @@ -75,29 +73,28 @@ } } - @include _lib-rating-iteration( - $_icon-content, - $_icon-count - ); + @include _lib-rating-iteration($_icon-content, $_icon-count); } // Rating-summary mixin @mixin lib-rating-summary( - $_icon-count : $rating-icon__count, - $_icon-content : $rating-icon__content, - $_icon-font : $rating-icon__font, - $_icon-font-size : $rating-icon__font-size, - $_icon-letter-spacing : $rating-icon__letter-spacing, - $_icon-color : $rating-icon__color, - $_icon-color-active : $rating-icon__active__color, - $_label-hide : $rating-label__hide + $_icon-count: $rating-icon__count, + $_icon-content: $rating-icon__content, + $_icon-background-content: $rating-icon__background-content, + $_icon-font: $rating-icon__font, + $_icon-font-size: $rating-icon__font-size, + $_icon-letter-spacing: $rating-icon__letter-spacing, + $_icon-color: $rating-icon__color, + $_icon-color-active: $rating-icon__active__color, + $_label-hide: $rating-label__hide ) { overflow: hidden; white-space: nowrap; @include _lib-rating-label-hide($_label-hide); .rating-result { - width: ($_icon-font-size * $_icon-count) + ceil($_icon-letter-spacing * ($_icon-count - 1)); + width: ($_icon-font-size * $_icon-count) + + ceil($_icon-letter-spacing * ($_icon-count - 1)); display: inline-block; position: relative; vertical-align: middle; @@ -113,7 +110,7 @@ $_icon-font-size, $_icon-letter-spacing, $_icon-count, - $_icon-content, + $_icon-background-content, $_icon-color ); } @@ -155,10 +152,7 @@ } } -@mixin _lib-rating-iteration( - $_icon-content, - $_icon-count -) { +@mixin _lib-rating-iteration($_icon-content, $_icon-count) { @for $_index from $_icon-count to 0 { .rating-#{$_index} { z-index: $_icon-count - ($_index - 2); @@ -217,7 +211,7 @@ $_icon-content-result: $_icon-content; @for $_index from $_icon-count to 1 { - $_icon-content-result: $_icon-content-result + $_icon-content; + $_icon-content-result: $_icon-content-result + $_icon-content; } content: $_icon-content-result; diff --git a/styles/vendor/magento-ui/variables/_buttons.scss b/styles/vendor/magento-ui/variables/_buttons.scss index c4df732..0bfbf94 100644 --- a/styles/vendor/magento-ui/variables/_buttons.scss +++ b/styles/vendor/magento-ui/variables/_buttons.scss @@ -10,6 +10,7 @@ $button__font-family : $font-family__base !default; $button__font-size : $font-size__base !default; $button__font-weight : $font-weight__bold !default; +$button__text-transform : none !default; $button__line-height : $font-size__base + 2 !default; $button__margin : 0 !default; $button__padding : 7px 15px !default; // is set up to null when buttons don't depend on side paddings or have fixed width @@ -18,7 +19,7 @@ $button__width : null !default; // is set up to n // Display settings $button__display : inline-block !default; $button__cursor : pointer !default; -$button__border-radius : 3px !default; +$button__border__radius : 3px !default; $button__disabled__opacity : 0.5 !default; diff --git a/styles/vendor/magento-ui/variables/_pages.scss b/styles/vendor/magento-ui/variables/_pages.scss index 52fc871..7a8af62 100644 --- a/styles/vendor/magento-ui/variables/_pages.scss +++ b/styles/vendor/magento-ui/variables/_pages.scss @@ -19,6 +19,7 @@ $pager-actions__padding : 0 !default; $pager-current__font-weight : $font-weight__bold !default; $pager-current__color : $primary__color !default; $pager-current__border : null !default; +$pager-current__border__radius : null !default; $pager-current__background : null !default; $pager-current__gradient : null !default; $pager-current__gradient-direction : null !default; @@ -32,6 +33,7 @@ $pager__gradient-direction : null !default; // Pager link default $pager__color : $link__color !default; $pager__border : null !default; +$pager__border__radius : null !default; $pager__text-decoration : none !default; $pager__background : null !default; $pager__gradient-color-start : null !default; diff --git a/styles/vendor/magento-ui/variables/_rating.scss b/styles/vendor/magento-ui/variables/_rating.scss index c22a545..33c5b4d 100644 --- a/styles/vendor/magento-ui/variables/_rating.scss +++ b/styles/vendor/magento-ui/variables/_rating.scss @@ -2,13 +2,14 @@ // Rating variables // _____________________________________________ -$rating-icon__count : 5 !default; -$rating-icon__content : $icon-star !default; -$rating-icon__font : $icon-font !default; -$rating-icon__font-size : 28px !default; -$rating-icon__letter-spacing : -10px !default; -$rating-icon__color : $color-gray78 !default; +$rating-icon__count : 5 !default; +$rating-icon__content : $icon-star !default; +$rating-icon__background-content : $rating-icon__content !default; +$rating-icon__font : $icon-font !default; +$rating-icon__font-size : 28px !default; +$rating-icon__letter-spacing : -10px !default; +$rating-icon__color : $color-gray78 !default; -$rating-icon__active__color : $color-orange-red1 !default; +$rating-icon__active__color : $color-orange-red1 !default; -$rating-label__hide : null !default; +$rating-label__hide : null !default;