From 57e8579a17376aeb3a548fdfa34b71d47252da1a Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Thu, 30 Mar 2017 19:34:39 -0700 Subject: [PATCH] Better organize CSS properties by type --- static/common.css | 93 +++++++++++++++++++++++++++------------- templates/bookmarks.html | 7 ++- templates/login.html | 11 +++-- templates/photo.html | 14 +++--- templates/root.html | 2 +- templates/search.html | 32 +++++++++----- templates/tags.html | 30 +++++++------ 7 files changed, 124 insertions(+), 65 deletions(-) diff --git a/static/common.css b/static/common.css index f59c57a..a736f2a 100644 --- a/static/common.css +++ b/static/common.css @@ -1,9 +1,22 @@ +/* +Organization: +{ + display and alignment + bounding box (width, margin, overflow, ...) + borders and shadows + backgrounds + foregrounds + misc +} +*/ body { display: flex; flex-direction: column; - background-color:#00d8f4; + margin: 8px; + + background-color:#00d8f4; } li { @@ -15,13 +28,15 @@ li flex-direction: row; justify-content: center; align-content: center; + margin-bottom: 4px; } .header_element { display: flex; - justify-content: center; flex: 1; + justify-content: center; + background-color: rgba(0, 0, 0, 0.1); } .header_element:hover @@ -30,8 +45,8 @@ li } #content_body { - flex: 0 0 auto; display: flex; + flex: 0 0 auto; flex-direction: row; } .add_tag_button, #search_go_button @@ -54,15 +69,18 @@ li { /*position: absolute;*/ top: 3px; + vertical-align: middle; + width: 18px; height: 14px; padding: 0; - vertical-align: middle; - background-color: #ff4949; + 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 { @@ -84,27 +102,31 @@ li } .photo_card_list { - background-color: #ffffd4; - display: block; - padding: 4px; - margin: 8px; display: flex; flex-direction: row; justify-content: space-between; + + margin: 8px; + padding: 4px; + + background-color: #ffffd4; } .photo_card_grid { display: inline-flex; flex-direction: column; - box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.25); + vertical-align: middle; + min-width: 150px; max-width: 300px; height: 200px; - background-color: #ffffd4; padding: 8px; margin: 8px; + border-radius: 8px; - vertical-align: middle; + box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.25); + + background-color: #ffffd4; } .photo_card_grid_thumb { @@ -138,27 +160,32 @@ li flex: 1; flex-direction: column; justify-content: space-between; - font-size: 12.8px; + background-color: inherit; + + font-size: 12.8px; } .photo_card_grid_filename { - background-color: inherit; - max-height: 30px; - overflow: hidden; align-self: flex-start; - word-break:break-word; - z-index: 1; /* The width of photo cards should be based on the aspect ratio of the thumbnail image. Previously, I had problems where the card would be wider than necessary because the file had a long name. These min-width:100% + width:0 prevent the info div from controlling - card size, prioritizing the thumbnail. + card size, so we can prioritize the thumbnail instead. */ min-width: 100%; width: 0; + overflow: hidden; + z-index: 1; + + max-height: 30px; + + background-color: inherit; + + word-break:break-word; } .photo_card_grid_filename a { @@ -170,11 +197,12 @@ li } .photo_card_grid_file_metadata { + display: flex; + z-index: 0; + justify-content: space-between; + font-family: monospace; font-size: 11px; - display: flex; - justify-content: space-between; - z-index: 0; } .photo_card_grid_tags { @@ -187,29 +215,34 @@ li } .tag_object { - font-size: 0.9em; - background-color: #fff; border-radius: 2px; + + background-color: #fff; + + font-size: 0.9em; text-decoration: none; font-family: monospace; line-height: 1.3; } #message_area { - overflow-y: auto; - background-color: rgba(0, 0, 0, 0.1); - width: 100%; - height: 100%; - max-height: 300px; display: flex; + flex: 2; flex-direction: column; align-items: center; - flex: 2; + + max-height: 300px; + width: 100%; + height: 100%; + overflow-y: auto; + + background-color: rgba(0, 0, 0, 0.1); } .message_bubble { width: 80%; margin: 4px; + word-wrap: break-word; } .message_positive diff --git a/templates/bookmarks.html b/templates/bookmarks.html index f3a3fef..a60bc32 100644 --- a/templates/bookmarks.html +++ b/templates/bookmarks.html @@ -16,15 +16,18 @@ } .bookmark_card { - background-color: #ffffd4; display: inline-flex; flex: 0 0 auto; flex-direction: column; + align-items: baseline; + padding: 8px; margin: 8px; - align-items: baseline; + border-radius: 8px; box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.25); + + background-color: #ffffd4; } .bookmark_card .bookmark_url { diff --git a/templates/login.html b/templates/login.html index ed6a4f6..6598832 100644 --- a/templates/login.html +++ b/templates/login.html @@ -20,10 +20,11 @@ button #content_body { display: flex; + flex: 1; flex-direction: column; justify-content: center; align-items: center; - flex: 1; + max-width: 900px; margin-left: auto; margin-right: auto; @@ -38,12 +39,14 @@ button #login_form, #register_form { - padding: 10px; - border-radius: 5px; display: flex; flex-direction: column; - border: 1px solid black; + + padding: 10px; margin: 10px; + + border-radius: 5px; + border: 1px solid black; } #login_form > *, #register_form > * diff --git a/templates/photo.html b/templates/photo.html index 7d221e5..e6989df 100644 --- a/templates/photo.html +++ b/templates/photo.html @@ -13,8 +13,8 @@ #content_body { /* Override common.css */ - flex-direction: row; flex: 1; + flex-direction: row; } #left { @@ -23,14 +23,16 @@ } #right { - flex: 1; display: flex; + flex: 1; } #editor_holder { + flex-direction: column; + max-width: 300px; padding: 8px; - flex-direction: column; + background-color: rgba(0, 0, 0, 0.1); } #editor_area @@ -58,11 +60,13 @@ } #photo_img_holder { - height: 100%; - width: 100%; display: flex; justify-content: center; align-items: center; + + height: 100%; + width: 100%; + background-repeat: no-repeat; } #photo_img_holder img diff --git a/templates/root.html b/templates/root.html index 58e10f2..fd55211 100644 --- a/templates/root.html +++ b/templates/root.html @@ -15,8 +15,8 @@ body, .nice_link } .nice_link, .plain_link { - margin: 8px; height: 40px; + margin: 8px; } .nice_link { diff --git a/templates/search.html b/templates/search.html index 4e55455..c8eb702 100644 --- a/templates/search.html +++ b/templates/search.html @@ -11,10 +11,11 @@