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.
master
voussoir 2017-12-16 14:13:02 -08:00
parent f59f94cae9
commit e41532cff1
6 changed files with 44 additions and 44 deletions

View File

@ -1,7 +1,8 @@
/* /*
Organization: Organization:
{ {
display and alignment display and flexing
positioning and alignment
bounding box (width, margin, overflow, ...) bounding box (width, margin, overflow, ...)
borders and shadows borders and shadows
backgrounds backgrounds
@ -9,6 +10,12 @@ Organization:
misc 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 body
{ {
display: flex; display: flex;
@ -16,7 +23,7 @@ body
margin: 8px; margin: 8px;
background-color:#00d8f4; background-color: var(--color_site_theme);
} }
li li
{ {
@ -57,50 +64,37 @@ li
flex: 0 0 auto; flex: 0 0 auto;
flex-direction: row; flex-direction: row;
} }
#search_go_button,
.add_tag_button,
.editor_open_button,
.editor_save_button,
.green_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; 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 .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; background-color: #ff4949;
} }
.remove_tag_button:active, .yellow_button
.remove_tag_button_perm:active,
.editor_cancel_button:active,
.red_button:active
{ {
border-top: 2px solid #bd1b1b; background-color: #ffea57;
border-left: 2px solid #bd1b1b; }
border-right: 2px solid #ffacac;
border-bottom: 2px solid #ffacac; .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, .remove_tag_button,

View File

@ -178,6 +178,7 @@ function Editor(elements, on_open, on_save, on_cancel)
this.open_button.innerText = "Edit"; this.open_button.innerText = "Edit";
this.open_button.classList.add("editor_button"); this.open_button.classList.add("editor_button");
this.open_button.classList.add("editor_open_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); this.open_button.onclick = this.bound_open.bind(this);
toolbox.appendChild(this.open_button); 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.innerText = "Save";
this.save_button.classList.add("editor_button"); this.save_button.classList.add("editor_button");
this.save_button.classList.add("editor_save_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.classList.add("hidden");
this.save_button.onclick = this.bound_save.bind(this); this.save_button.onclick = this.bound_save.bind(this);
toolbox.appendChild(this.save_button); 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.innerText = "Cancel";
this.cancel_button.classList.add("editor_button"); this.cancel_button.classList.add("editor_button");
this.cancel_button.classList.add("editor_cancel_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.classList.add("hidden");
this.cancel_button.onclick = this.bound_cancel.bind(this); this.cancel_button.onclick = this.bound_cancel.bind(this);
toolbox.appendChild(this.cancel_button); toolbox.appendChild(this.cancel_button);

View File

@ -155,6 +155,7 @@ function update_clipboard_tray()
var clipboard_line_delete_button = document.createElement("button"); var clipboard_line_delete_button = document.createElement("button");
clipboard_line_delete_button.classList.add("remove_tag_button_perm"); 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; clipboard_line_delete_button.onclick = on_tray_delete_button;
var clipboard_line_link = document.createElement("a"); var clipboard_line_link = document.createElement("a");

View File

@ -2,10 +2,12 @@
<div id="clipboard_tray"> <div id="clipboard_tray">
<button <button
id="clipboard_tray_expandbutton" id="clipboard_tray_expandbutton"
class="green_button" class="yellow_button"
onclick="toggle_clipboard_tray_collapsed()" onclick="toggle_clipboard_tray_collapsed()"
>Clipboard: 0 items</button> >Clipboard: 0 items</button>
<div id="clipboard_tray_body" class="hidden"> <div id="clipboard_tray_body" class="hidden">
<div id="clipboard_tray_toolbox">
</div>
<div id="clipboard_tray_lines"> <div id="clipboard_tray_lines">
</div> </div>
</div> </div>

View File

@ -163,14 +163,14 @@
<ul id="this_tags"> <ul id="this_tags">
<li> <li>
<input id="add_tag_textbox" type="text" autofocus> <input id="add_tag_textbox" type="text" autofocus>
<button id="add_tag_button" class="add_tag_button" onclick="submit_tag(receive_callback);">add</button> <button id="add_tag_button" class="green_button" onclick="submit_tag(receive_callback);">add</button>
</li> </li>
{% set tags = photo.sorted_tags() %} {% set tags = photo.sorted_tags() %}
{% for tag in tags %} {% for tag in tags %}
<li> <li>
{{tag_object.tag_object(tag, qualified_name=True, max_len=30, with_alt_description=True, with_alt_qualified_name=True)}}<!-- {{tag_object.tag_object(tag, qualified_name=True, max_len=30, with_alt_description=True, with_alt_qualified_name=True)}}<!--
--><button --><button
class="remove_tag_button" class="remove_tag_button red_button"
onclick="remove_photo_tag('{{photo.id}}', '{{tag.name}}', receive_callback);"> onclick="remove_photo_tag('{{photo.id}}', '{{tag.name}}', receive_callback);">
</button> </button>
</li> </li>
@ -180,7 +180,7 @@
<!-- METADATA & DOWNLOAD --> <!-- METADATA & DOWNLOAD -->
<h4> <h4>
File info File info
<button id="refresh_metadata_button" class="add_tag_button" onclick="refresh_metadata('{{photo.id}}');">refresh</button> <button id="refresh_metadata_button" class="green_button" onclick="refresh_metadata('{{photo.id}}');">refresh</button>
</h4> </h4>
<ul id="metadata"> <ul id="metadata">
<li>Filename: {{photo.basename}}</li> <li>Filename: {{photo.basename}}</li>

View File

@ -139,7 +139,7 @@ form
<option value="desc" {%if selected_sorter=="desc"%}selected{%endif%} >Descending</option> <option value="desc" {%if selected_sorter=="desc"%}selected{%endif%} >Descending</option>
<option value="asc" {%if selected_sorter=="asc"%}selected{%endif%} >Ascending</option> <option value="asc" {%if selected_sorter=="asc"%}selected{%endif%} >Ascending</option>
</select> </select>
<button class="remove_tag_button_perm" onclick="orderby_remove_hook(this);"></button> <button class="remove_tag_button_perm red_button" onclick="orderby_remove_hook(this);"></button>
</li> </li>
{% endmacro %} {% endmacro %}
</head> </head>
@ -191,7 +191,7 @@ form
{% else %} {% else %}
{{ create_orderby_li(selected_column=0, selected_sorter=0) }} {{ create_orderby_li(selected_column=0, selected_sorter=0) }}
{% endif %} {% endif %}
<li id="search_builder_orderby_newrow"><button class="add_tag_button" onclick="add_new_orderby()">+</button></li> <li id="search_builder_orderby_newrow"><button class="green_button" onclick="add_new_orderby()">+</button></li>
</ul> </ul>
</div> </div>
<br> <br>
@ -265,7 +265,7 @@ form
<option value="grid" {%if search_kwargs['view'] == "grid" %}selected{%endif%}>Grid</option> <option value="grid" {%if search_kwargs['view'] == "grid" %}selected{%endif%}>Grid</option>
<option value="list" {%if search_kwargs['view'] == "list" %}selected{%endif%}>List</option> <option value="list" {%if search_kwargs['view'] == "list" %}selected{%endif%}>List</option>
</select> </select>
<button type="submit" id="search_go_button" value="">Search</button> <button type="submit" id="search_go_button" class="green_button" value="">Search</button>
</form> </form>
{% if total_tags %} {% if total_tags %}
<span>Tags on this page (click to join query):</span> <span>Tags on this page (click to join query):</span>