Simplify app template (#2627)

This commit is contained in:
Nikhil Rao 2024-02-16 03:51:52 +07:00 committed by GitHub
parent d979d99338
commit 6ded702d03
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,5 @@
"""Welcome to Reflex! This file outlines the steps to create a basic app.""" """Welcome to Reflex! This file outlines the steps to create a basic app."""
from rxconfig import config from rxconfig import config
import reflex as rx import reflex as rx
@ -10,36 +11,25 @@ filename = f"{config.app_name}/{config.app_name}.py"
class State(rx.State): class State(rx.State):
"""The app state.""" """The app state."""
pass
def index() -> rx.Component: def index() -> rx.Component:
return rx.fragment( return rx.center(
rx.color_mode.button(rx.color_mode.icon(), float="right"), rx.theme_panel(),
rx.vstack( rx.vstack(
rx.heading("Welcome to Reflex!", font_size="2em"), rx.heading("Welcome to Reflex!", size="9"),
rx.box("Get started by editing ", rx.code(filename, font_size="1em")), rx.text("Get started by editing ", rx.code(filename)),
rx.link( rx.button(
"Check out our docs!", "Check out our docs!",
href=docs_url, on_click=lambda: rx.redirect(docs_url),
border="0.1em solid", size="4",
padding="0.5em",
border_radius="0.5em",
_hover={
"color": rx.color_mode_cond(
light="rgb(107,99,246)",
dark="rgb(179, 175, 255)",
)
},
), ),
gap="1.5em",
font_size="2em",
padding_top="10%",
align="center", align="center",
spacing="7",
font_size="2em",
), ),
height="100vh",
) )
# Create app instance and add index page.
app = rx.App() app = rx.App()
app.add_page(index) app.add_page(index)