Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

Commit

Permalink
Fix Activity Panel layout on mobile (#2405)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aljullu authored Jun 12, 2019
1 parent 75a3985 commit db463ab
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 50 deletions.
88 changes: 44 additions & 44 deletions client/header/activity-panel/activity-card/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,6 @@
.woocommerce-activity-card__icon {
grid-area: icon;
fill: $core-grey-light-600;

@include breakpoint( '<782px' ) {
.gridicon,
img {
height: 24px;
width: 24px;
margin-left: $gap-small;
}
}
}

.woocommerce-activity-card__header {
Expand Down Expand Up @@ -163,14 +154,14 @@
height: 48px;
width: 48px;
}
}

@include breakpoint( '<782px' ) {
.gridicon,
img,
&.woocommerce-stock-activity-card,
&.woocommerce-review-activity-card {
.woocommerce-activity-card__icon {
.is-placeholder {
height: 24px;
width: 24px;
margin-left: $gap-small;
height: 60px;
width: 60px;
}
}
}
Expand Down Expand Up @@ -247,6 +238,16 @@
}

.woocommerce-review-activity-card {
.woocommerce-activity-card__body > span > p {
&:first-child {
margin-top: 0;
}

&:last-child {
margin-bottom: 0;
}
}

.woocommerce-review-activity-card__verified {
margin-left: $gap-small;
display: inline-flex;
Expand All @@ -262,33 +263,15 @@
}

.woocommerce-review-activity-card__image-overlay {
margin-left: -$gap-large;
position: relative;

img.woocommerce-gravatar {
left: $gap-large;
position: relative;
top: -42px;
border: 2px solid $white;
left: 0;
position: absolute;
top: -6px;
z-index: 2;
}

.woocommerce-review-activity-card__image-overlay__product {
display: inline-block;
height: 60px;
position: relative;
width: 60px;

&.is-placeholder::before {
background-color: $core-grey-dark-500;
border-radius: 50%;
content: '';
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
opacity: 0.1;
}
}
}

@include breakpoint( '<782px' ) {
Expand All @@ -304,12 +287,25 @@
top: -28px;
z-index: 1;
}
}
}

.woocommerce-review-activity-card__image-overlay__product,
.woocommerce-review-activity-card__image-overlay__product .woocommerce-product-image {
width: 38px;
height: 38px;
}
.woocommerce-review-activity-card__image-overlay__product,
.woocommerce-stock-activity-card__image-overlay__product {
height: 60px;
position: relative;
width: 60px;

&.is-placeholder::before {
background-color: $core-grey-dark-500;
border-radius: 50%;
content: '';
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
opacity: 0.1;
}
}

Expand Down Expand Up @@ -358,6 +354,10 @@
}
}

.woocommerce-empty-review-activity-card {
.woocommerce-empty-activity-card {
grid-template-columns: 72px 1fr;

@include breakpoint( '<782px' ) {
grid-template-columns: 64px 1fr;
}
}
2 changes: 1 addition & 1 deletion client/header/activity-panel/panels/inbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class InboxPanel extends Component {
renderEmptyCard() {
return (
<ActivityCard
className="woocommerce-empty-review-activity-card"
className="woocommerce-empty-activity-card"
title={ __( 'Your inbox is empty', 'woocommerce-admin' ) }
icon={ <Gridicon icon="checkmark" size={ 48 } /> }
>
Expand Down
4 changes: 2 additions & 2 deletions client/header/activity-panel/panels/orders.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class OrdersPanel extends Component {
if ( hasNonActionableOrders ) {
return (
<ActivityCard
className="woocommerce-empty-review-activity-card"
className="woocommerce-empty-activity-card"
title={ __( 'You have no orders to fulfill', 'woocommerce-admin' ) }
icon={ <Gridicon icon="checkmark" size={ 48 } /> }
>
Expand All @@ -53,7 +53,7 @@ class OrdersPanel extends Component {

return (
<ActivityCard
className="woocommerce-empty-review-activity-card"
className="woocommerce-empty-activity-card"
title={ __( 'You have no orders to fulfill', 'woocommerce-admin' ) }
icon={ <Gridicon icon="time" size={ 48 } /> }
actions={
Expand Down
2 changes: 1 addition & 1 deletion client/header/activity-panel/panels/reviews.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class ReviewsPanel extends Component {

return (
<ActivityCard
className="woocommerce-empty-review-activity-card"
className="woocommerce-empty-activity-card"
title={ title }
icon={ <Gridicon icon="time" size={ 48 } /> }
actions={
Expand Down
19 changes: 18 additions & 1 deletion client/header/activity-panel/panels/stock/card.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
*/
import { __, sprintf } from '@wordpress/i18n';
import { BaseControl, Button } from '@wordpress/components';
import classnames from 'classnames';
import { Component, Fragment } from '@wordpress/element';
import { compose } from '@wordpress/compose';
import { get } from 'lodash';
import { withDispatch } from '@wordpress/data';

/**
Expand Down Expand Up @@ -131,12 +133,27 @@ class ProductStockCard extends Component {
.join( ', ' );
}

const productImage = get( product, [ 'images', 0 ] ) || get( product, [ 'image' ] );
const productImageClasses = classnames(
'woocommerce-stock-activity-card__image-overlay__product',
{
'is-placeholder': ! productImage || ! productImage.src,
}
);
const icon = (
<div className="woocommerce-stock-activity-card__image-overlay">
<div className={ productImageClasses }>
<ProductImage product={ product } />
</div>
</div>
);

return (
<ActivityCard
className="woocommerce-stock-activity-card"
title={ title }
subtitle={ subtitle }
icon={ <ProductImage product={ product } /> }
icon={ icon }
actions={ this.getActions() }
>
{ this.getBody() }
Expand Down
2 changes: 1 addition & 1 deletion client/header/activity-panel/panels/stock/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class StockPanel extends Component {
renderEmptyCard() {
return (
<ActivityCard
className="woocommerce-empty-review-activity-card"
className="woocommerce-empty-activity-card"
title={ __( 'Your stock is in good shape.', 'woocommerce-admin' ) }
icon={ <Gridicon icon="checkmark" size={ 48 } /> }
>
Expand Down

0 comments on commit db463ab

Please sign in to comment.