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

fix(align): fix align right file size #180

Merged
merged 3 commits into from
Oct 31, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions src/Explorer/ExplorerTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export class ExplorerTableComponent extends Component {
};

static defaultProps = {
filesList: [],
lastPageSize: 0,
originalPage: 0,
onPageLoadNextMore: () => {},
Expand Down Expand Up @@ -106,6 +107,7 @@ export class ExplorerTableComponent extends Component {
render() {
const columns = ['Project', 'File Name', 'Format', 'File Size', 'Category'];
const columnWidths = ['20%', '35%', '10%', '15%', '20%'];
const specialAligns = { 'File Size': 'right' };
const startingPage = (this.state.page - this.state.originalPage);
const filesList = this.props.filesList
? this.props.filesList.slice(startingPage * this.props.pageSize,
Expand All @@ -124,9 +126,20 @@ export class ExplorerTableComponent extends Component {
<TableHead>
<TableRow>
{columns.map(
(item, i) => (<TableHeadCell key={i} c_width={columnWidths[i]}>
{item}
</TableHeadCell>),
(item, i) => (
(item in specialAligns) ?
<TableHeadCell
key={i}
c_width={columnWidths[i]}
style={{ textAlign: specialAligns[item] }}
>
{item}
</TableHeadCell>
:
<TableHeadCell key={i} c_width={columnWidths[i]}>
{item}
</TableHeadCell>
),
)}
</TableRow>
</TableHead>
Expand Down