From 39d891f85137e1ce0ac1e0eaed07b40aab82e72e Mon Sep 17 00:00:00 2001 From: GabrielMeyer Date: Thu, 9 May 2019 16:18:14 +0200 Subject: [PATCH] Adds a new view with tiles to the motion-list - New components 'Tile' and 'GridLayout' - Adds a grid-layout to the view - The grid-layout can have an optional title section --- .../block-tile/block-tile.component.html | 57 ++++ .../block-tile/block-tile.component.scss | 60 ++++ .../block-tile/block-tile.component.spec.ts | 26 ++ .../block-tile/block-tile.component.ts | 115 ++++++++ .../grid-layout/grid-layout.component.html | 15 + .../grid-layout/grid-layout.component.scss | 17 ++ .../grid-layout/grid-layout.component.spec.ts | 26 ++ .../grid-layout/grid-layout.component.ts | 25 ++ .../sort-filter-bar.component.html | 4 + .../components/tile/tile.component.html | 4 + .../components/tile/tile.component.scss | 94 +++++++ .../components/tile/tile.component.spec.ts | 24 ++ .../shared/components/tile/tile.component.ts | 185 +++++++++++++ client/src/app/shared/shared.module.ts | 20 +- .../motion-list/motion-list.component.html | 257 ++++++++++-------- .../motion-list/motion-list.component.scss | 23 ++ .../motion-list/motion-list.component.ts | 123 ++++++++- .../styles/global-components-style.scss | 8 + client/src/assets/styles/media-queries.scss | 51 ++++ client/src/styles.scss | 4 + 20 files changed, 1019 insertions(+), 119 deletions(-) create mode 100644 client/src/app/shared/components/block-tile/block-tile.component.html create mode 100644 client/src/app/shared/components/block-tile/block-tile.component.scss create mode 100644 client/src/app/shared/components/block-tile/block-tile.component.spec.ts create mode 100644 client/src/app/shared/components/block-tile/block-tile.component.ts create mode 100644 client/src/app/shared/components/grid-layout/grid-layout.component.html create mode 100644 client/src/app/shared/components/grid-layout/grid-layout.component.scss create mode 100644 client/src/app/shared/components/grid-layout/grid-layout.component.spec.ts create mode 100644 client/src/app/shared/components/grid-layout/grid-layout.component.ts create mode 100644 client/src/app/shared/components/tile/tile.component.html create mode 100644 client/src/app/shared/components/tile/tile.component.scss create mode 100644 client/src/app/shared/components/tile/tile.component.spec.ts create mode 100644 client/src/app/shared/components/tile/tile.component.ts create mode 100644 client/src/assets/styles/media-queries.scss diff --git a/client/src/app/shared/components/block-tile/block-tile.component.html b/client/src/app/shared/components/block-tile/block-tile.component.html new file mode 100644 index 000000000..4f0f616de --- /dev/null +++ b/client/src/app/shared/components/block-tile/block-tile.component.html @@ -0,0 +1,57 @@ + +
+
+ + + + + + +
+ {{ block }} +
+
+
+ +
+
+ +
+
+
+ + + {{ title }} + + + {{ subtitle }} + + +
+ +
+ + + +
+
+
+ + + + + + + + + + diff --git a/client/src/app/shared/components/block-tile/block-tile.component.scss b/client/src/app/shared/components/block-tile/block-tile.component.scss new file mode 100644 index 000000000..f6b206032 --- /dev/null +++ b/client/src/app/shared/components/block-tile/block-tile.component.scss @@ -0,0 +1,60 @@ +@import '~@angular/material/theming'; + +@mixin os-block-tile-style($theme) { + $primary: map-get( + $map: $theme, + $key: primary + ); + + .block-tile { + padding: 0; + + .block-node-container { + position: relative; + padding-bottom: 50%; + min-width: 30%; + + .tile-text { + padding: 8px 16px; + background-color: mat-color($primary, lighter); + + table { + height: 100%; + width: 100%; + text-align: center; + font-size: 24px; + font-weight: 500; + } + } + } + + .tile-content-node-container { + position: relative; + width: 100%; + margin: 8px 16px !important; + + .tile-content { + margin-bottom: 0; + height: 100%; + + .tile-content-title { + font-size: 20px; + font-weight: unset; + margin-bottom: 0; + overflow: hidden; + } + } + + .tile-content-extra { + padding-top: 8px; + } + } + + &:hover { + cursor: pointer; + + box-shadow: 0px 3px 5px -1px rgba(0, 0, 0, 0.2), 0px 5px 8px 0px rgba(0, 0, 0, 0.14), + 0px 1px 14px 0px rgba(0, 0, 0, 0.12) !important; + } + } +} diff --git a/client/src/app/shared/components/block-tile/block-tile.component.spec.ts b/client/src/app/shared/components/block-tile/block-tile.component.spec.ts new file mode 100644 index 000000000..d29db644f --- /dev/null +++ b/client/src/app/shared/components/block-tile/block-tile.component.spec.ts @@ -0,0 +1,26 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { BlockTileComponent } from './block-tile.component'; +import { E2EImportsModule } from 'e2e-imports.module'; + +describe('BlockTileComponent', () => { + let component: BlockTileComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + imports: [E2EImportsModule] + // declarations: [BlockTileComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(BlockTileComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/client/src/app/shared/components/block-tile/block-tile.component.ts b/client/src/app/shared/components/block-tile/block-tile.component.ts new file mode 100644 index 000000000..8a6f6f5c7 --- /dev/null +++ b/client/src/app/shared/components/block-tile/block-tile.component.ts @@ -0,0 +1,115 @@ +import { Component, TemplateRef, ContentChild, Input } from '@angular/core'; +import { TileComponent } from '../tile/tile.component'; + +/** + * Enumeration to define if the content is only text or a node. + */ +export enum ContentType { + text = 'text', + node = 'node' +} + +/** + * Enumeration to define of which the big block is. + */ +export enum BlockType { + text = 'text', + node = 'node', + picture = 'picture' +} + +/** + * Tells, whether to align the block and content next to each other or one below the other. + */ +export enum Orientation { + horizontal = 'horizontal', + vertical = 'vertical' +} + +/** + * Tells, if the tile should only display the content or the title in the content part. + */ +export enum ShowOnly { + title = 'title', + content = 'content' +} + +/** + * Class, that extends the `tile.component`. + * This class specifies a tile with two separated parts: the block and the content part. + * The block part is like a header, the content part contains further information. + */ +@Component({ + selector: 'os-block-tile', + templateUrl: './block-tile.component.html', + styleUrls: ['./block-tile.component.scss'] +}) +export class BlockTileComponent extends TileComponent { + /** + * Reference to the content of the content part. + */ + @ContentChild(TemplateRef) + public contentNode: TemplateRef; + + /** + * Reference to the block part, if it is a node. + */ + @ContentChild(TemplateRef) + public blockNode: TemplateRef; + + /** + * Reference to the action buttons in the content part, if used. + */ + @ContentChild(TemplateRef) + public actionNode: TemplateRef; + + /** + * Defines the type of the primary block. + */ + @Input() + public blockType: BlockType; + + /** + * Input for the primary block content. + * Only string for the source of a picture or text. + */ + @Input() + public block: string; + + /** + * Defines the type of the content. + */ + @Input() + public contentType: ContentType; + + /** + * The title in the content part. + */ + @Input() + public title: string; + + /** + * The subtitle in the content part. + */ + @Input() + public subtitle: string; + + /** + * Tells the orientation - + * whether the block part should be displayed above the content or next to it. + */ + @Input() + public orientation: Orientation; + + /** + * Tells, whether the tile should display only one of `Title` or `Content` in the content part. + */ + @Input() + public only: ShowOnly; + + /** + * Boolean, whether to show action buttons in the content part. + */ + @Input() + public showActions: boolean; +} diff --git a/client/src/app/shared/components/grid-layout/grid-layout.component.html b/client/src/app/shared/components/grid-layout/grid-layout.component.html new file mode 100644 index 000000000..b3dca2819 --- /dev/null +++ b/client/src/app/shared/components/grid-layout/grid-layout.component.html @@ -0,0 +1,15 @@ +
+

{{ title }}

+ +
+ +
+ +
diff --git a/client/src/app/shared/components/grid-layout/grid-layout.component.scss b/client/src/app/shared/components/grid-layout/grid-layout.component.scss new file mode 100644 index 000000000..47ca069ff --- /dev/null +++ b/client/src/app/shared/components/grid-layout/grid-layout.component.scss @@ -0,0 +1,17 @@ +.heading-container { + padding: 0 16px; +} + +.heading-container.no-space { + padding: 0; +} + +.os-grid { + padding: 8px; + display: flex; + flex-flow: row wrap; +} + +.os-grid.no-space { + padding: 0; +} diff --git a/client/src/app/shared/components/grid-layout/grid-layout.component.spec.ts b/client/src/app/shared/components/grid-layout/grid-layout.component.spec.ts new file mode 100644 index 000000000..97682e139 --- /dev/null +++ b/client/src/app/shared/components/grid-layout/grid-layout.component.spec.ts @@ -0,0 +1,26 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { GridLayoutComponent } from './grid-layout.component'; +import { E2EImportsModule } from 'e2e-imports.module'; + +describe('GridLayoutComponent', () => { + let component: GridLayoutComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + imports: [E2EImportsModule] + // declarations: [GridLayoutComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(GridLayoutComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/client/src/app/shared/components/grid-layout/grid-layout.component.ts b/client/src/app/shared/components/grid-layout/grid-layout.component.ts new file mode 100644 index 000000000..9e971546b --- /dev/null +++ b/client/src/app/shared/components/grid-layout/grid-layout.component.ts @@ -0,0 +1,25 @@ +import { Component, Input } from '@angular/core'; + +/** + * Component to create a `grid-layout`. + * Aligns items in a flex display. + */ +@Component({ + selector: 'os-grid-layout', + templateUrl: './grid-layout.component.html', + styleUrls: ['./grid-layout.component.scss'] +}) +export class GridLayoutComponent { + /** + * Property for an optional title. + */ + @Input() + public title: string; + + /** + * If the grid layout should have no space. + * This contains the padding for the grid itself and the margin of the tiles. + */ + @Input() + public noSpace: boolean; +} diff --git a/client/src/app/shared/components/sort-filter-bar/sort-filter-bar.component.html b/client/src/app/shared/components/sort-filter-bar/sort-filter-bar.component.html index d03372036..f2290c5d9 100644 --- a/client/src/app/shared/components/sort-filter-bar/sort-filter-bar.component.html +++ b/client/src/app/shared/components/sort-filter-bar/sort-filter-bar.component.html @@ -20,6 +20,10 @@
+ + + +