From e41532cff164864835221906563c455fe469b0b1 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sat, 16 Dec 2017 14:13:02 -0800 Subject: [PATCH] Rearrange some button CSS classes to be more generic. Adds CSS variables for the highlight and shadow so they don't need to be custom-defined for each color of button. Elements should use more generic classes like green_button instead of add_tag_button unless there's a good reason. --- frontends/etiquette_flask/static/common.css | 68 +++++++++---------- frontends/etiquette_flask/static/common.js | 3 + .../etiquette_flask/static/photoclipboard.js | 1 + .../templates/clipboard_tray.html | 4 +- .../etiquette_flask/templates/photo.html | 6 +- .../etiquette_flask/templates/search.html | 6 +- 6 files changed, 44 insertions(+), 44 deletions(-) diff --git a/frontends/etiquette_flask/static/common.css b/frontends/etiquette_flask/static/common.css index 8bc4aae..0ad8ff8 100644 --- a/frontends/etiquette_flask/static/common.css +++ b/frontends/etiquette_flask/static/common.css @@ -1,7 +1,8 @@ /* Organization: { - display and alignment + display and flexing + positioning and alignment bounding box (width, margin, overflow, ...) borders and shadows backgrounds @@ -9,6 +10,12 @@ Organization: misc } */ +:root +{ + --color_site_theme: #00d8f4; + --color_3d_shadow: rgba(0, 0, 0, 0.5); + --color_3d_highlight: rgba(255, 255, 255, 0.5); +} body { display: flex; @@ -16,7 +23,7 @@ body margin: 8px; - background-color:#00d8f4; + background-color: var(--color_site_theme); } li { @@ -57,50 +64,37 @@ li flex: 0 0 auto; flex-direction: row; } -#search_go_button, -.add_tag_button, -.editor_open_button, -.editor_save_button, + .green_button { - border-top: 2px solid #c2ffc3; - border-left: 2px solid #c2ffc3; - border-right: 2px solid #259427; - border-bottom: 2px solid #259427; background-color: #6df16f; } -#search_go_button:active, -.add_tag_button:active, -.editor_open_button:active, -.editor_save_button:active, -.green_button:active -{ - border-top: 2px solid #259427; - border-left: 2px solid #259427; - border-right: 2px solid #c2ffc3; - border-bottom: 2px solid #c2ffc3; -} -.remove_tag_button, -.remove_tag_button_perm, -.editor_cancel_button, .red_button { - border-top: 2px solid #ffacac; - border-left: 2px solid #ffacac; - border-right: 2px solid #bd1b1b; - border-bottom: 2px solid #bd1b1b; - background-color: #ff4949; } -.remove_tag_button:active, -.remove_tag_button_perm:active, -.editor_cancel_button:active, -.red_button:active +.yellow_button { - border-top: 2px solid #bd1b1b; - border-left: 2px solid #bd1b1b; - border-right: 2px solid #ffacac; - border-bottom: 2px solid #ffacac; + background-color: #ffea57; +} + +.green_button, +.red_button, +.yellow_button +{ + border-top: 2px solid var(--color_3d_highlight); + border-left: 2px solid var(--color_3d_highlight); + border-right: 2px solid var(--color_3d_shadow); + border-bottom: 2px solid var(--color_3d_shadow); +} +.green_button:active, +.red_button:active, +.yellow_button:active +{ + border-top: 2px solid var(--color_3d_shadow); + border-left: 2px solid var(--color_3d_shadow); + border-right: 2px solid var(--color_3d_highlight); + border-bottom: 2px solid var(--color_3d_highlight); } .remove_tag_button, diff --git a/frontends/etiquette_flask/static/common.js b/frontends/etiquette_flask/static/common.js index 018aee3..cb74fd1 100644 --- a/frontends/etiquette_flask/static/common.js +++ b/frontends/etiquette_flask/static/common.js @@ -178,6 +178,7 @@ function Editor(elements, on_open, on_save, on_cancel) this.open_button.innerText = "Edit"; this.open_button.classList.add("editor_button"); this.open_button.classList.add("editor_open_button"); + this.open_button.classList.add("green_button"); this.open_button.onclick = this.bound_open.bind(this); toolbox.appendChild(this.open_button); @@ -185,6 +186,7 @@ function Editor(elements, on_open, on_save, on_cancel) this.save_button.innerText = "Save"; this.save_button.classList.add("editor_button"); this.save_button.classList.add("editor_save_button"); + this.save_button.classList.add("green_button"); this.save_button.classList.add("hidden"); this.save_button.onclick = this.bound_save.bind(this); toolbox.appendChild(this.save_button); @@ -193,6 +195,7 @@ function Editor(elements, on_open, on_save, on_cancel) this.cancel_button.innerText = "Cancel"; this.cancel_button.classList.add("editor_button"); this.cancel_button.classList.add("editor_cancel_button"); + this.cancel_button.classList.add("red_button"); this.cancel_button.classList.add("hidden"); this.cancel_button.onclick = this.bound_cancel.bind(this); toolbox.appendChild(this.cancel_button); diff --git a/frontends/etiquette_flask/static/photoclipboard.js b/frontends/etiquette_flask/static/photoclipboard.js index 267643d..93c0cfc 100644 --- a/frontends/etiquette_flask/static/photoclipboard.js +++ b/frontends/etiquette_flask/static/photoclipboard.js @@ -155,6 +155,7 @@ function update_clipboard_tray() var clipboard_line_delete_button = document.createElement("button"); clipboard_line_delete_button.classList.add("remove_tag_button_perm"); + clipboard_line_delete_button.classList.add("red_button"); clipboard_line_delete_button.onclick = on_tray_delete_button; var clipboard_line_link = document.createElement("a"); diff --git a/frontends/etiquette_flask/templates/clipboard_tray.html b/frontends/etiquette_flask/templates/clipboard_tray.html index 80f290e..664104a 100644 --- a/frontends/etiquette_flask/templates/clipboard_tray.html +++ b/frontends/etiquette_flask/templates/clipboard_tray.html @@ -2,10 +2,12 @@
diff --git a/frontends/etiquette_flask/templates/photo.html b/frontends/etiquette_flask/templates/photo.html index d908640..778f23b 100644 --- a/frontends/etiquette_flask/templates/photo.html +++ b/frontends/etiquette_flask/templates/photo.html @@ -163,14 +163,14 @@

@@ -265,7 +265,7 @@ form - + {% if total_tags %} Tags on this page (click to join query):