Skip to content

Commit

Permalink
Add styles for mobile viewports.
Browse files Browse the repository at this point in the history
  • Loading branch information
toddbirchard committed Dec 20, 2023
1 parent a837942 commit 2f3726a
Show file tree
Hide file tree
Showing 17 changed files with 258 additions and 115 deletions.
1 change: 0 additions & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class Config:
FLASK_APP = "wsgi.py"
SECRET_KEY = environ.get("SECRET_KEY")
FLASK_DEBUG = environ.get("FLASK_DEBUG")
SOCK_SERVER_OPTIONS = {"ping_interval": 25}

# Flask-Assets
LESS_BIN = environ.get("LESS_BIN")
Expand Down
5 changes: 3 additions & 2 deletions flask_assets_tutorial/admin/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ def dashboard():
"""Admin dashboard route."""
return render_template(
"dashboard.jinja2",
title="Admin Dashboard | Flask-Blueprint Tutorial",
title="Admin Dashboard",
template="dashboard-static account",
body="Account",
body="This is the admin dashboard.",
logged_in=True,
)
13 changes: 2 additions & 11 deletions flask_assets_tutorial/admin/templates/dashboard.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@
{% endblock %}

{% block content %}
{% include "navigation-loggedin.jinja2" %}

<div class="container">
<h1>{{body}}</h1>
<ul class="page-properties">
<li><span class="attribute-title">Blueprint:</span> <span class="attribute-value">{{ request.blueprint }}</span></li>
<li><span class="attribute-title">Template:</span> <span class="attribute-value">{{ self._TemplateReference__context.name }}</span></li>
<li><span class="attribute-title">View:</span> <span class="attribute-value">{{ request.endpoint }}</span></li>
<li><span class="attribute-title">Route:</span> <span class="attribute-value">{{ request.path }}</span></li>
</ul>
</div>
<h1>{{title}}</h1>
<p>{{body}}</p>
{% endblock %}
20 changes: 16 additions & 4 deletions flask_assets_tutorial/main/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,35 @@

@main_blueprint.route("/", methods=["GET"])
def home():
"""Homepage route."""
"""Home page route."""
return render_template(
"index.jinja2", title="Home | Flask-Blueprint Tutorial", template="home-static main", body="Home"
"index.jinja2",
title="Home",
body="Welcome to the Flask-Assets tutorial demo!",
template="home-static main",
logged_in=False,
)


@main_blueprint.route("/about", methods=["GET"])
def about():
"""About page route."""
return render_template(
"index.jinja2", title="About | Flask-Blueprint Tutorial", template="about-static main", body="About"
"index.jinja2",
title="About",
body="At HackersAndSlackers, we pride ourselves in stuff. That's why work tirelessly to build and deliver stuff, 24/7.",
template="about-static main",
logged_in=False,
)


@main_blueprint.route("/etc", methods=["GET"])
def etc():
"""Etc page route."""
return render_template(
"index.jinja2", title="Etc | Flask-Blueprint Tutorial", template="etc-static main", body="Etc"
"index.jinja2",
title="Etc.",
body="Here's a third page, for good measure.",
template="etc-static main",
logged_in=False,
)
22 changes: 11 additions & 11 deletions flask_assets_tutorial/main/templates/index.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
{% endblock %}

{% block content %}
{% include "navigation-default.jinja2" %}
<div class="container">
<h1>{{body}}</h1>
<ul class="page-properties">
<li><span class="attribute-title">Blueprint:</span> <span class="attribute-value">{{ request.blueprint }}</span></li>
<li><span class="attribute-title">Template:</span> <span class="attribute-value">{{ self._TemplateReference__context.name }}</span></li>
<li><span class="attribute-title">View:</span> <span class="attribute-value">{{ request.endpoint }}</span></li>
<li><span class="attribute-title">Route:</span> <span class="attribute-value">{{ request.path }}</span></li>
</ul>
</div>
{% endblock %}
<h1>{{title}}</h1>
<p>{{body}}</p>
<ul class="page-properties">
<li><span class="attribute-title">Blueprint:</span> <span class="attribute-value">{{ request.blueprint }}</span></li>
<li><span class="attribute-title">Template:</span> <span class="attribute-value">{{ self._TemplateReference__context.name }}</span></li>
<li><span class="attribute-title">View:</span> <span class="attribute-value">{{ request.endpoint }}</span></li>
<li><span class="attribute-title">Route:</span> <span class="attribute-value">{{ request.path }}</span></li>
</ul>
{% endblock %}


95 changes: 72 additions & 23 deletions flask_assets_tutorial/static/dist/css/account.css
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
/* Breakpoints */
nav {
background: #fff;
padding: 15px 30px;
width: auto;
margin-bottom: 40px;
padding: 25px 0;
margin: 0 auto;
box-shadow: 0 0 5px #bec6cf;
}
@media (max-width: 600px) {
nav {
box-shadow: unset;
}
}
nav .nav-wrapper {
max-width: 900px;
max-width: 85vw;
display: flex;
justify-content: space-between;
align-items: center;
width: auto;
margin: 0 auto;
}
@media (max-width: 600px) {
nav .nav-wrapper {
max-width: 90vw;
}
}
nav .nav-wrapper .left-nav {
display: flex;
justify-content: space-between;
Expand Down Expand Up @@ -45,12 +55,55 @@ html {
background: #f0f0f0;
height: 100%;
}
body .container,
html .container {
width: 850px;
max-width: 80vw;
min-height: 100%;
background: white;
margin: 40px auto 0;
padding: 3vw;
box-shadow: 0 0 5px #bec6cf;
}
@media (max-width: 600px) {
body .container,
html .container {
width: 90vw;
max-width: unset;
padding: 5vw;
margin: 0;
box-shadow: 0 0 3px #bec6cf;
}
}
body .container .attribute-value,
html .container .attribute-value {
font-weight: 300;
font-size: 0.9em;
}
body .container h1,
html .container h1 {
margin-top: 0;
font-size: 2.5em;
line-height: 1;
color: #393b40;
}
body .container p,
html .container p {
font-weight: 300;
font-size: 1.1em;
line-height: 1.4;
}
ul {
list-style: none;
width: 50%;
border: 1px solid #e6e6e6;
padding: 10px;
}
@media (max-width: 600px) {
ul {
width: unset;
}
}
ul li {
display: flex;
justify-content: space-between;
Expand All @@ -64,37 +117,32 @@ ul li:last-of-type {
margin-bottom: 0;
padding-bottom: 0;
}
.container {
max-width: 847px;
margin: 0 auto;
min-height: 100%;
background: white;
padding: 40px;
box-shadow: 0 0 5px #bec6cf;
}
.container .attribute-value {
font-weight: 300;
font-size: 0.9em;
}
h1 {
margin-top: 0;
}

/* Breakpoints */
nav {
background: #fff;
padding: 15px 30px;
width: auto;
margin-bottom: 40px;
padding: 25px 0;
margin: 0 auto;
box-shadow: 0 0 5px #bec6cf;
}
@media (max-width: 600px) {
nav {
box-shadow: unset;
}
}
nav .nav-wrapper {
max-width: 900px;
max-width: 85vw;
display: flex;
justify-content: space-between;
align-items: center;
width: auto;
margin: 0 auto;
}
@media (max-width: 600px) {
nav .nav-wrapper {
max-width: 90vw;
}
}
nav .nav-wrapper .left-nav {
display: flex;
justify-content: space-between;
Expand All @@ -119,6 +167,7 @@ nav a:hover {
opacity: 0.7;
}

/* Breakpoints */

p {
width: 100%;
Expand Down
Loading

0 comments on commit 2f3726a

Please sign in to comment.