Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Restructure paymentsTab with grid property #10238

Merged
merged 1 commit into from
Sep 11, 2017
Merged

Restructure paymentsTab with grid property #10238

merged 1 commit into from
Sep 11, 2017

Conversation

luixxiul
Copy link
Contributor

@luixxiul luixxiul commented Aug 1, 2017

Closes #10236

Replace display:table with display:grid to align elements

Also:

Test Plan 1:

  1. Open about:preferences#payments
  2. Enable payments
  3. Make sure the elements are aligned equally on both rows and columns
  4. Disable payments
  5. Make sure the switch is placed on the same place

Test Plan 2:

  1. Open about:styles#dropdowns
  2. Make sure PanelDropdown appears there

If this does not look changed, nothing is broken :-)

screenshot 2017-08-02 13 34 17

screenshot 2017-08-02 18 06 35

Submitter Checklist:

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).
  • Tagged reviewers and labelled the pull request as needed.

Test Plan:

Reviewer Checklist:

Tests

  • Adequate test coverage exists to prevent regressions
  • Tests should be independent and work correctly when run individually or as a suite ref
  • New files have MPL2 license header

@luixxiul luixxiul added feature/about-pages polish Nice to have — usually related to front-end/visual tasks. refactoring/aphrodite labels Aug 1, 2017
@luixxiul luixxiul added this to the 0.21.x (Nightly Channel) milestone Aug 1, 2017
@luixxiul luixxiul self-assigned this Aug 1, 2017
@luixxiul
Copy link
Contributor Author

luixxiul commented Aug 1, 2017

I added gridStyles in the same way as I created the compact bravery panel.

</table>
<div className={css(gridStyles.row1col1, styles.walletBar__title)} data-l10n-id='monthlyBudget' />
<div className={css(gridStyles.row1col2, styles.walletBar__title)} data-l10n-id='accountBalance' />
<div className={css(gridStyles.row1col3)} />
Copy link
Contributor Author

@luixxiul luixxiul Aug 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the blank item.

@codecov-io
Copy link

codecov-io commented Aug 1, 2017

Codecov Report

Merging #10238 into master will increase coverage by 0.01%.
The diff coverage is 97.05%.

@@            Coverage Diff             @@
##           master   #10238      +/-   ##
==========================================
+ Coverage   54.15%   54.16%   +0.01%     
==========================================
  Files         247      247              
  Lines       21575    21579       +4     
  Branches     3344     3346       +2     
==========================================
+ Hits        11684    11689       +5     
+ Misses       9891     9890       -1
Flag Coverage Δ
#unittest 54.16% <97.05%> (+0.01%) ⬆️
Impacted Files Coverage Δ
app/renderer/components/styles/global.js 100% <ø> (ø) ⬆️
app/renderer/components/styles/payment.js 100% <ø> (ø) ⬆️
app/renderer/components/common/browserButton.js 69.04% <ø> (ø) ⬆️
.../components/preferences/payment/disabledContent.js 100% <ø> (ø) ⬆️
...r/components/preferences/payment/enabledContent.js 94.06% <100%> (+0.84%) ⬆️
app/renderer/components/preferences/paymentsTab.js 83.87% <100%> (+0.35%) ⬆️
...erer/components/preferences/payment/ledgerTable.js 89.67% <100%> (+0.17%) ⬆️
app/renderer/components/common/dropdown.js 90.62% <75%> (+0.62%) ⬆️
... and 2 more

@@ -38,6 +39,12 @@ class SettingDropdown extends ImmutableComponent {
}
}

class PanelDropdown extends ImmutableComponent {
render () {
return <FormDropdown data-isPanel='true' {...this.props} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're actually passing a string here, so this is actually truthy and not true. For such cases you'd need to pass as a boolean like data-isPanel={true}, but standard will complain. Hidden values are evaluated to true anyway and make standard happy, so <FormDropdown data-isPanel {...this.props} /> is the right take.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<FormDropdown data-isPanel {...this.props} /> is the right take.

OK I'm changing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


settings_panel: {
// ref: browserButton_panelItem
width: '180px'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if browserButton_panelItem shares the same value then it should be both hosted in global.js, then the comment can be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -59,7 +58,7 @@ const styles = StyleSheet.create({
backgroundColor: globalStyles.color.lightGray,
borderRadius: globalStyles.radius.borderRadiusUIbox,
padding: '40px',
fontSize: paymentStyles.font.regular,
fontSize: globalStyles.payments.fontSize.regular,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we changing styles here?

Copy link
Contributor Author

@luixxiul luixxiul Aug 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To remove paymentsStyles for now. It is not maintained well and moving the values to global.js makes it the code much more understandable.

I'm going to re-introduce paymentStyles after files related with about:preferences#payments are polished and the other stuff (which could be related with them) on other files than ones under payment is also converted to normalize the common styles, if any.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If paymentStyles would be left, there would remain only this line as other two will be removed. It does not make much sense to have a const for one style, IMO.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I'm against payments.js styles anyway so doing what you did is better up to a point that we remove that file.

@@ -84,11 +83,10 @@ class EnabledContent extends ImmutableComponent {

return <section className={css(styles.balance)}>
<FormTextbox data-test-id='fundsAmount' readOnly value={btcToCurrencyString(value, ledgerData)} />
<a className={css(styles.iconLink)} href='https://brave.com/Payments_FAQ.html' target='_blank'>
<a className={css(styles.balance__iconLink)} href='https://brave.com/Payments_FAQ.html' target='_blank'>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++ much better

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added rel='noopener' as well:
91de03c#diff-5d8199641ea1ba12e0394859f7eb0c55R86

}
const styles = StyleSheet.create({
walletBar: {
display: 'grid',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yessssssss

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grid rules 🦁

@luixxiul luixxiul mentioned this pull request Aug 10, 2017
8 tasks
@@ -327,6 +328,13 @@ const globalStyles = {
background: '#ccc'
}
}
},

// TODO (Suguru): move them to payment.js after style refactoring is done
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cezaraugusto this TODO will be revisited.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok thanks. also pls move things out of that most you can. I think that file should be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. I'm going to address that on another PR (as it is out of scope of this PR and it'll take some time).

@luixxiul luixxiul requested a review from cezaraugusto August 15, 2017 05:47
Copy link
Contributor

@cezaraugusto cezaraugusto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great work, thanks ++

@cezaraugusto
Copy link
Contributor

I tested before the conflict, can you rebase please? we can merge after that

@luixxiul
Copy link
Contributor Author

luixxiul commented Sep 6, 2017

@cezaraugusto rebased. this is ready for re-review, thanks.

@NejcZdovc
Copy link
Contributor

@luixxiul can you rebase again pls

Closes #10236

Replace display:table with display:grid to align elements

Also:
- Update enabledContent.js to BEM style (Closes #10146)
- Add PanelDropdown
- Remove paymentStyles from payment for now (until conversion is done)
- Add Panel Dropdown to styles.js (Closes #10245)

Auditors: @cezaraugusto

Test Plan 1:
1. Open `about:preferences#payments`
2. Enable payments
3. Make sure the elements are aligned equally on both rows and columns
4. Disable payments
5. Make sure the switch is placed on the same place

Test Plan 2:
1. Open about:styles#dropdowns
2. Make sure PanelDropdown appears there
@cezaraugusto cezaraugusto merged commit 415619e into brave:master Sep 11, 2017
@luixxiul luixxiul deleted the polish-grid-paymentsTab branch September 11, 2017 10:48
@bbondy bbondy modified the milestones: 0.21.x (Developer Channel), 0.20.x (Beta Channel) Oct 25, 2017
@srirambv
Copy link
Collaborator

@luixxiul is this expected ?
image

@luixxiul
Copy link
Contributor Author

the right column should be aligned to the gray box. something must have been fallen out during 0.19 series. will check out.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature/about-pages polish Nice to have — usually related to front-end/visual tasks. refactoring/aphrodite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants