Skip to content

Commit

Permalink
Fix styling on payment details page in mobile view. (#9790)
Browse files Browse the repository at this point in the history
  • Loading branch information
shendy-a8c authored Dec 2, 2024
1 parent 55fa477 commit dc6f74c
Show file tree
Hide file tree
Showing 10 changed files with 280 additions and 170 deletions.
4 changes: 4 additions & 0 deletions changelog/fix-7230-payments-details-mobile-view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Fix styling of transaction details page in mobile view.
4 changes: 3 additions & 1 deletion client/components/dispute-status-chip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ interface Props {
status: DisputeStatus | string;
dueBy?: CachedDispute[ 'due_by' ] | EvidenceDetails[ 'due_by' ];
prefixDisputeType?: boolean;
className?: string;
}
const DisputeStatusChip: React.FC< Props > = ( {
status,
dueBy,
prefixDisputeType,
className,
} ) => {
const mapping = displayStatus[ status ] || {};
let message = mapping.message || formatStringValue( status );
Expand All @@ -50,7 +52,7 @@ const DisputeStatusChip: React.FC< Props > = ( {
type = 'alert';
}

return <Chip message={ message } type={ type } />;
return <Chip className={ className } message={ message } type={ type } />;
};

export default DisputeStatusChip;
4 changes: 2 additions & 2 deletions client/components/payment-status-chip/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import displayStatus from './mappings';
import Chip from '../chip';
import { formatStringValue } from 'utils';

const PaymentStatusChip = ( { status } ) => {
const PaymentStatusChip = ( { status, className } ) => {
const mapping = displayStatus[ status ] || {};
const message = mapping.message || formatStringValue( status );
const type = mapping.type || 'light';
return <Chip message={ message } type={ type } />;
return <Chip className={ className } message={ message } type={ type } />;
};

export default PaymentStatusChip;
7 changes: 6 additions & 1 deletion client/payment-details/dispute-details/dispute-notice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ const DisputeNotice: React.FC< DisputeNoticeProps > = ( {
{ createInterpolateElement(
sprintf( noticeText, shopperDisputeReason ),
{
a: <ExternalLink href={ learnMoreDocsUrl } />,
a: (
<ExternalLink
className="dispute-notice__link"
href={ learnMoreDocsUrl }
/>
),
strong: <strong />,
}
) }
Expand Down
14 changes: 14 additions & 0 deletions client/payment-details/dispute-details/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,17 @@
margin-bottom: 0;
}
}

.dispute-notice {
.dispute-notice__link {
display: block;
}
}

@media screen and ( max-width: $break-small ) {
.wcpay-inline-notice.components-notice
.components-notice__content
a.dispute-notice__link {
white-space: normal;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,25 @@ exports[`Order details page should match the snapshot - Charge without payment i
<div
class="payment-details-summary__section"
>
<p
class="payment-details-summary__amount"
<div
class="payment-details-summary__amount-wrapper"
>
$15.00
<span
class="payment-details-summary__amount-currency"
<p
class="payment-details-summary__amount"
>
USD
</span>
$15.00
<span
class="payment-details-summary__amount-currency"
>
USD
</span>
</p>
<span
class="chip chip-light"
class="chip chip-light payment-details-summary__status"
>
Pending
</span>
</p>
</div>
<div
class="payment-details-summary__breakdown"
>
Expand Down
66 changes: 35 additions & 31 deletions client/payment-details/summary/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,37 +257,41 @@ const PaymentDetailsSummary: React.FC< PaymentDetailsSummaryProps > = ( {
<Flex direction="row" align="start">
<div className="payment-details-summary">
<div className="payment-details-summary__section">
<p className="payment-details-summary__amount">
<Loadable
isLoading={ isLoading }
placeholder={ __(
'Amount placeholder',
'woocommerce-payments'
) }
>
{ formattedAmount }
<span className="payment-details-summary__amount-currency">
{ charge.currency || 'USD' }
</span>
{ charge.dispute ? (
<DisputeStatusChip
status={ charge.dispute.status }
dueBy={
charge.dispute.evidence_details
?.due_by
}
prefixDisputeType={ true }
/>
) : (
<PaymentStatusChip
status={ getChargeStatus(
charge,
paymentIntent
) }
/>
) }
</Loadable>
</p>
<div className="payment-details-summary__amount-wrapper">
<p className="payment-details-summary__amount">
<Loadable
isLoading={ isLoading }
placeholder={ __(
'Amount placeholder',
'woocommerce-payments'
) }
>
{ formattedAmount }
<span className="payment-details-summary__amount-currency">
{ charge.currency || 'USD' }
</span>
</Loadable>
</p>
{ charge.dispute ? (
<DisputeStatusChip
className="payment-details-summary__status"
status={ charge.dispute.status }
dueBy={
charge.dispute.evidence_details
?.due_by
}
prefixDisputeType={ true }
/>
) : (
<PaymentStatusChip
className="payment-details-summary__status"
status={ getChargeStatus(
charge,
paymentIntent
) }
/>
) }
</div>
<div className="payment-details-summary__breakdown">
{ renderStorePrice ? (
<p className="payment-details-summary__breakdown__settlement-currency">
Expand Down
22 changes: 19 additions & 3 deletions client/payment-details/summary/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,37 @@
.payment-details-summary {
display: flex;
flex: 1;
@include breakpoint( '<660px' ) {
@media screen and ( max-width: $break-medium ) {
flex-direction: column;
}

.payment-details-summary__section {
flex-grow: 1;
}

.payment-details-summary__amount-wrapper {
display: flex;
align-items: center;
}

@media screen and ( max-width: $break-small ) {
.payment-details-summary__amount-wrapper {
flex-direction: column;
align-items: flex-start;

.payment-details-summary__status {
order: -1;
}
}
}

.payment-details-summary__amount {
@include font-size( 32 );
font-weight: 300;
padding: 0;
margin: 0;
display: flex;
flex-wrap: wrap;
flex-wrap: nowrap;
align-items: center;

.payment-details-summary__amount-currency {
Expand Down Expand Up @@ -93,7 +109,7 @@
justify-content: initial;
flex-direction: column;
flex-wrap: nowrap;
@include breakpoint( '>660px' ) {
@media screen and ( min-width: $break-medium ) {
justify-content: flex-start;
align-items: flex-end;
}
Expand Down
Loading

0 comments on commit dc6f74c

Please sign in to comment.