Skip to content

Commit

Permalink
Revert changes in app so tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
huong-li-nguyen committed Feb 12, 2025
1 parent d37502f commit b001363
Showing 1 changed file with 7 additions and 31 deletions.
38 changes: 7 additions & 31 deletions vizro-core/examples/scratch_dev/app.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,14 @@
"""Test app"""

from dash import Dash, html, clientside_callback, Output, Input
import dash_bootstrap_components as dbc
import vizro
import vizro.models as vm
import vizro.plotly.express as px
from vizro import Vizro

app = Dash(__name__, external_stylesheets=[dbc.icons.FONT_AWESOME, vizro.bootstrap])

color_mode_switch = html.Span(
[
dbc.Label(className="fa fa-moon", html_for="switch"),
dbc.Switch(id="switch", value=False, className="d-inline-block ms-1"),
dbc.Label(className="fa fa-sun", html_for="switch"),
]
)

app.layout = dbc.Container(
[
html.H3(["Bootstrap Light Dark Color Modes Demo"], className="bg-primary p-2"),
color_mode_switch,
]
page = vm.Page(
title="foo", components=[vm.Graph(figure=px.scatter(data_frame=px.data.iris(), x="sepal_width", y="sepal_length"))]
)

clientside_callback(
"""
(switchOn) => {
switchOn
? document.documentElement.setAttribute('data-bs-theme', 'light')
: document.documentElement.setAttribute('data-bs-theme', 'dark')
return window.dash_clientside.no_update
}
""",
Output("switch", "id"),
Input("switch", "value"),
)
dashboard = vm.Dashboard(pages=[page])

if __name__ == "__main__":
app.run_server(debug=True)
Vizro().build(dashboard).run()

0 comments on commit b001363

Please sign in to comment.