From a6c4e7353b4c2f2d7a2cb90708b6b342d1cf3c0d Mon Sep 17 00:00:00 2001 From: Nickiel12 Date: Mon, 19 Feb 2024 19:35:51 -0800 Subject: [PATCH] some more buttons and inputs --- web/sass/buttons.scss | 33 ++++++-------- web/sass/utility-classes.scss | 58 ++++++++++++++++++++++++ web/sass/variables.scss | 6 --- web/static/index.js | 3 ++ web/templates/new_transaction_pane.templ | 17 ++++--- web/templates/transactions.templ | 1 - 6 files changed, 87 insertions(+), 31 deletions(-) diff --git a/web/sass/buttons.scss b/web/sass/buttons.scss index 465630c..df319b1 100644 --- a/web/sass/buttons.scss +++ b/web/sass/buttons.scss @@ -13,13 +13,6 @@ @include btn; } -.btn.invert { - color: var(--#{$prefix}-base) !important; -} -.btn.invert:hover { - color: var(--#{$prefix}-text) !important; -} - .btn-sm { @include btn; padding: 4px 8px 4px 8px; @@ -37,6 +30,21 @@ } } +$button_sizes: ( + "btn", + "btn-sm", +); + +@each $s in $button_sizes { + .#{$s}.invert { + color: var(--#{$prefix}-base) !important; + } + .#{$s}.invert:hover { + color: var(--#{$prefix}-text) !important; + } +} + + .borderless-btn { @include btn; color: var(--#{$prefix}-text); @@ -60,14 +68,3 @@ background-color: var(--#{$prefix}-surface0); } - -$colors: ( - "green", -); - -@each $color in $colors { - .btn.#{$color} { - background-color: var(--#{$prefix}-#{$color}); - } -} - diff --git a/web/sass/utility-classes.scss b/web/sass/utility-classes.scss index fb67e72..3d7469b 100644 --- a/web/sass/utility-classes.scss +++ b/web/sass/utility-classes.scss @@ -195,3 +195,61 @@ table.table-striped { .select.border { border: 2pt solid var(--#{$prefix}-text); } + +.input-sizer { + display: inline-grid; + vertical-align: top; + align-items: center; + position: relative; + border: solid 1px; + padding: .25em .5em; + margin: 5px; + + &.stacked { + padding: .5em; + align-items: stretch; + + &::after, + input, + textarea { + grid-area: 2 / 1; + } + } + + &::after, + input, + textarea { + width: auto; + min-width: 1em; + grid-area: 1 / 2; + font: inherit; + padding: 0.25em; + margin: 0; + resize: none; + background: none; + appearance: none; + border: none; + } + + span { + padding: 0.25em; + } + + &::after { + content: attr(data-value) ' '; + visibility: hidden; + white-space: pre-wrap; + } + + &:focus-within { + outline: solid 1px blue; + box-shadow: 4px 4px 0px blue; + + > span { color: blue; } + + textarea:focus, + input:focus { + outline: none; + } + } +} diff --git a/web/sass/variables.scss b/web/sass/variables.scss index 0d5efe8..f95d1f5 100644 --- a/web/sass/variables.scss +++ b/web/sass/variables.scss @@ -38,9 +38,3 @@ .tc-text { color: var(--#{$prefix}-text); } -.c-s0 { - background-color: var(--#{$prefix}-surface0); -} -.c-s1 { - background-color: var(--#{$prefix}-surface1); -} diff --git a/web/static/index.js b/web/static/index.js index ea21685..e49bb03 100644 --- a/web/static/index.js +++ b/web/static/index.js @@ -58,6 +58,9 @@ function register_handlers() { register_dropdowns(); document.querySelector("#open-draft").addEventListener("click", open_drafts); document.querySelector("#close-transaction-pane").addEventListener("click", close_drafts); + document.querySelector(".input-sizer > input").addEventListener("input", (event) => { + event.target.parentNode.dataset.value = event.target.value + }); close_new_transaction_pane(); } diff --git a/web/templates/new_transaction_pane.templ b/web/templates/new_transaction_pane.templ index ef18e62..52c11db 100644 --- a/web/templates/new_transaction_pane.templ +++ b/web/templates/new_transaction_pane.templ @@ -46,20 +46,25 @@ templ NewTransactionPane(entry_types *[]types.QuickTransactionType, acnts *[]typ
-
-

Breakdown

- - diff --git a/web/templates/transactions.templ b/web/templates/transactions.templ index ce75e96..b2e22c0 100644 --- a/web/templates/transactions.templ +++ b/web/templates/transactions.templ @@ -63,7 +63,6 @@ templ TransactionsPage(userID int, accounts *[]string) { >Add
-