/documents updated: vertical layout
This commit is contained in:
1 parent
6e0149b980
commit
3b48a3a801
5 files changed
+76
-56
No files matched your search
@@ -1,35 +1,25 @@
|
|||||||
import template from '../../templates/components/page-documents.html';
|
import template from '../../templates/components/page-documents.html'
|
||||||
import {unique} from '../../utils/common';
|
import {unique} from '../../utils/common'
|
||||||
|
|
||||||
export default function (app) {
|
export default function (app) {
|
||||||
app.component('pageDocuments', {
|
app.component('pageDocuments', {
|
||||||
bindings: {
|
bindings: {
|
||||||
documents: '<'
|
documents: '<'
|
||||||
},
|
},
|
||||||
template: template,
|
template: template,
|
||||||
controllerAs: '$',
|
controllerAs: '$',
|
||||||
controller: function () {
|
controller: function () {
|
||||||
let categories = unique(i => i.category);
|
const documents = this.documents
|
||||||
|
const uniqueCategories = unique(i => i.category)
|
||||||
|
const documentsOf = category => documents.filter(i => i.category === category)
|
||||||
|
|
||||||
this.collections = [];
|
this.collections = uniqueCategories(documents)
|
||||||
|
.reduce((acc, category) => (
|
||||||
let documents = this.documents;
|
[...acc, {
|
||||||
let cats = categories(documents)
|
name: category,
|
||||||
.map(cat => new Object({
|
documents: documentsOf(category)
|
||||||
name: cat,
|
}]
|
||||||
documents: []
|
), [])
|
||||||
}));
|
}
|
||||||
|
})
|
||||||
let docCollections = documents.reduce(
|
};
|
||||||
(cats, doc) => {
|
|
||||||
let c = cats.find(i => i.name === doc.category);
|
|
||||||
c.documents.push(doc);
|
|
||||||
return cats;
|
|
||||||
},
|
|
||||||
cats
|
|
||||||
);
|
|
||||||
|
|
||||||
this.collections = this.collections.concat(docCollections);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
@@ -2,31 +2,47 @@
|
|||||||
|
|
||||||
.document {
|
.document {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: row;
|
||||||
align-items: center;
|
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0 $single-margin $double-margin;
|
margin-bottom: $single-margin;
|
||||||
|
|
||||||
p {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.document__image{
|
.document__image{
|
||||||
|
min-width: 4em;
|
||||||
|
width: 4em;
|
||||||
|
height: 4em;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: flex-start;
|
||||||
|
//align-items: center;
|
||||||
|
|
||||||
img {
|
img {
|
||||||
width: 100%;
|
max-width: 100%;
|
||||||
|
max-height: 100%;
|
||||||
box-shadow: $white-shadow;
|
box-shadow: $white-shadow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.document__image--medium{
|
.document__image--medium{
|
||||||
max-width: 7.5em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.document__image--big{
|
.document__image--big{
|
||||||
max-width: 20em;
|
max-width: 20em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.document__file {
|
||||||
|
margin-left: $single-margin;
|
||||||
|
flex-grow: 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
.document__file-info {
|
||||||
|
width: 25%;
|
||||||
|
flex-grow: 1;
|
||||||
|
font-size: $smaller-font-size;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: $mobile-width) {
|
@media (max-width: $mobile-width) {
|
||||||
.document {
|
.document {
|
||||||
margin: 0 $single-margin/2 $single-margin;
|
margin: 0 $single-margin/2 $single-margin;
|
||||||
|
|||||||
@@ -1,10 +1,17 @@
|
|||||||
@import "../variables";
|
@import "../variables";
|
||||||
|
|
||||||
.documents-container {
|
.documents-container {
|
||||||
display: flex;
|
margin-bottom: $post-margin;
|
||||||
flex-wrap: wrap;
|
|
||||||
justify-content: center;
|
&__head {
|
||||||
align-items: baseline;
|
margin-bottom: $double-margin;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__body {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: $mobile-width) {
|
@media (max-width: $mobile-width) {
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
<div class="document">
|
<div class="document">
|
||||||
<div class="document__image {{$.imageClass}}">
|
<a href="{{$.document.url}}" target="_blank" class="invisible">
|
||||||
<a href="{{$.document.url}}" target="_blank" class="invisible">
|
<div class="document__image {{$.imageClass}}">
|
||||||
<img ng-src="{{$.previewUrl}}" alt="{{$.document.title}}">
|
<img ng-src="{{$.previewUrl}}" alt="{{$.document.title}}"/>
|
||||||
</a>
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<div class="document__file">
|
||||||
|
<a href="{{$.document.url}}" target="_blank">{{$.document.title | uppercaseFirst}}</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p class="document__file">{{$.document.title | uppercaseFirst}}</p>
|
<div class="document__file-info">
|
||||||
<p class="document__file-info">
|
|
||||||
<a href="{{$.document.url}}" target="_blank">{{$.file.name | ext}} ({{$.file.size | bytes}})</a>
|
<a href="{{$.document.url}}" target="_blank">{{$.file.name | ext}} ({{$.file.size | bytes}})</a>
|
||||||
</p>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,8 +1,12 @@
|
|||||||
<div class="content content_wide content--padding-top--menu">
|
<div class="content content_thin content--padding-top--menu">
|
||||||
<div ng-repeat="c in $.collections">
|
<div class="documents-container"
|
||||||
<h2>{{c.name}}</h2>
|
ng-repeat="c in $.collections"
|
||||||
|
>
|
||||||
|
<div class="documents-container__head">
|
||||||
|
<h3>{{c.name}}</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="documents-container">
|
<div class="documents-container__body">
|
||||||
<document ng-repeat="i in c.documents" document="i"></document>
|
<document ng-repeat="i in c.documents" document="i"></document>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in new issue
Block a user