Skip to content

Commit

Permalink
Use CSS Modules for page-list component (#414)
Browse files Browse the repository at this point in the history
This switches the page-list component from being a single `.jsx` file to being a directory with `.jsx` and `.css` files. Fixes #407.
  • Loading branch information
jatinAroraGit authored and Mr0grog committed Nov 4, 2019
1 parent 163854f commit ee93baf
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 42 deletions.
4 changes: 2 additions & 2 deletions src/components/__tests__/page-list.test.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-env jest */

import PageList from '../page-list';
import PageList from '../page-list/page-list';
import React from 'react';
import {shallow} from 'enzyme';
import simplePages from '../../__mocks__/simple-pages.json';
Expand All @@ -27,7 +27,7 @@ describe('page-list', () => {
pages={simplePages}
/>
);
expect(pageList.find('.page-list tbody tr').first().childAt(1).text())
expect(pageList.find('tbody tr').first().childAt(1).text())
.toBe('NOAA - ncei.noaa.gov, EPA - www3.epa.gov');
});
});
32 changes: 32 additions & 0 deletions src/components/page-list/page-list.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.page-list {
table-layout: fixed;
}

.page-list > tbody > tr {
cursor: pointer;
}

.page-list > tbody > tr:hover {
background-color: #eee;
}

.page-list > tbody > tr > td {
overflow-wrap: break-word;
word-wrap: break-word;
}

.page-list > tbody > tr > th[data-name="capture-date"] {
width: 12%;
}

.page-list > tbody > tr > th[data-name="site"] {
width: 15%;
}

.page-list > tbody > tr > th[data-name="page-name"] {
width: 33%;
}

.page-list > tbody > tr > th[data-name="url"] {
width: 40%;
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {dateFormatter, formatSites} from '../scripts/formatters';
import Loading from './loading';
import {dateFormatter, formatSites} from '../../scripts/formatters';
import Loading from '../loading';
import React from 'react';
import SearchBar from './search-bar/search-bar';

import SearchBar from '../search-bar/search-bar';
import './page-list.css';
/**
* These props also inherit from React Router's RouteComponent props
* @typedef {Object} PageListProps
Expand Down Expand Up @@ -47,7 +47,7 @@ export default class PageList extends React.Component {
return (
<div className="row">
<div className="col-md-12">
<table className="page-list table">
<table className="table" styleName="page-list" >
<thead>
{this.renderHeader()}
</thead>
Expand Down
2 changes: 1 addition & 1 deletion src/components/web-monitoring-ui.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Loading from './loading';
import LoginForm from './login-form';
import NavBar from './nav-bar';
import PageDetails from './page-details';
import PageList from './page-list';
import PageList from './page-list/page-list';
import VersionRedirect from './version-redirect';

const configuration = window.webMonitoringConfig;
Expand Down
34 changes: 0 additions & 34 deletions src/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -126,40 +126,6 @@ body {
padding: 0;
}

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

.page-list tbody tr {
cursor: pointer;
}

.page-list tbody tr:hover {
background-color: #eee;
}

.page-list td {
overflow-wrap: break-word;
word-wrap: break-word;
}

.page-list th[data-name="capture-date"] {
width: 12%;
}

.page-list th[data-name="site"] {
width: 15%;
}

.page-list th[data-name="page-name"] {
width: 33%;
}

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

/* ===== Page Detail View ===== */
.page-title {
font-size: 1.5em;
Expand Down

0 comments on commit ee93baf

Please sign in to comment.