-
Notifications
You must be signed in to change notification settings - Fork 975
Conversation
@@ -264,8 +276,7 @@ const styles = StyleSheet.create({ | |||
paymentsContainer: { | |||
position: 'relative', | |||
overflowX: 'hidden', | |||
width: '805px', | |||
marginTop: '15px' |
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.
To make the header of payments and sync appear on the same height.
} | ||
} | ||
|
||
class PrefSectionTitle extends ImmutableComponent { |
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.
As this is not going to be used, I'm removing it.
@@ -9,6 +9,8 @@ const Button = require('../../components/button') | |||
const TorrentFileList = require('./torrentFileList') | |||
const TorrentStatus = require('./torrentStatus') | |||
|
|||
const {AboutPagesSectionTitle} = require('../../../app/renderer/components/sectionTitle') |
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.
I'll rename the component (webtorrent is not one of about pages)
const globalStyles = require('./styles/global') | ||
const commonStyles = require('./styles/commonStyles') | ||
|
||
class SectionTitleWrapper extends ImmutableComponent { |
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.
Please split this into single component per file. You should create new folder and place everything there. Name of file == component name, for this example sectionTitleWrapper
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.
I'm afraid doing so would make it hard to maintain the style consistency and enhance components (since you would need to check out every file in the folder not to create duplicates). For me it could cause style scattering.
Actually I prefer calling components with one line like this: https://github.com/brave/browser-laptop/pull/8237/files#diff-943709aef6ee258bb12a2cbb33018988R18, which is the same way as you would load <commonForm>
components. See: https://github.com/brave/browser-laptop/pull/8011/files#diff-fd618a0193d7534a298420a3d3b4a711R22
I'm cool with splitting anyway. I just would like to know how to avoid styles and components from scattering. (adding components to about:styles would be that way.)
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.
yeah what I would do is add folder for it. This way we know that all style components for about pages are there. Problem with multiple components in one file is that it's really hard to know what you have.
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.
Fine, still let's make sure to add the components to about:styles (as we do for textbox.js and dropdown.js for example). Splitting and adding them would be perfect.
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.
We could create a sub panel on about:styles for components in the same folder. Creating a long one page is not what we would like to see.
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.
what if we create new folder in renderer
folder named styles
and we place all styling components into it (one component per file). In there we would keep the same folder structure as we have in components
folder. This way we keep the context of it. What do you think?
This is one option. Another one is to make exception for styling components and keep them in one file (I still prefer splitting them)
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.
Regarding including, I also like this destructured approach. What I would suggest is something like this.
You are now creating things for sectionTitle
. Create folder sectionTitle
and place all components into it. Then in this folder create file index.js
where you are exporting all this components. This way you can easily use your approach and file structure is still search and time friendly 😃
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.
Based on this PR I will crate wiki regarding best practices, so that we will all work in the same way. So this PR is really important, we should define and think things in detail. Please don't change things yet until we find and define how should we tackle this one.
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.
Sweet, because I'm still a fan of about:styles, linking to that file from about:styles looks good finally, in my opinion.
Waiting for opinion of other members who will be back online after the holiday.
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.
I endorse creating a new folder to include this file but despite being enthusiastic on creating small components, they're still too small to host their own files IMO.
Since they're just titles, it's very unlikely that we'll add more methods and bulk file with new code.
For the new folder name, I'd suggest something like common/shared to host this, and in future include things like button
and our already existent settings
component, so for all highly replicated components. Even if we decide to create an about
folder -- which I endorse as well -- they should be on that folder
@@ -77,6 +77,7 @@ | |||
transition: @transitionFast; | |||
} | |||
|
|||
/* Copied to siteDetails.js */ |
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.
Will correct the comment -> sectionTitle
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.
@luixxiul mind just moving sectionTitle
inside a folder called common
i.e. app/renderer/components/common/sectionTitle
? We'd better separate concerns for now for better structure while we are not done refactoring everything.
I'm doing button
refactoring and will be moving that as well once is done.
@NejcZdovc are you ok with that for now? If just in case file gets too big we can split that (as you did for tabContent) but I don't think that's the case for now
it sound good to me; we would then move other files (dropdown.js, list.js, textbox.js and messageBox.js) into that folder as well. |
@cezaraugusto as I said I am partly ok with styling component's to be in the same folder, because I think that we won't write test for them. I would still prefer separate files, but we should only use this approach for styling components and nothing more. All other components should be in separate files. |
It seems to me that it is not good timing to separate everything rigorously. We even do not know yet how many files and components there will be after refactor work, and how kind of issues there will be coming due to either "many files with a single component" or "many components with a single file". It is not a good idea to spend time on the issue which is yet to exist. So, how about trying both way to create rules later? I don't think there is the general solution here (as there is not so much projects other than us who adopt Aphrodite), and both way seems to me worth trying to find the better one. To avoid the chaos, we should create a tracking issue, commenting which components are refactored in which way. On secitonTitle.js, let me add the sectionTitle components to about:styles precisely and see if that will avoid the issue. |
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
const React = require('react') | ||
const ImmutableComponent = require('../../../js/components/immutableComponent') |
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.
ImmutableComponent was moved into app folder, please update this path
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.
@luixxiul please update this path
@NejcZdovc sorry if you got me wrong, I agree with you. I just think that for this case, specifically, we should leave as-is. Those titles don't have conditional rendering, nor do anything dynamically that's worth testing. The benefit of having them all together is the easy to change quickly if design spec changes |
@NejcZdovc @cezaraugusto @luixxiul I saw the above (conversation about breaking out the components 1 per file)- it looks OK to me as-is Because there are multiple in one file and they are related, it's easy to edit there. What pops out to me is that none of the components have logic, other than render. Since they are related and ONLY have a render, I would argue it's OK to have them in the same file 😄 Once a component adds any other property or becomes unrelated to the ones there, I believe it should be moved out. Just my 2 cents 😛 An example where I myself did this is with the TextBox component: What do you all think? |
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.
LGTM... but let's make sure @cezaraugusto and @NejcZdovc approve of the changes before merging 😄
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.
I would just put titles inside a common
folder as discussed, there's an awesome work on redux refactoring so it's a good time to endorse the separation of concerns.
Since we all agree on that, once done LGTM
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.
in sectionTitle.js
path needs to be updated for an immutable component
@luixxiul pleased check tests as well, because we have some failing tests https://travis-ci.org/brave/browser-laptop/builds/224193912 |
I think I moved the file to |
Closes #7750 Closes #8165 Closes #8234 Addresses #8235 TODO: Refactor modalOverlay.js to remove .sectionTitle Created TitleWrapper, SectionTitle, and SubTitle - SectionTitleWrapper and BetaSectionTitleWrapper - DefaultSectionTitle, PrefSectionTitle, and AboutPagesSectionTitle - AboutPagesSectionSubTitle and SectionSubTitle Refactored with those components: - extensionsTab.js, pluginsTab.js, preferences.js, syncTab.js, and paymentsTab.js - about.js, brave.js, bookmarks.js and history.js - torrentViewer.js, torrentStatus.js and torrentFileList.js Added siteDetailsPageContent to commonStyles.js and applied: - about.js, brave.js, and history.js Removed styles of sectionTitle from: - brave.less - siteDetails.less Auditors: Test Plan 1: 1. Open about:preferences#search 2. Make sure there is margin under the top header Test Plan 2: 1. Open about:preferences#sync 2. Make sure "beta" is aligned top 3. Open about:preferences#payments 4. Make sure the labels appear the same row 5. Make sure the switches and the labels are aligned exactly like #7751 Test Plan 3: 1. Open about:about 2. Make sure there is margin under the header 3. Open about:brave, about:bookmarks, and about:history 4. Make sure the header font size is same Test Plan 4: 1. Open https://webtorrent.io/free-torrents/ 2. Click .torrent link 3. Make sure the header font size is same as about:brave 4. Start download 5. Make sure the header font size is same Test Plan 5: 1. Clear your profile folder 2. Open about:preferences#sync 3. Enable Sync 4. Make sure there is margin under "Devices"
Closes #8349 Closes #8350 Also: - Moved sectionTitle.js into the common folder - Added TOC to about:styles with internal links - Removed CommonFormSubSection from importBrowserDataPanel.js - Removed PrefSectionTitle - Renamed SectionSubTitle into SectionLabelTitle - Renamed BetaSectionTitleWrapper into SectionTitleLabelWrapper - Renamed SectionSubTitle into SectionLabelTitle - Renamed AboutPagesSectionTitle to AboutPageSectionTitle - Renamed AboutPagesSectionSubTitle to AboutPageSectionSubTitle - Copied some properties from common.less to sectionTitle.js Auditors: Test Plan 1: 1. Open "Import Browser data" from the menu 2. Make sure the switch is indented Test Plan 2: 1. Open about:styles 2. Click "commonForm" on TOC 3. Make sure the template of the commonForm is displayed 4. Click "Go back to top" 5. Click "sectionTitle" on TOC 6. Make sure section title components are displayed
It turns out that margin-bottom was missing from CommonFormSubSection, so I added it. Auditors: Test Plan: 1. Open about:styles 2. Click commonForm on TOC 3. Make sure that there is margin between CommonFormSubSection and CommonFormDropdown
Updated, and tests should be fine based on the results of my forked repo: https://travis-ci.org/luixxiul/browser-laptop/builds/224445488. |
@luixxiul still some test are failing, looks like some selectors problem |
It turned out the most errors are intermittent and not related with those PRs. https://travis-ci.org/brave/browser-laptop/jobs/224455046#L2935 Just re-run the jobs on Travis manually to confirm the results |
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.
I went trough all test and they are not related to your PR anymore. Great job. LGTM
TODO: Refactor modalOverlay.js to remove
.sectionTitle
.Closes #7750
Closes #8165
Closes #8234
Addresses #8235
Closes #8349
Closes #8350
1. Created
TitleWrapper
,SectionTitle
, andSubTitle
SectionTitleWrapper
andSectionTitleLabelWrapper
DefaultSectionTitle
andAboutPageSectionTitle
AboutPageSectionSubTitle
andSectionLabelTitle
Note: Visit
about:styles
for their templates.2. Refactored with those components:
3. Added
siteDetailsPageContent
to commonStyles.js and applied it to:4. Removed styles of
sectionTitle
from:Note: Use the components of
sectionTitle
instead of<div class='sectionTitle'>
Also:
Test Plans
Test Plan 1:
Test Plan 2:
Test Plan 3:
Test Plan 4:
Test Plan 5:
Test Plan 6:
Test Plan 7:
git rebase -i
to squash commits (if needed).Test Plan: