From 400d17e61314e09efc89fbfb770b045550cf6e09 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Sat, 24 Aug 2019 11:35:58 -0700 Subject: Layout: simplify CSS layout on most pages --- youtube/static/shared.css | 3 + youtube/templates/comments_page.html | 83 ++++++++++------------- youtube/templates/delete_comment.html | 8 +-- youtube/templates/local_playlist.html | 50 +++++--------- youtube/templates/login.html | 13 ++-- youtube/templates/playlist.html | 121 +++++++++++++--------------------- youtube/templates/post_comment.html | 23 ++----- youtube/templates/search.html | 32 +++------ 8 files changed, 121 insertions(+), 212 deletions(-) diff --git a/youtube/static/shared.css b/youtube/static/shared.css index 382f86c..611cdb7 100644 --- a/youtube/static/shared.css +++ b/youtube/static/shared.css @@ -267,7 +267,10 @@ body{ .page-button-row{ + margin-top: 10px; + margin-bottom: 10px; justify-self:center; + justify-content: center; display: grid; grid-auto-columns: 40px; grid-auto-flow: column; diff --git a/youtube/templates/comments_page.html b/youtube/templates/comments_page.html index 68c8537..047404a 100644 --- a/youtube/templates/comments_page.html +++ b/youtube/templates/comments_page.html @@ -3,63 +3,46 @@ {% import "comments.html" as comments %} {% block style %} - main{ - display:grid; - grid-template-columns: 3fr 2fr; + .comments-area{ + margin: auto; + width:640px; } - #left{ - background-color:#bcbcbc; - - display: grid; - grid-column: 1; - grid-row: 1; - grid-template-columns: 1fr 640px; - grid-template-rows: 0fr 0fr 0fr; - } - .comments-area{ - grid-column:2; - } - .comment{ - width:640px; - } {% endblock style %} {% block main %} -
-
- {% if not comments_info['is_replies'] %} - - {% endif %} - - {{ comments.comment_posting_box(comment_posting_box_info) }} - - {% if not comments_info['is_replies'] %} - - {% endif %} - -
- {% for comment in comments_info['comments'] %} - {{ comments.render_comment(comment, comments_info['include_avatars']) }} +
+ {% if not comments_info['is_replies'] %} + + {% endif %} + + {{ comments.comment_posting_box(comment_posting_box_info) }} + + {% if not comments_info['is_replies'] %} + - {% if 'more_comments_url' is in comments_info %} - More comments - {% endif %} -
-
+ {% endif %} + +
+ {% for comment in comments_info['comments'] %} + {{ comments.render_comment(comment, comments_info['include_avatars']) }} + {% endfor %} +
+ {% if 'more_comments_url' is in comments_info %} + More comments + {% endif %} +
{% endblock main %} diff --git a/youtube/templates/delete_comment.html b/youtube/templates/delete_comment.html index 71555ee..28c8f2a 100644 --- a/youtube/templates/delete_comment.html +++ b/youtube/templates/delete_comment.html @@ -2,14 +2,10 @@ {% extends "base.html" %} {% block style %} - main{ - display: grid; - grid-template-columns: minmax(0px, 3fr) 640px 40px 500px minmax(0px,2fr); - align-content: start; - } main > div, main > form{ + margin: auto; margin-top:20px; - grid-column:2; + width: 640px; } {% endblock style %} diff --git a/youtube/templates/local_playlist.html b/youtube/templates/local_playlist.html index f8e6f01..7ba0642 100644 --- a/youtube/templates/local_playlist.html +++ b/youtube/templates/local_playlist.html @@ -2,59 +2,41 @@ {% extends "base.html" %} {% import "common_elements.html" as common_elements %} {% block style %} - main{ - display:grid; - grid-template-columns: 3fr 1fr; + main > *{ + width: 800px; + margin: auto; } - - - #left{ - grid-column: 1; - grid-row: 1; - - display: grid; - grid-template-columns: 1fr 800px auto; - grid-template-rows: 0fr 1fr 0fr; + .playlist-metadata{ + display: flex; + flex-direction: row; + justify-content: space-between; } .playlist-title{ - grid-column:2; } #playlist-remove-button{ - grid-column:3; align-self: center; white-space: nowrap; } #results{ - - grid-row: 2; - grid-column: 2 / span 2; - - display: grid; grid-auto-rows: 0fr; grid-row-gap: 10px; - - } - .page-button-row{ - grid-row: 3; - grid-column: 2; - justify-self: center; } {% endblock style %} {% block main %} -
+ +
+ {% for video_info in videos %} + {{ common_elements.item(video_info) }} + {% endfor %} +
+ {% endblock main %} diff --git a/youtube/templates/login.html b/youtube/templates/login.html index 0f09a62..156bc01 100644 --- a/youtube/templates/login.html +++ b/youtube/templates/login.html @@ -2,16 +2,12 @@ {% extends "base.html" %} {% block style %} - main{ - display: grid; - grid-template-columns: minmax(0px, 3fr) 640px 40px 500px minmax(0px,2fr); - align-content: start; - grid-row-gap: 40px; + main > * { + width: 640px; + margin: auto; } - main form{ margin-top:20px; - grid-column:2; display:grid; justify-items: start; align-content: start; @@ -26,10 +22,9 @@ margin-top:20px; } #tor-note{ - grid-row:2; - grid-column:2; background-color: #dddddd; padding: 10px; + margin-top: 40px; } {% endblock style %} diff --git a/youtube/templates/playlist.html b/youtube/templates/playlist.html index 371b51b..ab2640f 100644 --- a/youtube/templates/playlist.html +++ b/youtube/templates/playlist.html @@ -2,72 +2,45 @@ {% extends "base.html" %} {% import "common_elements.html" as common_elements %} {% block style %} - main{ - display:grid; - grid-template-columns: 3fr 1fr; + main > * { + width: 800px; + margin:auto; } - - - #left{ - grid-column: 1; - grid-row: 1; - - display: grid; - grid-template-columns: 1fr 800px; - grid-template-rows: 0fr 1fr 0fr; + .playlist-metadata{ + display:grid; + grid-template-columns: 0fr 1fr; } - .playlist-metadata{ + .playlist-thumbnail{ + grid-row: 1 / span 5; + grid-column:1; + justify-self:start; + width:250px; + margin-right: 10px; + } + .playlist-title{ + grid-row: 1; + grid-column:2; + } + .playlist-author{ + grid-row:2; grid-column:2; - grid-row:1; - - display:grid; - grid-template-columns: 0fr 1fr; } - .playlist-thumbnail{ - grid-row: 1 / span 5; - grid-column:1; - justify-self:start; - width:250px; - margin-right: 10px; - } - .playlist-title{ - grid-row: 1; - grid-column:2; - } - .playlist-author{ - grid-row:2; - grid-column:2; - } - .playlist-stats{ - grid-row:3; - grid-column:2; - } - - .playlist-description{ - grid-row:4; - grid-column:2; - min-width:0px; - white-space: pre-line; - } - .page-button-row{ - grid-row: 3; - grid-column: 2; - justify-self: center; + .playlist-stats{ + grid-row:3; + grid-column:2; + } + + .playlist-description{ + grid-row:4; + grid-column:2; + min-width:0px; + white-space: pre-line; } - - - #right{ - grid-column: 2; - grid-row: 1; - } #results{ - - grid-row: 2; - grid-column: 2; margin-top:10px; - + display: grid; grid-auto-rows: 0fr; grid-row-gap: 10px; @@ -76,27 +49,25 @@ {% endblock style %} {% block main %} -
-