marimo icon indicating copy to clipboard operation
marimo copied to clipboard

feat: mo.routes()

Open mscolnick opened this issue 1 year ago • 2 comments
trafficstars

This adds mo.routes to change the layout based on the url hash or pathname

    @app.cell
    def __():
        mo.routes({
            "#/home": mo.md("# Home"),
            "#/about": mo.md("# About"),
            "#/contact": mo.md("# Contact"),
        })
        return

    @app.cell
    def __():
        mo.sidebar(
            [
                mo.md("# marimo"),
                mo.nav_menu(
                    {
                        "#/home": f"{mo.icon('lucide:home')} Home",
                        "#/about": f"{mo.icon('lucide:user')} About",
                        "#/contact": f"{mo.icon('lucide:phone')} Contact",
                        "Links": {
                            "https://twitter.com/marimo_io": "Twitter",
                            "https://github.com/marimo-team/marimo": "GitHub",
                        },
                    },
                    orientation="vertical",
                ),
            ]
        )
        return

mscolnick avatar May 10 '24 21:05 mscolnick

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
marimo-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 22, 2024 2:06pm
marimo-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 22, 2024 2:06pm

vercel[bot] avatar May 10 '24 21:05 vercel[bot]

@akshayka

  1. The first is the weakref issue in pretty sure. We can more lazy as the under the hood implementation but it's loses a lot of its benefit
  2. I can add a catch all route as an example - maybe I'll make it constant that is easy to access

mscolnick avatar May 11 '24 04:05 mscolnick

🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.6.1-dev29

github-actions[bot] avatar May 22 '24 18:05 github-actions[bot]