Compare commits

..

7 Commits

Author SHA1 Message Date
3ebb1560ae Add snack messages after some actions. 2022-03-06 15:10:07 +01:00
e845bfb27f Change some style. 2022-03-06 14:57:01 +01:00
863caeccf3 Disable a button. 2022-03-06 14:45:34 +01:00
9b56dddab9 Use factorized style. 2022-03-06 14:42:24 +01:00
ba11f17531 Use factorized colors. 2022-03-06 14:35:49 +01:00
a08f92c84c Factorize colors. 2022-03-06 14:29:04 +01:00
c027357cfe Refactor header style. 2022-03-06 13:38:02 +01:00
18 changed files with 387 additions and 298 deletions

View File

@@ -24,7 +24,7 @@
padding: 0 3rem; padding: 0 3rem;
border-radius: .1rem; border-radius: .1rem;
border-style: none; border-style: none;
background-color: #444; background-color: var(--secondary);
} }
} }
} }

View File

@@ -20,13 +20,13 @@
</div> </div>
<div class="actions"> <div class="actions">
<div class="row"> <div class="row">
<button class="raised" matRipple matTooltip="Définir une alerte dans X minutes"> <button class="stroked secondary" [disabled]="true" matRipple matTooltip="Définir une alerte dans X minutes">
<mat-icon>update</mat-icon> <mat-icon>update</mat-icon>
Rappel Rappel
</button> </button>
</div> </div>
<div class="row"> <div class="row">
<button class="raised alert" [disabled]="!task" (click)="delete()"> <button class="stroked alert" [disabled]="!task" (click)="delete()">
<mat-icon>delete</mat-icon> <mat-icon>delete</mat-icon>
Supprimer Supprimer
</button> </button>

View File

@@ -5,10 +5,10 @@
align-items: center; align-items: center;
margin-bottom: .5rem; margin-bottom: .5rem;
flex-direction: column; flex-direction: column;
background-color: #444; background-color: var(--secondary);
border-radius: .2rem;
.header { .header {
border-radius: .1rem;
height: 2.5rem; height: 2.5rem;
width: 100%; width: 100%;
display: flex; display: flex;
@@ -21,10 +21,6 @@
} }
} }
mat-checkbox {
// padding: 0 .5rem;
}
.input-container { .input-container {
display: flex; display: flex;
flex-grow: 1; flex-grow: 1;
@@ -34,7 +30,7 @@
height: 1.8rem; height: 1.8rem;
padding: 0 .8rem; padding: 0 .8rem;
margin: 0 .8rem; margin: 0 .8rem;
background-color: #444; background-color: inherit;
border-style: solid; border-style: solid;
border-width: .1rem; border-width: .1rem;
border-color: rgba(0,0,0, 0); border-color: rgba(0,0,0, 0);
@@ -46,7 +42,7 @@
border-color .2s ease-out; border-color .2s ease-out;
&:hover { &:hover {
border-color: rgb(53, 53, 53); border-color: var(--secondary-border);
} }
} }
} }
@@ -61,6 +57,7 @@
visibility: hidden; visibility: hidden;
transition: height .1s ease-in-out; transition: height .1s ease-in-out;
display: flex; display: flex;
border-top: .1rem solid var(--primary-border);
&.expanded { &.expanded {
height: 20rem; height: 20rem;
@@ -82,10 +79,11 @@
textarea { textarea {
flex-grow: 1; flex-grow: 1;
border: 1px solid #444; border: 1px solid var(--secondary-border);
border-radius: .2rem; border-radius: .2rem;
background-color: #4a4a4a; background-color: #ddd;
resize: none; resize: none;
padding: .5rem;
} }
} }
@@ -94,9 +92,7 @@
flex-direction: column; flex-direction: column;
flex-grow: 1; flex-grow: 1;
height: 100%; height: 100%;
max-width: 20%; max-width: 20%;
.row { .row {
display: flex; display: flex;
@@ -108,14 +104,15 @@
button { button {
display: flex; display: flex;
justify-content: left;
flex-grow: 1; flex-grow: 1;
mat-icon {
margin-right: .5rem;
}
} }
} }
} }
} }
} }
}
input, textarea, mat-icon, check-box {
color: #fff;
} }

View File

@@ -1,25 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TaskDisplayComponent } from './task-display.component';
describe('TaskDisplayComponent', () => {
let component: TaskDisplayComponent;
let fixture: ComponentFixture<TaskDisplayComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ TaskDisplayComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(TaskDisplayComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -1,7 +1,9 @@
import { AfterViewInit, Component, ElementRef, EventEmitter, Input, OnDestroy, OnInit, Output, ViewChild } from '@angular/core'; import { AfterViewInit, Component, ElementRef, EventEmitter, Input, OnDestroy, OnInit, Output, ViewChild } from '@angular/core';
import { FormControl } from '@angular/forms'; import { FormControl } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
import { ConfirmDialogComponent, ConfirmDialogModel } from 'src/app/core/components/confirm-dialog/confirm-dialog.component';
import { Task } from 'src/app/core/entity/task'; import { Task } from 'src/app/core/entity/task';
import { TaskListService } from 'src/app/core/service/task-list.service'; import { TaskListService } from 'src/app/core/service/task-list.service';
@@ -21,6 +23,7 @@ export class TaskDisplayComponent implements AfterViewInit, OnDestroy {
private _subscriptions: Subscription[] = []; private _subscriptions: Subscription[] = [];
constructor( constructor(
private _dialog: MatDialog,
private _taskListService: TaskListService private _taskListService: TaskListService
) {} ) {}
@@ -74,7 +77,27 @@ export class TaskDisplayComponent implements AfterViewInit, OnDestroy {
delete(): void { delete(): void {
if (this.task) { if (this.task) {
this._taskListService.delete(this.task); const confirmData = {
title: `Supprimer la tâche ${this.task.title} ?`,
description: 'Une fois supprimé, sa description sera perdue définitivement.',
confirmButtonLabel: 'Supprimer la tâche',
confirmButtonType: 'alert'
} as ConfirmDialogModel;
const dialogRef = this._dialog.open(
ConfirmDialogComponent,
{
width: '30rem',
data: confirmData
}
);
const afterDialogCloseSubscription = dialogRef.afterClosed().subscribe(result => {
if (result && this.task) {
this._taskListService.delete(this.task);
}
})
this._subscriptions.push(afterDialogCloseSubscription);
} }
} }
} }

View File

@@ -6,9 +6,9 @@
<div class="description">{{data.description}}</div> <div class="description">{{data.description}}</div>
</div> </div>
</div> </div>
<div class="actions"> <div class="dialog-actions">
<button class="raised" (click)="cancel()">Annuler</button> <button class="stroked" (click)="cancel()">Annuler</button>
<button class="raised" <button class="stroked"
(click)="confirm()" (click)="confirm()"
[ngClass]="data.confirmButtonType"> [ngClass]="data.confirmButtonType">
{{data.confirmButtonLabel}} {{data.confirmButtonLabel}}

View File

@@ -32,14 +32,4 @@
} }
} }
} }
.actions {
margin-top: 1rem;
display: flex;
justify-content: space-between;
> * {
flex: 1 1 45%;
max-width: 45%;
}
}
} }

View File

@@ -1,21 +1,35 @@
<nav *ngIf="!selectionMode"> <nav *ngIf="!selectionMode">
<span class="title"> <div class="left">
<img src="../../assets/images/to-do.png" /> <span class="title">
To Do <img src="../../assets/images/to-do.png" />
</span> To Do
<button *ngIf="!activeTaskList" </span>
(click)="openNewListForm()" <button *ngIf="!activeTaskList"
class="raised" (click)="openNewListForm()"
matRipple> class="stroked primary"
Nouvelle liste matRipple>
</button> Nouvelle liste
<button *ngIf="activeTaskList" </button>
(click)="goTaskListsPane()" <button *ngIf="activeTaskList"
class="icon raised" (click)="goTaskListsPane()"
matRipple class="icon stroked primary"
matTooltip="Retourner aux task-lists"> matRipple
<mat-icon>chevron_left</mat-icon> matTooltip="Retourner aux task-lists">
</button> <mat-icon>chevron_left</mat-icon>
</button>
</div>
<div class="middle" *ngIf="activeTaskList">
{{activeTaskList.name}}
</div>
<div class="right">
<button class="icon stroked primary"
(click)="enableSelectionMode()"
[disabled]="isNoAnyTaskList()"
matTooltip="Activer la sélection des task-lists"
matTooltipPosition="left">
<mat-icon>checklist_rtl</mat-icon>
</button>
</div>
</nav> </nav>
<nav *ngIf="selectionMode" class="selectionMode"> <nav *ngIf="selectionMode" class="selectionMode">
<div></div> <div></div>
@@ -23,6 +37,6 @@
Cliquez sur une liste pour la sélectionner Cliquez sur une liste pour la sélectionner
</div> </div>
<div class="actions"> <div class="actions">
<button class="raised" (click)="disableSelectionMode()">Annuler</button> <button class="stroked primary" (click)="disableSelectionMode()">Annuler</button>
</div> </div>
</nav> </nav>

View File

@@ -6,11 +6,36 @@ nav {
display: flex; display: flex;
align-items: center; align-items: center;
height: 3.2rem; height: 3.2rem;
background-color: #666; background-color: #eee;
.left {
position: absolute;
left: 1rem;
display: flex;
flex-direction: row;
align-items: center;
.title {
font-size: 1.5rem;
display: flex;
align-items: center;
margin-right: 1rem;
}
}
.middle {
display: flex;
margin: auto;
}
.right {
position: absolute;
right: 1rem;
}
&.selectionMode { &.selectionMode {
font-weight: bold; font-weight: bold;
background-color: #185eb4; background-color: var(--selection);
color: white; color: white;
display: flex; display: flex;
justify-content: center; justify-content: center;
@@ -21,11 +46,4 @@ nav {
margin: 0 1rem; margin: 0 1rem;
} }
} }
.title {
font-size: 1.5rem;
margin: 0 1rem;
display: flex;
align-items: center;
}
} }

View File

@@ -13,18 +13,15 @@ import { TaskListService } from '../../service/task-list.service';
}) })
export class HeaderComponent implements OnInit, OnDestroy { export class HeaderComponent implements OnInit, OnDestroy {
private _storeSubscription?: Subscription; private _storeSubscription?: Subscription;
activeTaskList?: TaskList;
selectionMode = false; selectionMode = false;
constructor( constructor(
private _dialog: MatDialog, private _dialog: MatDialog,
private _router: Router,
private _taskListService: TaskListService private _taskListService: TaskListService
) {} ) {}
ngOnInit(): void { ngOnInit(): void {
this._storeSubscription = this._taskListService.store$.subscribe(store => { this._storeSubscription = this._taskListService.store$.subscribe(store => {
this.activeTaskList = store.taskLists.find(taskList => store.activeTaskListId === taskList.id);
this.selectionMode = store.selectionMode; this.selectionMode = store.selectionMode;
}); });
} }
@@ -46,7 +43,19 @@ export class HeaderComponent implements OnInit, OnDestroy {
this._taskListService.removeActiveTaskList(); this._taskListService.removeActiveTaskList();
} }
enableSelectionMode(): void {
this._taskListService.enableSelectionMode();
}
disableSelectionMode(): void { disableSelectionMode(): void {
this._taskListService.disableSelectionMode(); this._taskListService.disableSelectionMode();
} }
isNoAnyTaskList(): boolean {
return this._taskListService.isNoAnyTaskList();
}
get activeTaskList(): TaskList | undefined {
return this._taskListService.activeTaskList;
}
} }

View File

@@ -7,204 +7,217 @@ import { v4 as uuidv4 } from 'uuid';
import { filter } from 'rxjs/operators'; import { filter } from 'rxjs/operators';
import { Store } from "../entity/store"; import { Store } from "../entity/store";
import { Router } from "@angular/router"; import { Router } from "@angular/router";
import { MatSnackBar } from "@angular/material/snack-bar";
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class TaskListService { export class TaskListService {
private _store: BehaviorSubject<Store> = new BehaviorSubject<Store>(undefined as unknown as Store); private _store: BehaviorSubject<Store> = new BehaviorSubject<Store>(undefined as unknown as Store);
constructor( constructor(
private _router: Router, private _router: Router,
private _storePersistenceService: StorePersistenceService private _snackBar: MatSnackBar,
) { private _storePersistenceService: StorePersistenceService
this.store$.subscribe(store => { ) {
this.saveStore(store, true); this.store$.subscribe(store => {
}); this.saveStore(store, true);
} });
}
get store$(): Observable<Store> {
return this._store.asObservable() get store$(): Observable<Store> {
.pipe(filter(store => !!store)); return this._store.asObservable()
} .pipe(filter(store => !!store));
}
private get store(): Store {
let result = this._store.value; private get store(): Store {
let result = this._store.value;
if (!result) { if (!result) {
result = this._storePersistenceService.load(); result = this._storePersistenceService.load();
} }
return result; return result;
} }
private saveStore(store: Store, silent: boolean = false): void { private saveStore(store: Store, silent: boolean = false): void {
if (silent) { if (silent) {
this._storePersistenceService.save(store); this._storePersistenceService.save(store);
} else { } else {
// We send the store into the subject because there is an observable on in, that saves the store at every single value. // We send the store into the subject because there is an observable on in, that saves the store at every single value.
this._store.next(store); this._store.next(store);
} }
} }
addTask(taskTitle: string): void { addTask(taskTitle: string): void {
const store = this.store; const store = this.store;
const activeTaskList = store.taskLists.find(taskList => taskList.id === store.activeTaskListId); const activeTaskList = store.taskLists.find(taskList => taskList.id === store.activeTaskListId);
if (!activeTaskList) { if (!activeTaskList) {
throw new Error("No active tasklist"); throw new Error("No active tasklist");
} }
if (!activeTaskList.tasks) { if (!activeTaskList.tasks) {
activeTaskList.tasks = []; activeTaskList.tasks = [];
} }
const newTask = { const newTask = {
id: uuidv4(), id: uuidv4(),
title: taskTitle, title: taskTitle,
creationDate: new Date(), creationDate: new Date(),
description: undefined as unknown as string description: undefined as unknown as string
} as Task; } as Task;
activeTaskList?.tasks.push(newTask); activeTaskList?.tasks.push(newTask);
this.saveStore(store); this.saveStore(store);
} this._snackBar.open('Tâche ajoutée.', 'Fermer', {duration: 2000});
}
updateTask(taskToUpdate: Task) {
const store = this.store; updateTask(taskToUpdate: Task) {
const activeTaskList = store.taskLists.find(taskList => taskList.id === store.activeTaskListId); const store = this.store;
if (!activeTaskList) { const activeTaskList = store.taskLists.find(taskList => taskList.id === store.activeTaskListId);
throw new Error("No active tasklist"); if (!activeTaskList) {
} throw new Error("No active tasklist");
}
const task = activeTaskList?.tasks.find(task => task.id === taskToUpdate.id); const task = activeTaskList?.tasks.find(task => task.id === taskToUpdate.id);
if (!task) { if (!task) {
throw new Error('Unknown task to update'); throw new Error('Unknown task to update');
} }
task.title = taskToUpdate.title; task.title = taskToUpdate.title;
task.description = taskToUpdate.description; task.description = taskToUpdate.description;
// If the store is saved loudly, all views will be refreshed and the user will lose the focus of its input, // If the store is saved loudly, all views will be refreshed and the user will lose the focus of its input,
// so we save the store silently here. // so we save the store silently here.
this.saveStore(store, true); this.saveStore(store, true);
} }
delete(taskToDelete: Task) {
const store = this.store;
const activeTaskList = store.taskLists.find(taskList => taskList.id === store.activeTaskListId);
if (!activeTaskList) {
throw new Error("No active tasklist");
}
const taskIndex = activeTaskList?.tasks.findIndex(task => task.id === taskToDelete.id); delete(taskToDelete: Task) {
if (!taskIndex && taskIndex !== 0) { const store = this.store;
throw new Error('Unknown task to delete'); const activeTaskList = store.taskLists.find(taskList => taskList.id === store.activeTaskListId);
} if (!activeTaskList) {
throw new Error("No active tasklist");
}
activeTaskList?.tasks.splice(taskIndex, 1); const taskIndex = activeTaskList?.tasks.findIndex(task => task.id === taskToDelete.id);
this.saveStore(store); if (!taskIndex && taskIndex !== 0) {
} throw new Error('Unknown task to delete');
}
createTaskList(taskListName: string): void { activeTaskList?.tasks.splice(taskIndex, 1);
const newTaskList = { this.saveStore(store);
id: uuidv4(), this._snackBar.open('Tâche supprimée.', 'Fermer', {duration: 2000});
name: taskListName, }
tasks: []
} as TaskList;
const store = this.store; createTaskList(taskListName: string): void {
store.taskLists.push(newTaskList); const newTaskList = {
this.saveStore(store); id: uuidv4(),
} name: taskListName,
tasks: []
} as TaskList;
updateTaskListName(taskListToUpdate: TaskList): void { const store = this.store;
const store = this.store; store.taskLists.push(newTaskList);
const matchingTaskList = store.taskLists.find(taskList => taskList.id === taskListToUpdate.id); this.saveStore(store);
if (matchingTaskList) { }
matchingTaskList.name = taskListToUpdate.name;
this.saveStore(store);
this.disableSelectionMode();
}
}
deleteSelectedTaskLists(): void { updateTaskListName(taskListToUpdate: TaskList): void {
const store = this.store; const store = this.store;
const nonSelectedTaskLists = store.taskLists.filter(taskList => !store.selectedTaskLists.some(selectedTaskList => selectedTaskList.id === taskList.id)); const matchingTaskList = store.taskLists.find(taskList => taskList.id === taskListToUpdate.id);
store.taskLists = nonSelectedTaskLists; if (matchingTaskList) {
this.saveStore(store); matchingTaskList.name = taskListToUpdate.name;
this.disableSelectionMode(); this.saveStore(store);
} this.disableSelectionMode();
}
}
getAll(): TaskList[] { deleteSelectedTaskLists(): void {
return this.store.taskLists ?? []; const store = this.store;
} const nonSelectedTaskLists = store.taskLists.filter(taskList => !store.selectedTaskLists.some(selectedTaskList => selectedTaskList.id === taskList.id));
store.taskLists = nonSelectedTaskLists;
this.saveStore(store);
this.disableSelectionMode();
}
setActive(taskList: TaskList): void { getAll(): TaskList[] {
const store = this.store; return this.store.taskLists ?? [];
store.activeTaskListId = taskList.id; }
this.saveStore(store);
this._router.navigate(['/task-lists/active']);
}
removeActiveTaskList(): void { setActive(taskList: TaskList): void {
const store = this.store; const store = this.store;
delete store.activeTaskListId; store.activeTaskListId = taskList.id;
this.saveStore(store); this.saveStore(store);
this._router.navigate(['/']); this._router.navigate(['/task-lists/active']);
} }
selectTaskList(taskList: TaskList): void { removeActiveTaskList(): void {
this.enableSelectionMode(); const store = this.store;
delete store.activeTaskListId;
this.saveStore(store);
this._router.navigate(['/']);
}
const store = this.store; selectTaskList(taskList: TaskList): void {
this.enableSelectionMode();
if (!store.selectedTaskLists) { const store = this.store;
store.selectedTaskLists = [];
}
if (store.selectedTaskLists.some(tl => tl.id === taskList.id)) { if (!store.selectedTaskLists) {
const selectedTaskListIndex = store.selectedTaskLists.findIndex(tl => tl.id === taskList.id); store.selectedTaskLists = [];
store.selectedTaskLists.splice(selectedTaskListIndex, 1); }
if (!store.selectedTaskLists.length) { if (store.selectedTaskLists.some(tl => tl.id === taskList.id)) {
store.selectionMode = false; const selectedTaskListIndex = store.selectedTaskLists.findIndex(tl => tl.id === taskList.id);
} store.selectedTaskLists.splice(selectedTaskListIndex, 1);
this.saveStore(store); if (!store.selectedTaskLists.length) {
} else { store.selectionMode = false;
store.selectedTaskLists.push(taskList); }
this.saveStore(store);
}
}
isSelected(taskList: TaskList): boolean { this.saveStore(store);
const store = this.store; } else {
return store.selectedTaskLists && store.selectedTaskLists.some(tl => tl.id === taskList.id); store.selectedTaskLists.push(taskList);
} this.saveStore(store);
}
}
isSelectionModeEnabled(): boolean { isSelected(taskList: TaskList): boolean {
return this.store.selectionMode; const store = this.store;
} return store.selectedTaskLists && store.selectedTaskLists.some(tl => tl.id === taskList.id);
}
enableSelectionMode(): void { isSelectionModeEnabled(): boolean {
const store = this.store; return this.store.selectionMode;
store.selectionMode = true; }
this.saveStore(store);
}
disableSelectionMode(): void { enableSelectionMode(): void {
const store = this.store; const store = this.store;
store.selectionMode = false; store.selectionMode = true;
store.selectedTaskLists = []; this.saveStore(store);
this.saveStore(store); }
}
isThereMultipleTaskListsSelected(): boolean { disableSelectionMode(): void {
const store = this.store; const store = this.store;
return (store.selectedTaskLists?.length ?? 0) > 1; store.selectionMode = false;
} store.selectedTaskLists = [];
this.saveStore(store);
}
get selectedTaskList(): TaskList { isThereMultipleTaskListsSelected(): boolean {
return this._store.value?.selectedTaskLists[0]; const store = this.store;
} return (store.selectedTaskLists?.length ?? 0) > 1;
}
get selectedTaskList(): TaskList {
return this._store.value?.selectedTaskLists[0];
}
isNoAnyTaskList(): boolean {
return !this.store?.taskLists?.length;
}
get activeTaskList(): TaskList | undefined {
const store = this.store;
return store.taskLists.find(taskList => taskList.id === store.activeTaskListId);
}
} }

View File

@@ -9,8 +9,8 @@
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
</p> </p>
<div class="actions"> <div class="dialog-actions">
<button class="raised" type="button" (click)="close()">Annuler</button> <button class="stroked primary" type="button" (click)="close()">Annuler</button>
<button class="raised" type="submit">Créer une liste</button> <button class="stroked primary" type="submit">Créer une liste</button>
</div> </div>
</form> </form>

View File

@@ -4,9 +4,4 @@ form {
width: 100%; width: 100%;
} }
} }
.actions {
display: flex;
flex-direction: row;
justify-content: space-between;
}
} }

View File

@@ -9,8 +9,8 @@
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
</p> </p>
<div class="actions"> <div class="dialog-actions">
<button class="raised" type="button" (click)="close()">Annuler</button> <button class="stroked" type="button" (click)="close()">Annuler</button>
<button class="raised" type="submit">Renommer la liste</button> <button class="stroked" type="submit">Renommer la liste</button>
</div> </div>
</form> </form>

View File

@@ -4,9 +4,4 @@ form {
width: 100%; width: 100%;
} }
} }
.actions {
display: flex;
flex-direction: row;
justify-content: space-between;
}
} }

View File

@@ -25,11 +25,11 @@
</div> </div>
</div> </div>
<div class="selection-actions" *ngIf="isSelectionModeEnabled()"> <div class="selection-actions" *ngIf="isSelectionModeEnabled()">
<button class="raised" <button class="stroked"
[disabled]="isThereMultipleTaskListsSelected()" [disabled]="isThereMultipleTaskListsSelected()"
(click)="renameSelectedTaskList()"> (click)="renameSelectedTaskList()">
Renommer Renommer
</button> </button>
<button class="raised alert" <button class="stroked alert"
(click)="deleteSelectedTaskLists()">Supprimer</button> (click)="deleteSelectedTaskLists()">Supprimer</button>
</div> </div>

View File

@@ -62,7 +62,7 @@ export class TaskListsComponent implements OnInit, OnDestroy {
this._dialog.open( this._dialog.open(
RenameTaskListComponent, RenameTaskListComponent,
{ {
width: '20rem' width: '25rem'
} }
); );
} }

View File

@@ -1,25 +1,50 @@
/* You can add global styles to this file, and also import other style files */ /* You can add global styles to this file, and also import other style files */
:root {
--primary: #fff;
--primary-text: #444444;
--primary-border: #ccc;
--primary-hover: #eee;
--secondary: #eee;
--secondary-hover: #c9c9c9;
--secondary-border: #bbb;
--disabled: #eee;
--disabled-text: #aaa;
--transparent: rgba(0,0,0, 0);
--shadow-1: rgba(0, 0, 0, 0.2);
--shadow-2: rgba(0, 0, 0, 0.14);
--shadow-3: rgba(0, 0, 0, 0.12);
--shadow-hover: #777;
--alert: #eb1d3f;
--alert-text: #fff;
--alert-hover: #c20d2b;
--alert-border: #b91b35;
--selection: #185eb4;
}
html { html {
height: 100%; height: 100%;
} }
body { body {
margin: 0; margin: 0;
font-family: Roboto, "Helvetica Neue", sans-serif; font-family: Roboto, "Helvetica Neue", sans-serif;
padding-top: 3.2rem; padding-top: 3.2rem;
background-color: #555; background-color: var(--primary);
} }
.shadowed { .shadowed {
box-shadow: 0px 2px 1px -1px rgba(0, 0, 0, 0.2),0px 1px 1px 0px rgba(0, 0, 0, 0.14),0px 1px 3px 0px rgba(0, 0, 0, 0.12); box-shadow: 0px 2px 1px -1px var(--shadow-1),
0px 1px 1px 0px var(--shadow-2),
0px 1px 3px 0px var(--shadow-3);
transition: box-shadow .2s ease-out; transition: box-shadow .2s ease-out;
&:hover { &:hover {
box-shadow: 0 .2em .5em #777; box-shadow: 0 .2em .5em var(--shadow-hover);
} }
} }
@@ -28,29 +53,31 @@ a.no-style {
text-decoration: none; text-decoration: none;
} }
button { button {
border-style: solid; border-style: solid;
border-width: .1rem; border-width: .1rem;
border-color: rgba(0,0,0, 0); border-color: var(--transparent);
border-radius: .2rem; border-radius: .2rem;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
padding: .5rem; padding: .5rem;
color: #fff; background-color: var(--transparent);
color: var(--primary-text);
transition: background-color .2s ease-out, transition: background-color .2s ease-out,
border-color .2s ease-out; border-color .2s ease-out;
&:hover { &:hover {
background-color: #666; background-color: var(--primary-hover);
border-color: rgb(53, 53, 53); border-color: var(--primary-border);
} }
&:disabled { &:disabled {
background-color: #aaa; background-color: var(--disabled);
color: #ccc; color: var(--disabled-text);
cursor: not-allowed; cursor: not-allowed;
} }
@@ -60,20 +87,53 @@ button {
min-width: 1rem; min-width: 1rem;
min-height: 1rem; min-height: 1rem;
padding: 0; padding: 0;
background-color: inherit;
} }
&.raised { &.raised {
background-color: #4a4a4a; background-color: var(--primary); //#4a4a4a;
box-shadow: 0px 2px 1px -1px var(--shadow-1),
0px 1px 1px 0px var(--shadow-2),
0px 1px 3px 0px var(--shadow-3);
}
&.stroked {
border-color: var(--primary-border);
&.primary {
background-color: var(--primary);
&:hover {
background-color: var(--primary-hover);
}
}
&.secondary {
background-color: var(--secondary);
&:hover {
background-color: var(--secondary-hover)
}
}
} }
&.alert { &.alert {
background: #F93154; background-color: var(--alert);
color: #fff; color: var(--alert-text);
:hover { &:hover {
background-color: #f83e5d; background-color: var(--alert-hover);
border-color: #b91b35; border-color: var(--alert-border);
} }
} }
}
.dialog-actions {
margin-top: 1rem;
display: flex;
justify-content: space-between;
> * {
flex: 1 1 45%;
max-width: 45%;
}
} }