diff --git a/.scss-lint.yml b/.scss-lint.yml index 1e1c55e..0db233d 100644 --- a/.scss-lint.yml +++ b/.scss-lint.yml @@ -100,7 +100,7 @@ linters: NestingDepth: enabled: true - max_depth: 5 + max_depth: 7 ignore_parent_selectors: false PlaceholderInExtend: @@ -144,7 +144,7 @@ linters: enabled: true QualifyingElement: - enabled: true + enabled: false allow_element_with_attribute: false allow_element_with_class: false allow_element_with_id: false diff --git a/app/components/directory-listing/template.hbs b/app/components/directory-listing/template.hbs index fc56a37..5ed9e06 100644 --- a/app/components/directory-listing/template.hbs +++ b/app/components/directory-listing/template.hbs @@ -1,17 +1,11 @@ - - - - - - - - - {{#each items as |item|}} - - - - - - {{/each}} - -
NameType
{{item-icon type=item.type}}{{item.name}}{{item.type}}
\ No newline at end of file + \ No newline at end of file diff --git a/app/components/item-icon/component.js b/app/components/item-icon/component.js index 3fb6163..91ed6ec 100644 --- a/app/components/item-icon/component.js +++ b/app/components/item-icon/component.js @@ -2,12 +2,27 @@ import Component from '@ember/component'; export default Component.extend({ + tagName: 'img', classNames: ['item-icon'], + attributeBindings: ['src:src'], type: null, isFolder: function() { return this.get('type') === 'folder'; - }.property('type') + }.property('type'), + + src: function() { + let prefix = '/img/file-icons/'; + let filename; + + if (this.get('isFolder')) { + filename = 'folder.svg'; + } else { + filename = 'file.svg'; + } + + return prefix + filename; + }.property() }); diff --git a/app/components/item-icon/template.hbs b/app/components/item-icon/template.hbs index 4030b59..e69de29 100644 --- a/app/components/item-icon/template.hbs +++ b/app/components/item-icon/template.hbs @@ -1,5 +0,0 @@ -{{#if isFolder}} - -{{else}} - -{{/if}} \ No newline at end of file diff --git a/app/styles/components/_directory-listing.scss b/app/styles/components/_directory-listing.scss index dfe148d..a7e7254 100644 --- a/app/styles/components/_directory-listing.scss +++ b/app/styles/components/_directory-listing.scss @@ -1,40 +1,51 @@ .directory-listing { - table { + ul.listing { + display: block; width: 100%; margin-bottom: 6rem; - border-collapse: collapse; - thead { - display: none; - } - tbody { - tr { - border-bottom: 1px solid #ececec; + li { + display: table; + width: 100%; + border-bottom: 1px solid #ececec; - &:first-of-type { - border-top: 1px solid #ececec; + &:first-of-type { + border-top: 1px solid #ececec; + } + + &:hover { + span { + opacity: 0.7; + cursor: pointer; } + } - &:hover { - td { - opacity: 0.7; - cursor: pointer; + a { + display: table-row; + text-decoration: none; + color: $dark-grey-1; + + span { + display: table-cell; + padding: 1rem 1.5rem; + + &.icon { + width: 1rem; + padding-right: 0; + text-align: center; + } + &.name { + width: 60%; + } + &.type { + width: 40%; + color: #aaa; } } } - td { - padding: 1rem 1.5rem; - - &.icon { - width: 1rem; - padding-right: 0; - } - &.type { - color: #aaa; - } - } } + } } diff --git a/app/styles/components/_item-icon.scss b/app/styles/components/_item-icon.scss index fc13612..5b7651c 100644 --- a/app/styles/components/_item-icon.scss +++ b/app/styles/components/_item-icon.scss @@ -1,4 +1,4 @@ -.item-icon { +ul.listing span.icon { text-align: center; img { diff --git a/tests/integration/components/directory-listing/component-test.js b/tests/integration/components/directory-listing/component-test.js index 23e24cb..391676b 100644 --- a/tests/integration/components/directory-listing/component-test.js +++ b/tests/integration/components/directory-listing/component-test.js @@ -13,6 +13,7 @@ test('it renders directory items', function(assert) { this.render(hbs`{{directory-listing items=items}}`); - assert.equal(this.$('table tbody tr:first td:nth-of-type(2)').text(), 'documents'); - assert.equal(this.$('table tbody tr:first td:nth-of-type(3)').text(), 'folder'); + assert.equal(this.$('ul li:nth-of-type(1) span.name').text(), 'documents'); + assert.equal(this.$('ul li:nth-of-type(1) span.type').text(), 'folder'); + assert.equal(this.$('ul li:nth-of-type(2) span.name').text(), 'public'); });