Skip to content
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

Use CSS Modules for page-list component #414

Merged
merged 10 commits into from Nov 4, 2019

Conversation

jatinAroraGit
Copy link
Contributor

@jatinAroraGit jatinAroraGit commented Oct 1, 2019

I am resubmitting the pull request with testing passed.
Sorry for any mistakes I might have done. This is my first ever contribution to an external project in open source.
Thanks.

Fixes #407.

@SYU15
Copy link
Contributor

SYU15 commented Oct 1, 2019

No worries, in the future, you need not close out your PR, you can just push up a new commit that fixes the test. We all break CI, it's a part of life!

@Mr0grog Mr0grog changed the title Fixes Issue 407 Use CSS Modules for page-list component Oct 3, 2019
Copy link
Member

@Mr0grog Mr0grog left a comment

Choose a reason for hiding this comment

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

Thanks for working on this, @jatinAroraGit! I made a few notes inline — there’s one thing that’s not working right and a few places you could reduce repetition.

In future pull requests, could you please use a more descriptive title? I already updated the one here for you. :)

Also, if one of your commit messages includes the text fixes #407 (instead of Fixes Issue 407), GitHub will automatically link this PR to the issue, and it will auto-close the issue when we merge your PR. You can read more about that here: https://help.github.com/en/articles/closing-issues-using-keywords

/* ===== List View ===== */
.page-list {
table-layout: fixed;
}
Copy link
Member

Choose a reason for hiding this comment

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

Can you please make sure the indentation is consistent for all these style rules?

Copy link
Member

Choose a reason for hiding this comment

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

Also, this .page-list rule is not actually being applied anymore! That’s what causing this ugliness on small screens:

Screen Shot 2019-10-02 at 10 18 08 PM

In line 50 of page-list.jsx, you need to have:

<table className="table" styleName="page-list">

Instead of:

<table className="page-list table">

Note that the .table class comes from bootstrap, so it needs to stay in the className attribute instead of changing to styleName.

background-color: #eee;
}

.page-list-td {
Copy link
Member

Choose a reason for hiding this comment

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

You can still use descendant selectors with CSS modules, so you could also write:

.page-list td {

or:

.page-list > tbody > tr > td {

That would save you from having to repeat .page-list-td several times down in lines 79-82 of page-list.jsx.

You could do something similar for the .page-list-tbody-tr classes you have above and the .page-list-th classes below.

<th styleName="page-list-th" data-name="capture-date">Capture Date</th>
<th styleName="page-list-th" data-name="site">Site</th>
<th styleName="page-list-th" data-name="page-name">Page Name</th>
<th styleName="page-list-th" data-name="url">URL</th>
Copy link
Member

Choose a reason for hiding this comment

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

See comment in the CSS file about changing the selectors so you don’t have to repeat this so many times.

<td styleName="page-list-td">{record.latest ? dateFormatter.format(record.latest.capture_time) : 'No saved versions'}</td>
<td styleName="page-list-td">{formatSites(record.tags)}</td>
<td styleName="page-list-td">{record.title}</td>
<td styleName="page-list-td"><a href={record.url} target="_blank" rel="noopener">{record.url}</a></td>
Copy link
Member

Choose a reason for hiding this comment

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

See comment in the CSS file about changing the selectors so you don’t have to repeat this so many times.

@jatinAroraGit
Copy link
Contributor Author

Hey @Mr0grog , I updated the code to address all the review comments. Thanks for guiding through.
Let me know if something else needs to be addressed.

Copy link
Contributor

@SYU15 SYU15 left a comment

Choose a reason for hiding this comment

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

Looks good, just have a few minor formatting comments. Thanks for helping out on this!

@@ -0,0 +1,33 @@
/* ===== List View ===== */
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can remove this comment at the top since the CSS is now scoped at the component level, thanks!

table-layout: fixed;
}

.page-list>tbody>tr {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a space between each selector like so? .page-list > tbody > tr

Same for each of the styles below.


.page-list>th[data-name="url"] {
width: 40%;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a newline at the end of the file?

Copy link
Contributor

Choose a reason for hiding this comment

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

You can have this formatted for you automatically if you add the EditorConfig plugin to your text editor: https://editorconfig.org

@Mr0grog
Copy link
Member

Mr0grog commented Oct 16, 2019

@jatinAroraGit Just checking in — are you still working on addressing the last few issues @SYU15 commented about?

@jatinAroraGit
Copy link
Contributor Author

Hey @Mr0grog , I will start working again on this , this weekend. Sorry for the delay as it has been an exam week.

@Mr0grog
Copy link
Member

Mr0grog commented Oct 18, 2019

No worries! Was just making sure. 😄

@jatinAroraGit
Copy link
Contributor Author

Hey @Mr0grog , did a commit addressing the requested changes. Let me know if there are any issues.
Have a good day.

Copy link
Member

@Mr0grog Mr0grog left a comment

Choose a reason for hiding this comment

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

I think there may be a styleName attribute that got added accidentally (noted in a separate comment), but otherwise this looks great.

src/components/page-list/page-list.jsx Outdated Show resolved Hide resolved
@Mr0grog Mr0grog merged commit ee93baf into edgi-govdata-archiving:master Nov 4, 2019
Mr0grog added a commit that referenced this pull request Nov 4, 2019
Mr0grog added a commit to edgi-govdata-archiving/web-monitoring-ops that referenced this pull request Nov 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate CSS for page-list component
3 participants