Skip to content

Commit 0d195f3

Browse files
author
xhlulu
committed
Add buttons (code, demo) and make logo clickable
Former-commit-id: 42f718d
1 parent 0e02cc3 commit 0d195f3

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

apps/dash-interest-rate/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def connect_read_sql(query, engine):
116116
app.layout = dbc.Container(
117117
fluid=True,
118118
children=[
119-
html.H1("Dash Interest Rate Modeling with Snowflake"),
119+
Header("Dash Interest Rate Modeling with Snowflake", app),
120120
html.Hr(),
121121
dbc.Row(
122122
[

apps/dash-interest-rate/utils.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
import dash_core_components as dcc
44
import dash_bootstrap_components as dbc
55

6+
def Header(name, app):
7+
title = html.H2(name, style={"margin-top": 7})
8+
logo = html.Img(
9+
src=app.get_asset_url("dash-logo.png"), style={"float": "right", "height": 60}
10+
)
11+
link = html.A(logo, href="https://plotly.com/dash/")
12+
btn_style = {'margin-top': '13px', 'float': 'right', 'margin-right': '10px'}
13+
demo_btn = html.A(dbc.Button("Enterprise Demo", style=btn_style, color="primary"), href="https://plotly.com/get-demo/")
14+
code_btn = html.A(dbc.Button("Source Code", style=btn_style, color="secondary"), href="https://github.com/plotly/dash-sample-apps/tree/main/apps/dash-interest-rate")
15+
16+
return dbc.Row([dbc.Col(title, md=7), dbc.Col([link, demo_btn, code_btn], md=5)])
617

718
def OptionMenu(values, label, **kwargs):
819
options = [{"label": s.replace("_", " ").capitalize(), "value": s} for s in values]

0 commit comments

Comments
 (0)