From 0544c34d581ae37bc155cd6c85370c4c140065cc Mon Sep 17 00:00:00 2001 From: Joe Wroten Date: Sun, 16 Dec 2018 15:55:11 -0600 Subject: [PATCH] Most of visual styling --- app/components/file-table-item.js | 2 + app/styles/app.css | 69 +++++++++++++++++++ app/templates/components/file-table-item.hbs | 7 +- app/templates/components/file-table.hbs | 23 ++++--- .../components/file-table-item-test.js | 4 +- 5 files changed, 93 insertions(+), 12 deletions(-) diff --git a/app/components/file-table-item.js b/app/components/file-table-item.js index 8497f81..7e46b17 100644 --- a/app/components/file-table-item.js +++ b/app/components/file-table-item.js @@ -6,6 +6,8 @@ const defaultSelectedFilePaths = []; export default Component.extend({ tagName: 'tr', + classNames: ['file-table-item'], + classNameBindings: ['isSelected'], attributeBindings: ['data-test-id', 'data-test-action'], 'data-test-id': 'file-table-item', diff --git a/app/styles/app.css b/app/styles/app.css index e69de29..fbe211a 100644 --- a/app/styles/app.css +++ b/app/styles/app.css @@ -0,0 +1,69 @@ +body { + font-family: sans-serif; +} + +.file-table-action { + font-size: 1.25em; + background: none; + border: none; + cursor: pointer; + padding: .5em; +} + +.file-table { + width: 100%; + border: 1px solid #eee; + border-collapse: collapse; +} + +.file-table-head tr { + border-bottom: 1px solid #eee; +} + +.file-table-head th { + text-align: left; + font-weight: normal; + font-size: 1.1em; + padding: 1em 0 .5em; +} + +.file-table-item:hover { + background: #eee; + cursor: pointer; +} + +.file-table-item.is-selected { + background: #ddd; +} + + +.file-table-item:active { + background: #ccc; +} + +.file-table-item > :first-child { + padding-left: .5em; +} + +.file-table-item > :last-child { + padding-right: 3em; +} + +.file-table-item td { + padding: .5em 0; +} + +.file-table-item-status { + text-transform: capitalize; +} + +.file-table-item-status-icon { + display: block; + width: 1em; + height: 1em; + border-radius: 100%; +} + +.file-table-item-status-icon.-available { + background: #77ce2d; +} \ No newline at end of file diff --git a/app/templates/components/file-table-item.hbs b/app/templates/components/file-table-item.hbs index 752a191..e5905f2 100644 --- a/app/templates/components/file-table-item.hbs +++ b/app/templates/components/file-table-item.hbs @@ -12,12 +12,15 @@   - + {{file.status}} \ No newline at end of file diff --git a/app/templates/components/file-table.hbs b/app/templates/components/file-table.hbs index 569407a..0e4a020 100644 --- a/app/templates/components/file-table.hbs +++ b/app/templates/components/file-table.hbs @@ -19,6 +19,7 @@
- - - - - - - - +
 NameDevicePath Status
+ + + + + + + + + {{#each files as | file |}} diff --git a/tests/integration/components/file-table-item-test.js b/tests/integration/components/file-table-item-test.js index e1a4015..f9c0c13 100644 --- a/tests/integration/components/file-table-item-test.js +++ b/tests/integration/components/file-table-item-test.js @@ -38,11 +38,11 @@ module('Integration | Component | file-table-item', function(hooks) { await render(hbs`{{file-table-item file=file}}`); assert.equal(find('[data-test-id=file-table-item-status]').textContent.trim(), 'scheduled', 'Renders correct status text'); - assert.equal(find('[data-test-id=file-table-status-icon]').classList.contains('file-table-item-status-scheduled'), true, 'Status icon has expected class'); + assert.equal(find('[data-test-id=file-table-status-icon]').classList.contains('-scheduled'), true, 'Status icon has expected class'); this.set('file', genericFile()); assert.equal(find('[data-test-id=file-table-item-status]').textContent.trim(), 'available', 'Renders correct status text'); - assert.equal(find('[data-test-id=file-table-status-icon]').classList.contains('file-table-item-status-available'), true, 'Status icon has expected class'); + assert.equal(find('[data-test-id=file-table-status-icon]').classList.contains('-available'), true, 'Status icon has expected class'); }); test('it handles toggling selected status based on incoming selectedFilePaths', async function(assert) {
 NameDevicePath Status