Skip to content

Commit b1c7069

Browse files
authored
Remove deprecated usages of @woocommerce/components <Card> (Automattic#2315)
1 parent 9e8ce3e commit b1c7069

File tree

7 files changed

+33
-80
lines changed

7 files changed

+33
-80
lines changed

README.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,32 @@ This is a feature plugin for accepting payments via a WooCommerce-branded paymen
44

55
## Dependencies
66

7-
- WooCommerce
7+
- WooCommerce
88

99
## Development
1010

1111
### Install dependencies & build
1212

13-
- `npm install`
14-
- `composer install`
15-
- `npm run build:client`
13+
- `npm install`
14+
- `composer install`
15+
- `npm run build:client`, or if you're developing the client you can have it auto-update when changes are made: `npm start`
1616

1717
## Setup
1818

1919
If you're using the Docker environment see setup instructions here:
2020
https://github.com/Automattic/woocommerce-payments/blob/trunk/docker/README.md
2121

2222
Install the following plugins:
23-
- WooCommerce
23+
24+
- WooCommerce
25+
2426
## Test account setup
2527

2628
For setting up a test account follow [these instructions](https://docs.woocommerce.com/document/payments/testing/dev-mode/).
2729

2830
You will need a externally accessible URL to set up the plugin. You can use ngrok for this.
2931

30-
```ngrok http 8082```
32+
`ngrok http 8082`
3133

3234
See: https://github.com/Automattic/woocommerce-payments/blob/trunk/CONTRIBUTING.md (possibly move contents here for visibility sake)
3335

client/connect-account-page/index.js

+14-11
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
* External dependencies
44
*/
55
import React from 'react';
6-
import { Card } from '@woocommerce/components';
7-
import { Button, Notice } from '@wordpress/components';
6+
import { Button, Card, CardBody, Notice } from '@wordpress/components';
87
import { render, useState, useEffect } from '@wordpress/element';
98

109
/**
@@ -215,18 +214,22 @@ const ConnectAccountPage = () => {
215214
<Page isNarrow className="connect-account">
216215
<ConnectPageError />
217216
<Card className="connect-account__card">
218-
<Banner style="account-page" />
219-
<div className="content">
220-
{ wcpaySettings.onBoardingDisabled ? (
221-
<ConnectPageOnboardingDisabled />
222-
) : (
223-
<ConnectPageOnboarding />
224-
) }
225-
</div>
217+
<CardBody>
218+
<Banner style="account-page" />
219+
<div className="content">
220+
{ wcpaySettings.onBoardingDisabled ? (
221+
<ConnectPageOnboardingDisabled />
222+
) : (
223+
<ConnectPageOnboarding />
224+
) }
225+
</div>
226+
</CardBody>
226227
</Card>
227228
{ ! wcpaySettings.onBoardingDisabled && (
228229
<Card className="connect-account__steps">
229-
<ConnectPageOnboardingSteps />
230+
<CardBody>
231+
<ConnectPageOnboardingSteps />
232+
</CardBody>
230233
</Card>
231234
) }
232235
</Page>

client/connect-account-page/style.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
}
9292

9393
.connect-account__card {
94-
.woocommerce-card__body {
94+
> .components-card__body {
9595
padding: 0;
9696

9797
.content {
@@ -116,7 +116,7 @@
116116
}
117117

118118
.connect-account__steps {
119-
.woocommerce-card__body {
119+
.components-card__body {
120120
padding: 24px;
121121
}
122122

client/connect-account-page/test/__snapshots__/index.js.snap

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ exports[`ConnectAccountPage should render correctly 1`] = `
99
class="connect-account woocommerce-payments-page is-narrow"
1010
>
1111
<div
12-
class="woocommerce-card connect-account__card"
12+
class="components-card is-size-medium connect-account__card css-1xs3c37-CardUI e1q7k77g0"
1313
>
1414
<div
15-
class="woocommerce-card__body"
15+
class="components-card__body is-size-medium css-xmjzce-BodyUI e1q7k77g3"
1616
>
1717
<div
1818
class="components-card is-size-large woocommerce-payments-banner account-page css-1xs3c37-CardUI e1q7k77g0"
@@ -807,10 +807,10 @@ exports[`ConnectAccountPage should render correctly 1`] = `
807807
</div>
808808
</div>
809809
<div
810-
class="woocommerce-card connect-account__steps"
810+
class="components-card is-size-medium connect-account__steps css-1xs3c37-CardUI e1q7k77g0"
811811
>
812812
<div
813-
class="woocommerce-card__body"
813+
class="components-card__body is-size-medium css-xmjzce-BodyUI e1q7k77g3"
814814
>
815815
<h2>
816816
You’re only steps away from getting paid
@@ -880,10 +880,10 @@ exports[`ConnectAccountPage should render correctly when on-boarding disabled 1`
880880
class="connect-account woocommerce-payments-page is-narrow"
881881
>
882882
<div
883-
class="woocommerce-card connect-account__card"
883+
class="components-card is-size-medium connect-account__card css-1xs3c37-CardUI e1q7k77g0"
884884
>
885885
<div
886-
class="woocommerce-card__body"
886+
class="components-card__body is-size-medium css-xmjzce-BodyUI e1q7k77g3"
887887
>
888888
<div
889889
class="components-card is-size-large woocommerce-payments-banner account-page css-1xs3c37-CardUI e1q7k77g0"

client/payment-details/index.js

+3-15
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
1-
/** @format **/
2-
31
/**
42
* External dependencies
53
*/
64
import { __ } from '@wordpress/i18n';
7-
import { Card } from '@woocommerce/components';
5+
import { Card, CardBody } from '@wordpress/components';
86

97
/**
108
* Internal dependencies
119
*/
1210
import { useCharge } from '../data';
1311
import PaymentDetailsSummary from './summary';
1412
import PaymentDetailsTimeline from './timeline';
15-
import PaymentDetailsPayment from './payment';
1613
import PaymentDetailsPaymentMethod from './payment-method';
17-
import PaymentDetailsSession from './session';
1814
import Page from 'components/page';
1915
import { TestModeNotice, topics } from 'components/test-mode-notice';
2016

@@ -29,12 +25,12 @@ const PaymentDetails = ( props ) => {
2925
<Page maxWidth={ 1032 } className="wcpay-payment-details">
3026
{ testModeNotice }
3127
<Card>
32-
<div>
28+
<CardBody>
3329
{ __(
3430
'Payment details not loaded',
3531
'woocommerce-payments'
3632
) }
37-
</div>
33+
</CardBody>
3834
</Card>
3935
</Page>
4036
);
@@ -47,18 +43,10 @@ const PaymentDetails = ( props ) => {
4743
{ wcpaySettings.featureFlags.paymentTimeline && (
4844
<PaymentDetailsTimeline chargeId={ chargeId } />
4945
) }
50-
{
51-
// Hidden for the beta.
52-
false && <PaymentDetailsPayment charge={ charge } />
53-
}
5446
<PaymentDetailsPaymentMethod
5547
charge={ charge }
5648
isLoading={ isLoading }
5749
/>
58-
{
59-
// Hidden for the beta.
60-
false && <PaymentDetailsSession charge={ charge } />
61-
}
6250
</Page>
6351
);
6452
};

client/payment-details/payment/index.js

-20
This file was deleted.

client/payment-details/session/index.js

-20
This file was deleted.

0 commit comments

Comments
 (0)