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

Refactor table.sortableTable #10265

Merged
merged 1 commit into from
Aug 10, 2017
Merged

Refactor table.sortableTable #10265

merged 1 commit into from
Aug 10, 2017

Conversation

luixxiul
Copy link
Contributor

@luixxiul luixxiul commented Aug 3, 2017

Addresses #10263

Auditors: @cezaraugusto

Test Plan:

  1. Open about:preferences#search
  2. Make sure the custom width is applied to the table
  3. Open about:preferences#sync
  4. Make sure the custom width is applied to the table
  5. Open about:preferences#extensions
  6. Make sure '-webkit-fill-available' is applied to the table

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

Addresses #10263

Auditors:

Test Plan:
1. Open about:preferences#search
2. Make sure the custom width is applied to the table
3. Open about:preferences#sync
4. Make sure the custom width is applied to the table
5. Open about:preferences#extensions
6. Make sure '-webkit-fill-available' is applied to the table
@luixxiul luixxiul added this to the 0.21.x (Nightly Channel) milestone Aug 3, 2017
@luixxiul luixxiul self-assigned this Aug 3, 2017
return <table
{...this.getTableAttributes()}
className={cx({
sort: !this.sortingDisabled,
sortableTable: !this.props.overrideDefaultStyle,
Copy link
Contributor Author

@luixxiul luixxiul Aug 3, 2017

Choose a reason for hiding this comment

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

overrideDefaultStyle is not used anywhere, so replaced it with true. To override the default style, instead you could use tableClassNames={css(styles.foo)}.

The class sortableTable is used heavily for automated tests so it is not removed yet.

// TODO (Suguru): refactor sortableTable.js to remove !important
width: '100% !important',
marginBottom: '0 !important'
},
Copy link
Contributor Author

@luixxiul luixxiul Aug 3, 2017

Choose a reason for hiding this comment

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

table is no longer required thanks to fillAvailable. Also margin is no longer specified by default.

The table as such does not require margin in the same way as the buttons do not. If margin is required, it should be specified as an option; otherwise the margin should be added to the other element which exists around the table.

borderCollapse: 'collapse',
border: 'none',
margin: '0 auto'
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -590,10 +590,8 @@ const styles = StyleSheet.create({
},

devices__devicesList: {
// TODO: refactor sortableTable to remove !important
marginBottom: `${globalStyles.spacing.dialogInsideMargin} !important`,
boxSizing: 'border-box',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -247,8 +247,6 @@ input[type="checkbox"][disabled] {
}

table.sortableTable {
width: 704px;
Copy link
Contributor Author

@luixxiul luixxiul Aug 3, 2017

Choose a reason for hiding this comment

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

width: 704px is used on about:preferences#search only so replaced it with sortableTable_searchTab. See above.

@@ -15,11 +15,6 @@ table.sort {
}

table.sortableTable {
width: 100%;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is replaced with https://github.com/brave/browser-laptop/pull/10265/files#diff-159ff36704e059402c3f17fb8a35a6fcR489. The width is no longer specified by default (since it had to be overwritten with !important, which is redundant).

width: 100%;
margin-bottom: 40px;
cursor: default;
border-spacing: 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@luixxiul
Copy link
Contributor Author

luixxiul commented Aug 3, 2017

I left some comments for code review :-)

@luixxiul luixxiul closed this Aug 3, 2017
@luixxiul luixxiul reopened this Aug 3, 2017
@codecov-io
Copy link

Codecov Report

Merging #10265 into master will increase coverage by 0.03%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master   #10265      +/-   ##
==========================================
+ Coverage   52.95%   52.98%   +0.03%     
==========================================
  Files         228      228              
  Lines       20309    20308       -1     
  Branches     3254     3255       +1     
==========================================
+ Hits        10754    10760       +6     
+ Misses       9555     9548       -7
Flag Coverage Δ
#unittest 52.98% <100%> (+0.03%) ⬆️
Impacted Files Coverage Δ
app/renderer/components/preferences/syncTab.js 17.01% <ø> (ø) ⬆️
js/about/preferences.js 43.56% <100%> (+0.77%) ⬆️
...p/renderer/components/preferences/extensionsTab.js 89.65% <100%> (ø) ⬆️
...erer/components/preferences/payment/ledgerTable.js 89.72% <100%> (ø) ⬆️
app/renderer/components/common/sortableTable.js 58.65% <100%> (+0.72%) ⬆️

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.

ledger table need some tweaks too. will that be addressed with #10238?
screen shot 2017-08-10 at 12 37 36 pm

@luixxiul
Copy link
Contributor Author

This time, unlike navigationBar, I am going to fix things gradually (as we have a plenty of time until 0.21 will be shipped).

With this PR I'm fixing <table>, not inside of it.

I will tweak stuff ledgerTable too, but only with other tables as well, to normalize the tables. Currently the styles of the table on about pages are inconsistent, and fixing it requires pre-works, one of which is this PR.

Also: #10238 does not polish the ledger table. Instead it fixes the layout of the element named walletBar, which no longer has <table> (instead it is styled with grid).

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.

cool let's do it ++

@cezaraugusto cezaraugusto merged commit 78a92da into brave:master Aug 10, 2017
@luixxiul
Copy link
Contributor Author

thanks for review :-)

dfperry5 pushed a commit to dfperry5/browser-laptop that referenced this pull request Aug 18, 2017
Fixes brave#10434
Follow-up to brave#10265

Auditors: @cezaraugusto

Test Plan:
1. Run `npm run add-simulated-synopsis-visits 100`
2. Open about:preferences#payments
3. Pin some sites
4. Make sure the orange border appears on the table
@bbondy bbondy removed this from the 0.21.x (Developer Channel) milestone Oct 25, 2017
@bbondy bbondy added this to the 0.20.x (Beta Channel) milestone Oct 25, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants