-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reporting: Add a parent wrapper component for Payment Activity #8412
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
173c11e
Add empty activity state SVG asset
1cf1abd
Add payment activity component
e675fcd
Add Payment Activity widget to Overview page
84afad8
change log
6ea37a2
minor - Tidying dependency declaration order
17d472a
Fix typo
d45bed4
Add a test
86ce6ba
Remove empty state image for now
dd0e329
Merge branch 'develop' into add/8389-create-payment-activity-wrapper
49abd31
Merge branch 'develop' into add/8389-create-payment-activity-wrapper
2ccf118
Tidy - group all component imports together
992025a
refactor - destructure const for clean code
aba3603
Refactor - destructure consts outside of PR scope
5f9e3df
corrections in earlier refactor
1006528
Change test to snapshot
fa4bbd9
remove commented code
844c9cc
Add camel case to hasActiveLoan
28300b0
Merge branch 'develop' into add/8389-create-payment-activity-wrapper
98b9543
Refactor - showTaskList condition
9ab8184
Merge branch 'develop' into add/8389-create-payment-activity-wrapper
bd0278d
Move AccountBalances before PaymentActivity
f9816f6
Roll back to earlier conditional view of Tasklist and Welcome
f8f8e49
Enclose in JSX tags like earlier
d54b0b9
Minor SCSS refactor
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: minor | ||
Type: add | ||
|
||
Add a parent wrapper component for Payment Activity widget. This will be visible on the Payments Overview page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import * as React from 'react'; | ||
import { Card, CardBody, CardHeader } from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
/** | ||
* Internal dependencies. | ||
*/ | ||
import './style.scss'; | ||
|
||
const PaymentActivity: React.FC = () => { | ||
return ( | ||
<Card className="wcpay-payments-activity__card"> | ||
<CardHeader | ||
className="wcpay-payments-activity__card__header" | ||
isBorderless={ true } | ||
> | ||
{ __( 'Your payment activity', 'woocommerce-payments' ) } | ||
{ /* Filters go here */ } | ||
</CardHeader> | ||
<CardBody className="wcpay-payments-activity__card__body"> | ||
<>{ /* Sub components go here */ }</> | ||
</CardBody> | ||
</Card> | ||
); | ||
}; | ||
|
||
export default PaymentActivity; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.wcpay-payments-activity { | ||
&__card { | ||
padding: 24px 24px 16px 24px; | ||
|
||
&__header { | ||
padding: 0 !important; | ||
margin-bottom: 32px; | ||
} | ||
|
||
&__body { | ||
text-align: center; | ||
color: $studio-gray-30; | ||
} | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
client/components/payment-activity/test/__snapshots__/index.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`PaymentActivity component should render 1`] = ` | ||
<div> | ||
<div | ||
class="components-surface components-card wcpay-payments-activity__card css-nsno0f-View-Surface-getBorders-primary-Card-rounded em57xhy0" | ||
data-wp-c16t="true" | ||
data-wp-component="Card" | ||
> | ||
<div | ||
class="css-mgwsf4-View-Content em57xhy0" | ||
> | ||
<div | ||
class="components-flex components-card__header components-card-header wcpay-payments-activity__card__header css-sz55ca-View-Flex-sx-Base-sx-Items-ItemsRow-Header-borderRadius-borderColor-medium-borderless em57xhy0" | ||
data-wp-c16t="true" | ||
data-wp-component="CardHeader" | ||
> | ||
Your payment activity | ||
</div> | ||
<div | ||
class="components-card__body components-card-body wcpay-payments-activity__card__body css-1nwhnu3-View-Body-borderRadius-medium em57xhy0" | ||
data-wp-c16t="true" | ||
data-wp-component="CardBody" | ||
/> | ||
</div> | ||
<div | ||
aria-hidden="true" | ||
class="components-elevation css-91yjwm-View-Elevation-sx-Base-elevationClassName em57xhy0" | ||
data-wp-c16t="true" | ||
data-wp-component="Elevation" | ||
/> | ||
<div | ||
aria-hidden="true" | ||
class="components-elevation css-91yjwm-View-Elevation-sx-Base-elevationClassName em57xhy0" | ||
data-wp-c16t="true" | ||
data-wp-component="Elevation" | ||
/> | ||
</div> | ||
</div> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import PaymentActivity from '..'; | ||
|
||
describe( 'PaymentActivity component', () => { | ||
it( 'should render', () => { | ||
const { container } = render( <PaymentActivity /> ); | ||
|
||
expect( container ).toMatchSnapshot(); | ||
} ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💭 There may be an opportunity to reduce the amount of custom css applied here.
I attempted the following and see no major difference with the rendered component (yet, I know there may be more to come, but we can let that be implemented as-needed).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @Jinksi. I have added these classes since:
I found that the Card by default does not have any padding and the inner individual constituents have their own padding. I thought it is better to add the padding to the whole wrapper as per our design, for uniformity. This will also help have same padding for upcoming components.
The CSS on header card removes its own padding and there is an
isBorderless
prop set totrue
to remove bottom border on the header.I hope this makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with @Jinksi here – not so much "let's avoid css classes", more that we should avoid overriding / customising styles.
If the components aren't doing what we want (i.e. differ from design in subtle or major ways), we should:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for sharing some very helpful guidance. I removed the custom css, and found the only difference it made was adding some extra 8 px padding. I also now see that has been removed in the new simplified design update, making it consistent with the headings of other widgets.
The latest design also has a bottom border ( default view ) for the card header.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since I had already merged this PR before @haszari 's comment, i have created a fresh PR with the tweak
#8507