Icon ui method

This commit is contained in:
Andrew Croce 2018-07-17 10:41:50 -04:00
parent 1a84e0e99c
commit 41259685b0
4 changed files with 9 additions and 1 deletions

View File

@ -15,10 +15,10 @@ from atst.handlers.dev import Dev
from atst.home import home
from atst.api_client import ApiClient
from atst.sessions import RedisSessions
from atst.ui import UI
ENV = os.getenv("TORNADO_ENV", "dev")
def make_app(config, deps, **kwargs):
routes = [
@ -104,6 +104,7 @@ def make_app(config, deps, **kwargs):
)
app.config = config
app.sessions = deps["sessions"]
app.ui = UI
return app

5
atst/ui.py Normal file
View File

@ -0,0 +1,5 @@
class UI:
def icon(name):
with open("../static/icons/%(name)s.svg") as svg:
return svg.read()

1
static/icons/trash.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 91 91"><path d="M67.305 36.442v-8.055c0-.939-.762-1.701-1.7-1.701H54.342v-5.524c0-.938-.761-1.7-1.699-1.7h-12.75c-.939 0-1.701.762-1.701 1.7v5.524H26.93c-.939 0-1.7.762-1.7 1.701v8.055c0 .938.761 1.699 1.7 1.699h.488v34.021c0 .938.761 1.7 1.699 1.7h29.481c3.595 0 6.52-2.924 6.52-6.518V38.142h.486c.939 0 1.701-.761 1.701-1.7zm-25.713-13.58h9.35v3.824h-9.35v-3.824zm20.127 44.483c0 1.719-1.4 3.117-3.12 3.117h-27.78v-32.32l30.9.002v29.201zm2.185-32.603H28.629v-4.655H63.905v4.655z"/><path d="M36.066 44.962h3.4v19.975h-3.4zM44.566 44.962h3.4v19.975h-3.4zM53.066 44.962h3.4v19.975h-3.4z"/></svg>

After

Width:  |  Height:  |  Size: 648 B

View File

@ -5,6 +5,7 @@
<ul>
<li>
<a href='/' class='sidenav__link sidenav__link--active' aria-current='true'>Navigation Item</a>
{{ ui.icon('trash') }}
<ul>
<li><a href='/' class='sidenav__link sidenav__link--active'>Sub Navigation</a></li>
<li><a href='/' class='sidenav__link'>Sub Navigation</a></li>