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

Commit

Permalink
Merge pull request #4395 from brave/fixed-header-table
Browse files Browse the repository at this point in the history
Brave payments: Line should always appear when user scroll down
  • Loading branch information
bbondy authored Oct 4, 2016
2 parents 3c9c3ec + 1b39d6f commit 9698423
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 6 deletions.
5 changes: 3 additions & 2 deletions js/about/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const {passwordManagers, extensionIds} = require('../constants/passwordManagers'
const aboutActions = require('./aboutActions')
const getSetting = require('../settings').getSetting
const SortableTable = require('../components/sortableTable')
const FixedHeaderTable = require('../components/fixedHeaderTable')
const Button = require('../components/button')
const searchProviders = require('../data/searchProviders')
const moment = require('moment')
Expand Down Expand Up @@ -258,11 +259,11 @@ class LedgerTable extends ImmutableComponent {
return null
}
return <div id='ledgerTable'>
<SortableTable
<FixedHeaderTable
headings={['rank', 'publisher', 'include', 'views', 'timeSpent', 'percentage']}
defaultHeading='rank'
overrideDefaultStyle
columnClassNames={['alignRight', '', '', 'alignRight', 'alignRight', 'alignRight']}
columnClassNames={['alignRight', '', '', 'alignRight', 'alignRight', '']}
rowClassNames={
this.synopsis.map((item) =>
this.enabledForSite(item) ? '' : 'paymentsDisabled').toJS()
Expand Down
20 changes: 20 additions & 0 deletions js/components/fixedHeaderTable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

const React = require('react')
const ImmutableComponent = require('./immutableComponent')
const SortableTable = require('./sortableTable')

class FixedHeaderTable extends ImmutableComponent {
render () {
return <div className='fixed-table-container'>
<div className='table-header' />
<div className='fixed-table-container-inner'>
<SortableTable {...this.props} />
</div>
</div>
}
}

module.exports = FixedHeaderTable
5 changes: 3 additions & 2 deletions js/components/sortableTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,10 @@ class SortableTable extends ImmutableComponent {
return <th className={cx({
'sort-header': true,
'sort-default': heading === this.props.defaultHeading})}
data-l10n-id={heading}
data-sort-method={dataType === 'number' ? 'number' : undefined}
data-sort-order={this.props.defaultHeadingSortOrder} />
data-sort-order={this.props.defaultHeadingSortOrder}>
<div className='th-inner' data-l10n-id={heading} />
</th>
})}
</tr>
</thead>
Expand Down
38 changes: 36 additions & 2 deletions less/about/preferences.less
Original file line number Diff line number Diff line change
Expand Up @@ -549,8 +549,6 @@ table.sortableTable {
}

#ledgerTable {
height: ~"-webkit-calc(100vh - 300px)";
overflow-y: auto;

tr {
th,
Expand All @@ -559,6 +557,42 @@ table.sortableTable {
}
}

.fixed-table-container {
height: 500px;
position: relative;

.table-header {
height: 30px;
background: @veryLightGray;
position: absolute;
top: 0;
right: 0;
left: 0;
}

.fixed-table-container-inner {
overflow-x: hidden;
overflow-y: auto;
height: 100%;

table {
width: 100%;
overflow-x: hidden;
overflow-y: auto;

.th-inner {
color: @darkGray;
font-weight: 600;
position: absolute;
top: 0;
line-height: 30px;
z-index: 9;
background: @veryLightGray;
}
}
}
}

}

.modal .dialog.paymentHistory .sectionTitle {
Expand Down

0 comments on commit 9698423

Please sign in to comment.