Skip to content

Commit

Permalink
Merge pull request #2 from milochen0418/pr-add-example-hello-reflex
Browse files Browse the repository at this point in the history
Add the new example hello-reflex
  • Loading branch information
milochen0418 authored Jul 31, 2023
2 parents 7d62f63 + 5aad73f commit d494ff7
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 0 deletions.
4 changes: 4 additions & 0 deletions hello-reflex/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.py[cod]
.web
__pycache__/
reflex.db
1 change: 1 addition & 0 deletions hello-reflex/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# hello-reflex
Binary file added hello-reflex/assets/favicon.ico
Binary file not shown.
Empty file.
36 changes: 36 additions & 0 deletions hello-reflex/hello_reflex/hello_reflex.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import reflex as rx
class State(rx.State):
def say_hello(self):
yield rx.window_alert("Hello Reflex")
pass


def index() -> rx.Component:
return rx.fragment(
rx.color_mode_button(rx.color_mode_icon(), float="right"),
rx.vstack(
rx.heading("Hello Reflex!", font_size="2em"),
rx.link(
"Say Hello",
on_click=State.say_hello,
border="0.1em solid",
padding="0.5em",
border_radius="0.5em",
_hover={
"color": rx.color_mode_cond(
light="rgb(107,99,246)",
dark="rgb(179, 175, 255)",
)
},
),
spacing="1.5em",
font_size="2em",
padding_top="10%",
),
)


# Add state and page to the app.
app = rx.App(state=State)
app.add_page(index)
app.compile()
1 change: 1 addition & 0 deletions hello-reflex/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
reflex==0.2.0
10 changes: 10 additions & 0 deletions hello-reflex/rxconfig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import reflex as rx

class HelloreflexConfig(rx.Config):
pass

config = HelloreflexConfig(
app_name="hello_reflex",
db_url="sqlite:///reflex.db",
env=rx.Env.DEV,
)

0 comments on commit d494ff7

Please sign in to comment.