From 995603ad44f032dac39226584ae21ee66d3be87b Mon Sep 17 00:00:00 2001 From: Bachibouzouk Date: Fri, 26 Oct 2018 14:10:57 +0200 Subject: [PATCH] @dash-bio this banner can be used by every `dash-bio` app --- assets/dashbio_logo.svg | 179 ++++++++++++++++++++++++++++++++ tests/dash/app_test.py | 4 +- tests/dash/utils/__init__.py | 0 tests/dash/utils/app_wrapper.py | 40 +++++++ 4 files changed, 222 insertions(+), 1 deletion(-) create mode 100644 assets/dashbio_logo.svg create mode 100644 tests/dash/utils/__init__.py create mode 100644 tests/dash/utils/app_wrapper.py diff --git a/assets/dashbio_logo.svg b/assets/dashbio_logo.svg new file mode 100644 index 000000000..dd616dbac --- /dev/null +++ b/assets/dashbio_logo.svg @@ -0,0 +1,179 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/tests/dash/app_test.py b/tests/dash/app_test.py index 6797325ec..1b6db5509 100644 --- a/tests/dash/app_test.py +++ b/tests/dash/app_test.py @@ -1,6 +1,8 @@ +from .utils.app_wrapper import app_page_layout + def layout(): """this function need to be defined, it can return anything which can be assigned to a children property in dash""" - return "Simplest app ever" + return app_page_layout("Simplest app ever") def callbacks(app): ''' diff --git a/tests/dash/utils/__init__.py b/tests/dash/utils/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/dash/utils/app_wrapper.py b/tests/dash/utils/app_wrapper.py new file mode 100644 index 000000000..05420adb2 --- /dev/null +++ b/tests/dash/utils/app_wrapper.py @@ -0,0 +1,40 @@ +import dash_core_components as dcc +import dash_html_components as html + + +def app_page_layout(page_layout, app_title="Dash Bio App"): + return html.Div( + id='main_page', + children=[ + dcc.Location(id='url', refresh=False), + html.Div( + id='header', + className='banner', + children=[ + html.H2(app_title), + html.Img( + src='assets/dashbio_logo.svg', + style={ + 'height': '100', + 'float': 'right', + } + ), + ], + style={ + 'width': '100%', + 'display': 'flex', + 'flexDirection': 'row', + 'alignItems': 'center', + 'justifyContent': 'space-between', + 'background': '#A2B1C6', + 'color': '#506784', + 'margin': '0 !important' + } + ), + html.Div( + id='page-content', + children=page_layout, + style={'margin': '10px'} + ) + ] + )