From 293e1ca8cdbae956aad15829d5d4f1904c9ba466 Mon Sep 17 00:00:00 2001 From: Mikko Ahlroth Date: Mon, 24 Jun 2019 16:01:15 +0300 Subject: [PATCH] Add lots of styling --- frontend/index.html | 1 + frontend/src/components/budget-display.ts | 122 +++++++++++++++++++++- frontend/src/components/budget-list.ts | 8 ++ frontend/src/components/styles.ts | 6 ++ 4 files changed, 133 insertions(+), 4 deletions(-) create mode 100644 frontend/src/components/styles.ts diff --git a/frontend/index.html b/frontend/index.html index fd81283..df6842c 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -20,6 +20,7 @@ --shaded-bright: #BFBFBF; --light-accent: #65BABF; --dark-accent: #284B63; + --danger-color: rgb(235, 99, 99); } html { diff --git a/frontend/src/components/budget-display.ts b/frontend/src/components/budget-display.ts index 5e37db6..b55ada2 100644 --- a/frontend/src/components/budget-display.ts +++ b/frontend/src/components/budget-display.ts @@ -1,8 +1,9 @@ -import { LitElement, html } from 'lit-element' +import { LitElement, html, css } from 'lit-element' import { Budget } from '../services/models/budget' import './budget-qr' import './button' import './icon' +import { BudgetEvent } from '../services/models/budget-event' export class SpendMoneyEvent extends CustomEvent<{ budget: Budget, amount: number }> { } @@ -23,6 +24,86 @@ class BudgetDisplayComponent extends LitElement { } } + static get styles() { + return css` + :host { + display: block; + justify-self: center; + } + + h3 { + font-size: 150%; + margin: 0; + } + + h4 { + font-size: 80%; + font-weight: 200; + margin: 0; + } + + h4:before { + content: "ID: "; + } + + h5 { + margin-bottom: 5px; + border-bottom: 1px solid var(--shaded-bright); + } + + p { + margin: 0; + } + + .amounts { + display: grid; + column-gap: 10px; + grid-template: 'now curr' 'of init' / auto 66%; + } + + .money-left { + grid-area: now; + font-size: 200%; + text-align: right; + } + + .money-left[data-negative="t"] { + color: var(--danger-color); + } + + .money-separator { + grid-area: of; + text-transform: uppercase; + text-align: right; + } + + .money-initial { + grid-area: init; + } + + .money-currency { + grid-area: curr; + align-self: center; + } + + .events { + list-style-type: none; + padding: 0; + margin-top: 0; + } + + .event { + display: grid; + grid-template-columns: auto 66%; + column-gap: 10px; + } + + .event-date { + text-align: right; + } + ` + } + constructor() { super() @@ -89,10 +170,27 @@ class BudgetDisplayComponent extends LitElement { return html`

${this.budget.name != '' ? this.budget.name : 'Unnamed budget'}

${this.budget.uuid}

-

${this.budget.amount.toFixed(2)} ${this.budget.currency} left of ${this.budget.init.toFixed(2)} ${this.budget.currency}

-