From 16886d6e30225c90cb38ce1a4c4432d216f0f385 Mon Sep 17 00:00:00 2001 From: Fernando Quant Date: Sat, 30 Jan 2021 06:06:09 +0000 Subject: [PATCH] Remove theme name and column controllers. Make themes into a fixed sized and the column responsive. --- .../components/themes/themes.component.html | 17 +++------ .../components/themes/themes.component.scss | 20 ++++++++++- src/app/components/themes/themes.component.ts | 35 ------------------- 3 files changed, 24 insertions(+), 48 deletions(-) diff --git a/src/app/components/themes/themes.component.html b/src/app/components/themes/themes.component.html index e69934a..05daacb 100644 --- a/src/app/components/themes/themes.component.html +++ b/src/app/components/themes/themes.component.html @@ -1,6 +1,6 @@

Theme Options

-
+
Theme level @@ -10,20 +10,13 @@ Song - - Names - - - Columns - -
-
-
- +
+
+ -
{{ theme.name }}
+
{{ theme.name }}
diff --git a/src/app/components/themes/themes.component.scss b/src/app/components/themes/themes.component.scss index b663255..66a9c86 100644 --- a/src/app/components/themes/themes.component.scss +++ b/src/app/components/themes/themes.component.scss @@ -21,6 +21,24 @@ img { font-weight: 700; } +.theme-container { + display: grid; + justify-content: space-evenly; + grid-template-columns: repeat(auto-fill, min(220px, 100%)); + gap: 1rem; +} + +.theme-card { + +} + .theme-title { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.theme-title:hover { + overflow: visible; white-space: pre-wrap; -} \ No newline at end of file +} diff --git a/src/app/components/themes/themes.component.ts b/src/app/components/themes/themes.component.ts index cdd811a..3970788 100644 --- a/src/app/components/themes/themes.component.ts +++ b/src/app/components/themes/themes.component.ts @@ -1,6 +1,4 @@ import { Component, OnInit } from '@angular/core'; -import { MatSlideToggleChange } from '@angular/material/slide-toggle'; - import { OpenLPService } from '../../openlp.service'; import { PageTitleService } from '../../page-title.service'; @@ -14,19 +12,12 @@ export class ThemesComponent implements OnInit { private _theme = null; private _themeList = []; private _themeLevel = null; - // Layout variables - private _displayNames = true; - private _columns = '6'; // Stored as string for mat-select to work properly - private _colWidth; - private _padding; - private _paddingRatio = .5; // How much of a column the sum of all the paddings equals to constructor(private pageTitleService: PageTitleService, private openlpService: OpenLPService) { pageTitleService.changePageTitle('Themes'); } ngOnInit() { - this.setLayout(this._columns); this.getThemeLevel(); this.getThemes(); } @@ -44,14 +35,6 @@ export class ThemesComponent implements OnInit { this.openlpService.setThemeLevel(level).subscribe(() => this.getTheme()); } - get displayNames() { - return this._displayNames; - } - - get columns(): string { - return this._columns; - } - isThemeLevelSupported(): boolean { return this._themeLevel !== 'song'; } @@ -79,22 +62,4 @@ export class ThemesComponent implements OnInit { setTheme(themeName: string) { this.openlpService.setTheme(themeName).subscribe(() => this.getTheme()); } - - setLayout(columns: string) { - if (parseInt(columns, 10) <= 0) { columns = '1'; } - this._columns = columns; - const intColumns = parseInt(columns, 10); // We convert to int to be able to do the math operations - if (intColumns === 1) { - this._colWidth = 100; - this._padding = 0; - } - else { - this._colWidth = 100 / (intColumns + this._paddingRatio); - this._padding = `${(this._paddingRatio * this._colWidth) / intColumns}%`; - } - } - - toggleNames(value: boolean) { - this._displayNames = value; - } }