Skip to content

Commit

Permalink
Merge pull request #555 from wpmudev/new/SUI-587
Browse files Browse the repository at this point in the history
✨ new(summary): summary image size issue.
  • Loading branch information
emgk authored Oct 18, 2023
2 parents ee56d9e + e4dd1aa commit 2839ac2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 89 deletions.
93 changes: 13 additions & 80 deletions assets/scss/shared-ui/_summary.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// Summary: Base styles.
// $wrap: true | $rtl: false | $monochrome: false
@include body-class(true, false) {

.sui-summary {
padding: math.div($sui-gutter-md, 2) $sui-gutter-md;

Expand All @@ -21,9 +20,9 @@
display: none;

@include media(min-width, md) {
min-width: #{$summary-image--width + $sui-gutter};
min-height: $summary-size;
flex: 0 0 #{$summary-image--width + $sui-gutter};
min-width: $summary-size-width;
min-height: $summary-size-height;
flex: 0 0 $summary-size-width;
}
}

Expand All @@ -32,37 +31,31 @@
display: block;

.sui-list {

@include media(min-width, md) {
padding-right: math.div($sui-gutter, 2);
padding-left: math.div($sui-gutter, 2);
}
}

.sui-summary-details {

@include media(min-width, md) {
padding-right: $sui-gutter;
padding-left: $sui-gutter;
}
}

&:first-child {

.sui-list,
.sui-summary-details {

@include media(min-width, md) {
padding-left: 0;
}
}
}

&:last-child {

.sui-list,
.sui-summary-details {

@include media(min-width, md) {
padding-right: 0;
}
Expand Down Expand Up @@ -119,7 +112,6 @@
line-height: 55px;

+ .sui-summary-sub {

@include media(min-width, md) {
margin-top: -1px;
}
Expand Down Expand Up @@ -175,7 +167,6 @@

// ELEMENT: List of data
.sui-list {

li span {
white-space: normal;
}
Expand All @@ -188,10 +179,8 @@

// SIZE: Small
&.sui-summary-sm {

// ELEMENT: Image
.sui-summary-image-space {

@include media(min-width, md) {
min-width: #{$summary-image-sm--width + $sui-gutter};
min-height: $summary-size-sm;
Expand All @@ -203,18 +192,13 @@
// VARIATION: Branded
// When box is using white labelling settings from WPMU DEV Dashboard.
&:not(.sui-unbranded) {

// SIZE: Regular
&:not(.sui-summary-sm) {

// ELEMENT: Image
.sui-summary-image-space {

@include media(min-width, md) {

@if variable-exists(summary-image) {

@if $summary-image != '' {
@if $summary-image != "" {
display: block;
}
}
Expand All @@ -226,16 +210,11 @@
// in case summary-image variable doesn't exist or
// variable is empty.
@if variable-exists(summary-image) {

@if $summary-image == '' {

@if $summary-image == "" {
.sui-summary-image-space {

&:first-child + .sui-summary-segment {

.sui-list,
.sui-summary-details {

@include media(min-width, md) {
padding-left: 0;
}
Expand All @@ -244,14 +223,10 @@
}
}
} @else {

.sui-summary-image-space {

&:first-child + .sui-summary-segment {

.sui-list,
.sui-summary-details {

@include media(min-width, md) {
padding-left: 0;
}
Expand All @@ -261,12 +236,11 @@
}

&:not(.sui-rebranded) {

@include media(min-width, md) {

@if variable-exists(summary-image) {
background-image: url($summary-image);
background-size: $summary-image--width $summary-image--height;
background-size: $summary-image--width
$summary-image--height;
background-position: $summary-image--position;
background-repeat: no-repeat;
}
Expand All @@ -276,15 +250,11 @@

// SIZE: Small
&.sui-summary-sm {

// ELEMENT: Image
.sui-summary-image-space {

@include media(min-width, md) {

@if variable-exists(summary-image-sm) {

@if $summary-image-sm != '' {
@if $summary-image-sm != "" {
display: block;
}
}
Expand All @@ -296,16 +266,11 @@
// in case summary-image-sm variable doesn't exist or
// variable is empty.
@if variable-exists(summary-image-sm) {

@if $summary-image-sm == '' {

@if $summary-image-sm == "" {
.sui-summary-image-space {

&:first-child + .sui-summary-segment {

.sui-list,
.sui-summary-details {

@include media(min-width, md) {
padding-left: 0;
}
Expand All @@ -314,14 +279,10 @@
}
}
} @else {

.sui-summary-image-space {

&:first-child + .sui-summary-segment {

.sui-list,
.sui-summary-details {

@include media(min-width, md) {
padding-left: 0;
}
Expand All @@ -331,12 +292,11 @@
}

&:not(.sui-rebranded) {

@include media(min-width, md) {

@if variable-exists(summary-image-sm) {
background-image: url($summary-image-sm);
background-size: $summary-image-sm--width $summary-image-sm--height;
background-size: $summary-image-sm--width
$summary-image-sm--height;
background-position: $summary-image-sm--position;
background-repeat: no-repeat;
}
Expand All @@ -349,25 +309,19 @@
// When box is using white labelling settings from WPMU DEV Dashboard
// but no image has been added.
&.sui-unbranded {

.sui-summary-image-space {

&:first-child + .sui-summary-segment {

.sui-list,
.sui-summary-details {

@include media(min-width, md) {
padding-left: 0;
}
}
}

@include media(min-width, md) {

@if variable-exists(summary-image) {

@if $summary-image != '' {
@if $summary-image != "" {
display: none;
}
}
Expand All @@ -379,14 +333,10 @@
// When box is using white labelling settings from WPMU DEV Dashboard
// and an image has been assigned by user.
&.sui-rebranded {

// SIZE: Regular
&:not(.sui-summary-sm) {

.sui-summary-image-space {

@include media(min-width, md) {

@if variable-exists(summary-image) {
background-size: contain;
background-position: center;
Expand All @@ -398,11 +348,8 @@

// SIZE: Small
&.sui-summary-sm {

.sui-summary-image-space {

@include media(min-width, md) {

@if variable-exists(summary-image-sm) {
background-size: contain;
background-position: center;
Expand All @@ -424,17 +371,12 @@
// Summary: RTL styles.
// $wrap: true | $rtl: true | $monochrome: false
@include body-class(true, true) {

.sui-summary {

// ELEMENT: Content
.sui-summary-segment {

&:first-child {

.sui-list,
.sui-summary-details {

@include media(min-width, md) {
padding-right: 0;
padding-left: math.div($sui-gutter, 2);
Expand All @@ -443,10 +385,8 @@
}

&:last-child {

.sui-list,
.sui-summary-details {

@include media(min-width, md) {
padding-right: math.div($sui-gutter, 2);
padding-left: 0;
Expand Down Expand Up @@ -477,12 +417,9 @@
// VARIATION: Branded
// When box is using white labelling settings from WPMU DEV Dashboard.
&:not(.sui-unbranded) {

// SIZE: Regular
&:not(.sui-summary-sm) {

@include media(min-width, md) {

@if variable-exists(summary-image) {
background-position: right $summary-image--position;
}
Expand All @@ -491,9 +428,7 @@

// SIZE: Small
&.sui-summary-sm {

@include media(min-width, md) {

@if variable-exists(summary-image-sm) {
background-position: right $summary-image-sm--position;
}
Expand All @@ -506,9 +441,7 @@
// Summary: Monochrome styles for color accessibility.
// $wrap: true | $rtl: false | $monochrome: true
@include body-class(true, false, true) {

.sui-summary {

.sui-summary-details {
color: $accessible-dark;

Expand All @@ -517,4 +450,4 @@
}
}
}
}
}
20 changes: 11 additions & 9 deletions assets/scss/shared-ui/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,24 @@ $sui-breakpoints: (
// Summary

// SIZE: Regular
$summary-size: 212px !default;
$summary-size-width: 222px !default;
$summary-size-height: 212px !default;

$summary-image--width: 192px !default;
$summary-image--height: 182px !default;
$summary-image--width: 96px !default;
$summary-image--height: 96px !default;

$summary-image--position-x: 30px !default;
$summary-image--position-y: bottom !default;
$summary-image--position-x: 80px !default;
$summary-image--position-y: center !default;
$summary-image--position: $summary-image--position-x $summary-image--position-y !default;

// SIZE: Small
$summary-size-sm: 151px !default;

$summary-image-sm--width: 192px !default;
$summary-image-sm--height: 121px !default;
$summary-image-sm--width: 96px !default;
$summary-image-sm--height: 96px !default;

$summary-image-sm--position-x: 30px !default;
$summary-image-sm--position-y: bottom !default;
$summary-image-sm--position-y: center !default;
$summary-image-sm--position: $summary-image-sm--position-x
$summary-image-sm--position-y !default;

Expand Down Expand Up @@ -216,7 +217,8 @@ $box-selector-vertical--icon-spacing: 7px !default;
$box-selector-vertical--padding-bottom: #{$box-selector-vertical--height -
(
$box-selector--line-height + $box-selector--icon-size +
$box-selector-vertical--icon-spacing + $box-selector-vertical--padding-top
$box-selector-vertical--icon-spacing +
$box-selector-vertical--padding-top
)} !default;

// ============================================================
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
{
"name": "Danae Millan",
"email": "[email protected]"
},
{
"name": "Pawan Kumar",
"email": "[email protected]",
"url": "https://creador.dev/"
}
],
"homepage": "https://wpmudev.github.io/shared-ui/",
Expand Down

0 comments on commit 2839ac2

Please sign in to comment.