Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt Dash pages for example apps #364

Open
mkhorton opened this issue Aug 4, 2023 · 0 comments
Open

Adopt Dash pages for example apps #364

mkhorton opened this issue Aug 4, 2023 · 0 comments

Comments

@mkhorton
Copy link
Member

mkhorton commented Aug 4, 2023

Creating an issue just to track. I started doing this a while back, and would be good to re-visit after #362 merged.

I'd like to re-deploy the Crystal Toolkit demo app, to achieve two goals (1) continuous deployment of the example apps to make it easier for newcomers to try them out, (2) showcase how to use Dash pages (e.g., each example app a separate page).

Changes to existing code would be minimal. It would be adding a dash.register_page() call to every example app, and creating a new main.py with navigation and a container to load the example apps, something like:

app = dash.Dash(__name__, use_pages=True, assets_folder=SETTINGS.ASSETS_PATH)

app.layout = ctl.Section(
    [
        ctl.H3("Crystal Toolkit Example Apps"),
        ctl.Columns(
            [
                ctl.Column(
                    [
                        html.Div(
                            [
                                html.Div(
                                    dcc.Link(
                                        f"{page['name']} - {page['path']}",
                                        href=page["relative_path"],
                                    )
                                )
                                for page in dash.page_registry.values()
                            ]
                        ),
                    ],
                    size=3,
                ),
                ctl.Column([dash.page_container]),
            ]
        ),
    ]
)

c.f. #265

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant