instruction stringlengths 0 1k | input stringlengths 1 1k | output stringlengths 10 6.51k |
|---|---|---|
e_block_markdown,
}
comp2 = component_map.copy()
comp2["codeblock"] = code_block_markdown_dark
comp2["ul"] = lambda items: unordered_list_comp(items=items)
comp2["ol"] = lambda items: ordered_list_comp(items=items)
xd = flexdown.Flexdown(
block_types=[
DemoOnly,
DemoBlock,
AlertBlock,
DefinitionBlock,
SectionBlock,
VideoBlock,
TabsBlock,
QuoteBlock,
],
component_map=component_map,
)
xd.clear_modules()
xd2 = flexdown.Flexdown(
block_types=[
DemoBlockDark,
AlertBlock,
DefinitionBlock,
SectionBlock,
VideoBlock,
TabsBlock,
QuoteBlock,
],
component_map=comp2,
)
xd2.clear_modules()
def markdown(text):
return xd.get_default_block().render_fn(content=text)
def markdown_codeblock(value: str, **props: object) -> rx.Component:
"""Render a code block using the Shiki-based code block component."""
return rx._x.code_block(value, **props)
| def markdown_with_shiki(*args, **kwargs):
"""Wrapper for the markdown component with a customized component map.
Uses the experimental Shiki-based code block (rx._x.code_block)
instead of the default CodeBlock component for code blocks.
Note: This wrapper should be removed once the default codeblock
in rx.markdown component map is updated to the Shiki-based code block.
"""
return rx.markdown(
*args,
component_map={"codeblock": markdown_codeblock},
**kwargs,
) | |
"""The main Reflex website."""
import os
|
import reflex as rx
import reflex_enterprise as rxe
from pcweb import styles
from pcweb.meta.meta import favicons_links
from pcweb.pages import page404, routes
from pcweb.pages.docs import exec_blocks, outblocks
from pcweb.telemetry import get_pixel_website_trackers
from pcweb.whitelist import _check_whitelisted_path
# This number discovered by trial and error on Windows 11 w/ Node 18, any
# higher and the prod build fails with EMFILE error.
WINDOWS_MAX_ROUTES = int(os.environ.get("REFLEX_WEB_WINDOWS_MAX_ROUTES", "100"))
# Execute all the exec blocks in the documents.
for doc, href in outblocks:
exec_blocks(doc, href)
# Create the app.
app = rxe.App(
style=styles.BASE_STYLE,
stylesheets=styles.STYLESHEETS,
app_wraps={},
theme=rx.theme(
has_background=True,
radius="large",
accent_color="violet",
),
head_components=get_pixel_website_trackers()
+ favicons_links()
+ [
rx.el.link(
rel="preconnect",
| import sys |
"""The main Reflex website."""
import os
import sys
|
import reflex_enterprise as rxe
from pcweb import styles
from pcweb.meta.meta import favicons_links
from pcweb.pages import page404, routes
from pcweb.pages.docs import exec_blocks, outblocks
from pcweb.telemetry import get_pixel_website_trackers
from pcweb.whitelist import _check_whitelisted_path
# This number discovered by trial and error on Windows 11 w/ Node 18, any
# higher and the prod build fails with EMFILE error.
WINDOWS_MAX_ROUTES = int(os.environ.get("REFLEX_WEB_WINDOWS_MAX_ROUTES", "100"))
# Execute all the exec blocks in the documents.
for doc, href in outblocks:
exec_blocks(doc, href)
# Create the app.
app = rxe.App(
style=styles.BASE_STYLE,
stylesheets=styles.STYLESHEETS,
app_wraps={},
theme=rx.theme(
has_background=True,
radius="large",
accent_color="violet",
),
head_components=get_pixel_website_trackers()
+ favicons_links()
+ [
rx.el.link(
rel="preconnect",
href="https://fo | import reflex as rx |
"""The main Reflex website."""
import os
import sys
import reflex as rx
|
from pcweb import styles
from pcweb.meta.meta import favicons_links
from pcweb.pages import page404, routes
from pcweb.pages.docs import exec_blocks, outblocks
from pcweb.telemetry import get_pixel_website_trackers
from pcweb.whitelist import _check_whitelisted_path
# This number discovered by trial and error on Windows 11 w/ Node 18, any
# higher and the prod build fails with EMFILE error.
WINDOWS_MAX_ROUTES = int(os.environ.get("REFLEX_WEB_WINDOWS_MAX_ROUTES", "100"))
# Execute all the exec blocks in the documents.
for doc, href in outblocks:
exec_blocks(doc, href)
# Create the app.
app = rxe.App(
style=styles.BASE_STYLE,
stylesheets=styles.STYLESHEETS,
app_wraps={},
theme=rx.theme(
has_background=True,
radius="large",
accent_color="violet",
),
head_components=get_pixel_website_trackers()
+ favicons_links()
+ [
rx.el.link(
rel="preconnect",
href="https://fonts.googleapis.com",
),
| import reflex_enterprise as rxe |
"""The main Reflex website."""
import os
import sys
import reflex as rx
import reflex_enterprise as rxe
|
from pcweb.meta.meta import favicons_links
from pcweb.pages import page404, routes
from pcweb.pages.docs import exec_blocks, outblocks
from pcweb.telemetry import get_pixel_website_trackers
from pcweb.whitelist import _check_whitelisted_path
# This number discovered by trial and error on Windows 11 w/ Node 18, any
# higher and the prod build fails with EMFILE error.
WINDOWS_MAX_ROUTES = int(os.environ.get("REFLEX_WEB_WINDOWS_MAX_ROUTES", "100"))
# Execute all the exec blocks in the documents.
for doc, href in outblocks:
exec_blocks(doc, href)
# Create the app.
app = rxe.App(
style=styles.BASE_STYLE,
stylesheets=styles.STYLESHEETS,
app_wraps={},
theme=rx.theme(
has_background=True,
radius="large",
accent_color="violet",
),
head_components=get_pixel_website_trackers()
+ favicons_links()
+ [
rx.el.link(
rel="preconnect",
href="https://fonts.googleapis.com",
),
rx.el.link(
| from pcweb import styles |
"""The main Reflex website."""
import os
import sys
import reflex as rx
import reflex_enterprise as rxe
from pcweb import styles
|
from pcweb.pages import page404, routes
from pcweb.pages.docs import exec_blocks, outblocks
from pcweb.telemetry import get_pixel_website_trackers
from pcweb.whitelist import _check_whitelisted_path
# This number discovered by trial and error on Windows 11 w/ Node 18, any
# higher and the prod build fails with EMFILE error.
WINDOWS_MAX_ROUTES = int(os.environ.get("REFLEX_WEB_WINDOWS_MAX_ROUTES", "100"))
# Execute all the exec blocks in the documents.
for doc, href in outblocks:
exec_blocks(doc, href)
# Create the app.
app = rxe.App(
style=styles.BASE_STYLE,
stylesheets=styles.STYLESHEETS,
app_wraps={},
theme=rx.theme(
has_background=True,
radius="large",
accent_color="violet",
),
head_components=get_pixel_website_trackers()
+ favicons_links()
+ [
rx.el.link(
rel="preconnect",
href="https://fonts.googleapis.com",
),
rx.el.link(
rel="preconnect",
href="h | from pcweb.meta.meta import favicons_links |
"""The main Reflex website."""
import os
import sys
import reflex as rx
import reflex_enterprise as rxe
from pcweb import styles
from pcweb.meta.meta import favicons_links
|
from pcweb.pages.docs import exec_blocks, outblocks
from pcweb.telemetry import get_pixel_website_trackers
from pcweb.whitelist import _check_whitelisted_path
# This number discovered by trial and error on Windows 11 w/ Node 18, any
# higher and the prod build fails with EMFILE error.
WINDOWS_MAX_ROUTES = int(os.environ.get("REFLEX_WEB_WINDOWS_MAX_ROUTES", "100"))
# Execute all the exec blocks in the documents.
for doc, href in outblocks:
exec_blocks(doc, href)
# Create the app.
app = rxe.App(
style=styles.BASE_STYLE,
stylesheets=styles.STYLESHEETS,
app_wraps={},
theme=rx.theme(
has_background=True,
radius="large",
accent_color="violet",
),
head_components=get_pixel_website_trackers()
+ favicons_links()
+ [
rx.el.link(
rel="preconnect",
href="https://fonts.googleapis.com",
),
rx.el.link(
rel="preconnect",
href="https://fonts.gstatic.com",
c | from pcweb.pages import page404, routes |
"""The main Reflex website."""
import os
import sys
import reflex as rx
import reflex_enterprise as rxe
from pcweb import styles
from pcweb.meta.meta import favicons_links
from pcweb.pages import page404, routes
|
from pcweb.telemetry import get_pixel_website_trackers
from pcweb.whitelist import _check_whitelisted_path
# This number discovered by trial and error on Windows 11 w/ Node 18, any
# higher and the prod build fails with EMFILE error.
WINDOWS_MAX_ROUTES = int(os.environ.get("REFLEX_WEB_WINDOWS_MAX_ROUTES", "100"))
# Execute all the exec blocks in the documents.
for doc, href in outblocks:
exec_blocks(doc, href)
# Create the app.
app = rxe.App(
style=styles.BASE_STYLE,
stylesheets=styles.STYLESHEETS,
app_wraps={},
theme=rx.theme(
has_background=True,
radius="large",
accent_color="violet",
),
head_components=get_pixel_website_trackers()
+ favicons_links()
+ [
rx.el.link(
rel="preconnect",
href="https://fonts.googleapis.com",
),
rx.el.link(
rel="preconnect",
href="https://fonts.gstatic.com",
cross_origin="",
),
rx.el.link(
| from pcweb.pages.docs import exec_blocks, outblocks |
"""The main Reflex website."""
import os
import sys
import reflex as rx
import reflex_enterprise as rxe
from pcweb import styles
from pcweb.meta.meta import favicons_links
from pcweb.pages import page404, routes
from pcweb.pages.docs import exec_blocks, outblocks
|
from pcweb.whitelist import _check_whitelisted_path
# This number discovered by trial and error on Windows 11 w/ Node 18, any
# higher and the prod build fails with EMFILE error.
WINDOWS_MAX_ROUTES = int(os.environ.get("REFLEX_WEB_WINDOWS_MAX_ROUTES", "100"))
# Execute all the exec blocks in the documents.
for doc, href in outblocks:
exec_blocks(doc, href)
# Create the app.
app = rxe.App(
style=styles.BASE_STYLE,
stylesheets=styles.STYLESHEETS,
app_wraps={},
theme=rx.theme(
has_background=True,
radius="large",
accent_color="violet",
),
head_components=get_pixel_website_trackers()
+ favicons_links()
+ [
rx.el.link(
rel="preconnect",
href="https://fonts.googleapis.com",
),
rx.el.link(
rel="preconnect",
href="https://fonts.gstatic.com",
cross_origin="",
),
rx.el.link(
href="https://fonts.googleapis.com/css2?family=I | from pcweb.telemetry import get_pixel_website_trackers |
"""The main Reflex website."""
import os
import sys
import reflex as rx
import reflex_enterprise as rxe
from pcweb import styles
from pcweb.meta.meta import favicons_links
from pcweb.pages import page404, routes
from pcweb.pages.docs import exec_blocks, outblocks
from pcweb.telemetry import get_pixel_website_trackers
|
# This number discovered by trial and error on Windows 11 w/ Node 18, any
# higher and the prod build fails with EMFILE error.
WINDOWS_MAX_ROUTES = int(os.environ.get("REFLEX_WEB_WINDOWS_MAX_ROUTES", "100"))
# Execute all the exec blocks in the documents.
for doc, href in outblocks:
exec_blocks(doc, href)
# Create the app.
app = rxe.App(
style=styles.BASE_STYLE,
stylesheets=styles.STYLESHEETS,
app_wraps={},
theme=rx.theme(
has_background=True,
radius="large",
accent_color="violet",
),
head_components=get_pixel_website_trackers()
+ favicons_links()
+ [
rx.el.link(
rel="preconnect",
href="https://fonts.googleapis.com",
),
rx.el.link(
rel="preconnect",
href="https://fonts.gstatic.com",
cross_origin="",
),
rx.el.link(
href="https://fonts.googleapis.com/css2?family=Instrument+Sans:ital,wght@0,400;0,500;0,600;0,700;1,4 | from pcweb.whitelist import _check_whitelisted_path |
"""The main Reflex website."""
import os
import sys
import reflex as rx
import reflex_enterprise as rxe
from pcweb import styles
from pcweb.meta.meta import favicons_links
from pcweb.pages import page404, routes
from pcweb.pages.docs import exec_blocks, outblocks
from pcweb.telemetry import get_pixel_website_trackers
from pcweb.whitelist import _check_whitelisted_path
# This number discovered by trial and error on Windows 11 w/ Node 18, any
# higher and the prod build fails with EMFILE error.
|
# Execute all the exec blocks in the documents.
for doc, href in outblocks:
exec_blocks(doc, href)
# Create the app.
app = rxe.App(
style=styles.BASE_STYLE,
stylesheets=styles.STYLESHEETS,
app_wraps={},
theme=rx.theme(
has_background=True,
radius="large",
accent_color="violet",
),
head_components=get_pixel_website_trackers()
+ favicons_links()
+ [
rx.el.link(
rel="preconnect",
href="https://fonts.googleapis.com",
),
rx.el.link(
rel="preconnect",
href="https://fonts.gstatic.com",
cross_origin="",
),
rx.el.link(
href="https://fonts.googleapis.com/css2?family=Instrument+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&family=Space+Mono:ital,wght@0,400;0,700;1,400;1,700&family=IBM+Plex+Mono:ital,wght@0,500;0,600;1,600&family=Source+Code+Pro:wght@400;500&display=swap&family=JetBrains+Mono:wght@400;500;600 | WINDOWS_MAX_ROUTES = int(os.environ.get("REFLEX_WEB_WINDOWS_MAX_ROUTES", "100")) |
"""The main Reflex website."""
import os
import sys
import reflex as rx
import reflex_enterprise as rxe
from pcweb import styles
from pcweb.meta.meta import favicons_links
from pcweb.pages import page404, routes
from pcweb.pages.docs import exec_blocks, outblocks
from pcweb.telemetry import get_pixel_website_trackers
from pcweb.whitelist import _check_whitelisted_path
# This number discovered by trial and error on Windows 11 w/ Node 18, any
# higher and the prod build fails with EMFILE error.
WINDOWS_MAX_ROUTES = int(os.environ.get("REFLEX_WEB_WINDOWS_MAX_ROUTES", "100"))
# Execute all the exec blocks in the documents.
|
# Create the app.
app = rxe.App(
style=styles.BASE_STYLE,
stylesheets=styles.STYLESHEETS,
app_wraps={},
theme=rx.theme(
has_background=True,
radius="large",
accent_color="violet",
),
head_components=get_pixel_website_trackers()
+ favicons_links()
+ [
rx.el.link(
rel="preconnect",
href="https://fonts.googleapis.com",
),
rx.el.link(
rel="preconnect",
href="https://fonts.gstatic.com",
cross_origin="",
),
rx.el.link(
href="https://fonts.googleapis.com/css2?family=Instrument+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&family=Space+Mono:ital,wght@0,400;0,700;1,400;1,700&family=IBM+Plex+Mono:ital,wght@0,500;0,600;1,600&family=Source+Code+Pro:wght@400;500&display=swap&family=JetBrains+Mono:wght@400;500;600;700&display=swap",
rel="stylesheet",
),
],
)
# XXX: The app is TOO BIG to buil | for doc, href in outblocks:
exec_blocks(doc, href) |
YLE,
stylesheets=styles.STYLESHEETS,
app_wraps={},
theme=rx.theme(
has_background=True,
radius="large",
accent_color="violet",
),
head_components=get_pixel_website_trackers()
+ favicons_links()
+ [
rx.el.link(
rel="preconnect",
href="https://fonts.googleapis.com",
),
rx.el.link(
rel="preconnect",
href="https://fonts.gstatic.com",
cross_origin="",
),
rx.el.link(
href="https://fonts.googleapis.com/css2?family=Instrument+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&family=Space+Mono:ital,wght@0,400;0,700;1,400;1,700&family=IBM+Plex+Mono:ital,wght@0,500;0,600;1,600&family=Source+Code+Pro:wght@400;500&display=swap&family=JetBrains+Mono:wght@400;500;600;700&display=swap",
rel="stylesheet",
),
],
)
# XXX: The app is TOO BIG to build on Windows, so explicitly disallow it except for testing
|
# Add the pages to the app.
for route in routes:
# print(f"Adding route: {route}")
if _check_whitelisted_path(route.path):
page_args = {
"component": route.component,
"route": route.path,
"title": route.title,
"image": (
"/previews/index_preview.webp" if route.image is None else route.image
),
"meta": [
{"name": "theme-color", "content": route.background_color},
],
}
# Add the description only if it is not None
if route.description is not None:
page_args["description"] = route.description
# Add the extra meta data only if it is not None
if route.meta is not None:
page_args["meta"].extend(route.meta)
# Call add_page with the dynamically constructed arguments
app.add_page(**page_args)
# Add redirects
redirects = [
("/docs/enterprise/ag-grid/index", "/docs/enterprise/ag-g | if sys.platform == "win32":
if not os.environ.get("REFLEX_WEB_WINDOWS_OVERRIDE"):
raise RuntimeError(
"reflex-web cannot be built on Windows due to EMFILE error. To build a "
"subset of pages for testing, set environment variable REFLEX_WEB_WINDOWS_OVERRIDE."
)
routes = routes[:WINDOWS_MAX_ROUTES] |
ESHEETS,
app_wraps={},
theme=rx.theme(
has_background=True,
radius="large",
accent_color="violet",
),
head_components=get_pixel_website_trackers()
+ favicons_links()
+ [
rx.el.link(
rel="preconnect",
href="https://fonts.googleapis.com",
),
rx.el.link(
rel="preconnect",
href="https://fonts.gstatic.com",
cross_origin="",
),
rx.el.link(
href="https://fonts.googleapis.com/css2?family=Instrument+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&family=Space+Mono:ital,wght@0,400;0,700;1,400;1,700&family=IBM+Plex+Mono:ital,wght@0,500;0,600;1,600&family=Source+Code+Pro:wght@400;500&display=swap&family=JetBrains+Mono:wght@400;500;600;700&display=swap",
rel="stylesheet",
),
],
)
# XXX: The app is TOO BIG to build on Windows, so explicitly disallow it except for testing
if sys.platform == "win32":
|
routes = routes[:WINDOWS_MAX_ROUTES]
# Add the pages to the app.
for route in routes:
# print(f"Adding route: {route}")
if _check_whitelisted_path(route.path):
page_args = {
"component": route.component,
"route": route.path,
"title": route.title,
"image": (
"/previews/index_preview.webp" if route.image is None else route.image
),
"meta": [
{"name": "theme-color", "content": route.background_color},
],
}
# Add the description only if it is not None
if route.description is not None:
page_args["description"] = route.description
# Add the extra meta data only if it is not None
if route.meta is not None:
page_args["meta"].extend(route.meta)
# Call add_page with the dynamically constructed arguments
app.add_page(**page_args)
# Add redirects
redirects = [
("/docs/enterpri | if not os.environ.get("REFLEX_WEB_WINDOWS_OVERRIDE"):
raise RuntimeError(
"reflex-web cannot be built on Windows due to EMFILE error. To build a "
"subset of pages for testing, set environment variable REFLEX_WEB_WINDOWS_OVERRIDE."
) |
href="https://fonts.googleapis.com",
),
rx.el.link(
rel="preconnect",
href="https://fonts.gstatic.com",
cross_origin="",
),
rx.el.link(
href="https://fonts.googleapis.com/css2?family=Instrument+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&family=Space+Mono:ital,wght@0,400;0,700;1,400;1,700&family=IBM+Plex+Mono:ital,wght@0,500;0,600;1,600&family=Source+Code+Pro:wght@400;500&display=swap&family=JetBrains+Mono:wght@400;500;600;700&display=swap",
rel="stylesheet",
),
],
)
# XXX: The app is TOO BIG to build on Windows, so explicitly disallow it except for testing
if sys.platform == "win32":
if not os.environ.get("REFLEX_WEB_WINDOWS_OVERRIDE"):
raise RuntimeError(
"reflex-web cannot be built on Windows due to EMFILE error. To build a "
"subset of pages for testing, set environment variable REFLEX_WEB_WINDOWS_OVERRIDE."
)
|
# Add the pages to the app.
for route in routes:
# print(f"Adding route: {route}")
if _check_whitelisted_path(route.path):
page_args = {
"component": route.component,
"route": route.path,
"title": route.title,
"image": (
"/previews/index_preview.webp" if route.image is None else route.image
),
"meta": [
{"name": "theme-color", "content": route.background_color},
],
}
# Add the description only if it is not None
if route.description is not None:
page_args["description"] = route.description
# Add the extra meta data only if it is not None
if route.meta is not None:
page_args["meta"].extend(route.meta)
# Call add_page with the dynamically constructed arguments
app.add_page(**page_args)
# Add redirects
redirects = [
("/docs/enterprise/ag-grid/index", "/docs/enterprise/ag-g | routes = routes[:WINDOWS_MAX_ROUTES] |
),
rx.el.link(
href="https://fonts.googleapis.com/css2?family=Instrument+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&family=Space+Mono:ital,wght@0,400;0,700;1,400;1,700&family=IBM+Plex+Mono:ital,wght@0,500;0,600;1,600&family=Source+Code+Pro:wght@400;500&display=swap&family=JetBrains+Mono:wght@400;500;600;700&display=swap",
rel="stylesheet",
),
],
)
# XXX: The app is TOO BIG to build on Windows, so explicitly disallow it except for testing
if sys.platform == "win32":
if not os.environ.get("REFLEX_WEB_WINDOWS_OVERRIDE"):
raise RuntimeError(
"reflex-web cannot be built on Windows due to EMFILE error. To build a "
"subset of pages for testing, set environment variable REFLEX_WEB_WINDOWS_OVERRIDE."
)
routes = routes[:WINDOWS_MAX_ROUTES]
# Add the pages to the app.
for route in routes:
# print(f"Adding route: {route}")
if _check_whitelisted_path(route.path):
|
# Add the description only if it is not None
if route.description is not None:
page_args["description"] = route.description
# Add the extra meta data only if it is not None
if route.meta is not None:
page_args["meta"].extend(route.meta)
# Call add_page with the dynamically constructed arguments
app.add_page(**page_args)
# Add redirects
redirects = [
("/docs/enterprise/ag-grid/index", "/docs/enterprise/ag-grid"),
("/docs/ai-builder/integrations", "/docs/ai-builder/integrations/overview"),
("/docs/ai-builder/app-lifecycle", "/docs/ai-builder/app-lifecycle/general"),
("/docs/ai-builder/features", "/docs/ai-builder/features/ide"),
("/docs/ai-builder", "/docs/ai-builder/overview/best-practices"),
("/docs/ai-builder/overview", "/docs/ai-builder/overview/best-practices"),
("/framework", "/open-source"),
("/docs", "/docs/getting-started/introduction"),
("/docs/getting-started", "/doc | page_args = {
"component": route.component,
"route": route.path,
"title": route.title,
"image": (
"/previews/index_preview.webp" if route.image is None else route.image
),
"meta": [
{"name": "theme-color", "content": route.background_color},
],
} |
pp is TOO BIG to build on Windows, so explicitly disallow it except for testing
if sys.platform == "win32":
if not os.environ.get("REFLEX_WEB_WINDOWS_OVERRIDE"):
raise RuntimeError(
"reflex-web cannot be built on Windows due to EMFILE error. To build a "
"subset of pages for testing, set environment variable REFLEX_WEB_WINDOWS_OVERRIDE."
)
routes = routes[:WINDOWS_MAX_ROUTES]
# Add the pages to the app.
for route in routes:
# print(f"Adding route: {route}")
if _check_whitelisted_path(route.path):
page_args = {
"component": route.component,
"route": route.path,
"title": route.title,
"image": (
"/previews/index_preview.webp" if route.image is None else route.image
),
"meta": [
{"name": "theme-color", "content": route.background_color},
],
}
# Add the description only if it is not None
|
# Add the extra meta data only if it is not None
if route.meta is not None:
page_args["meta"].extend(route.meta)
# Call add_page with the dynamically constructed arguments
app.add_page(**page_args)
# Add redirects
redirects = [
("/docs/enterprise/ag-grid/index", "/docs/enterprise/ag-grid"),
("/docs/ai-builder/integrations", "/docs/ai-builder/integrations/overview"),
("/docs/ai-builder/app-lifecycle", "/docs/ai-builder/app-lifecycle/general"),
("/docs/ai-builder/features", "/docs/ai-builder/features/ide"),
("/docs/ai-builder", "/docs/ai-builder/overview/best-practices"),
("/docs/ai-builder/overview", "/docs/ai-builder/overview/best-practices"),
("/framework", "/open-source"),
("/docs", "/docs/getting-started/introduction"),
("/docs/getting-started", "/docs/getting-started/introduction"),
("/docs/state", "/docs/state/overview"),
("/docs/styling", "/docs/styling/overview"),
("/docs/database", "/ | if route.description is not None:
page_args["description"] = route.description |
ly disallow it except for testing
if sys.platform == "win32":
if not os.environ.get("REFLEX_WEB_WINDOWS_OVERRIDE"):
raise RuntimeError(
"reflex-web cannot be built on Windows due to EMFILE error. To build a "
"subset of pages for testing, set environment variable REFLEX_WEB_WINDOWS_OVERRIDE."
)
routes = routes[:WINDOWS_MAX_ROUTES]
# Add the pages to the app.
for route in routes:
# print(f"Adding route: {route}")
if _check_whitelisted_path(route.path):
page_args = {
"component": route.component,
"route": route.path,
"title": route.title,
"image": (
"/previews/index_preview.webp" if route.image is None else route.image
),
"meta": [
{"name": "theme-color", "content": route.background_color},
],
}
# Add the description only if it is not None
if route.description is not None:
|
# Add the extra meta data only if it is not None
if route.meta is not None:
page_args["meta"].extend(route.meta)
# Call add_page with the dynamically constructed arguments
app.add_page(**page_args)
# Add redirects
redirects = [
("/docs/enterprise/ag-grid/index", "/docs/enterprise/ag-grid"),
("/docs/ai-builder/integrations", "/docs/ai-builder/integrations/overview"),
("/docs/ai-builder/app-lifecycle", "/docs/ai-builder/app-lifecycle/general"),
("/docs/ai-builder/features", "/docs/ai-builder/features/ide"),
("/docs/ai-builder", "/docs/ai-builder/overview/best-practices"),
("/docs/ai-builder/overview", "/docs/ai-builder/overview/best-practices"),
("/framework", "/open-source"),
("/docs", "/docs/getting-started/introduction"),
("/docs/getting-started", "/docs/getting-started/introduction"),
("/docs/state", "/docs/state/overview"),
("/docs/styling", "/docs/styling/overview"),
("/docs/database", "/ | page_args["description"] = route.description |
ERRIDE"):
raise RuntimeError(
"reflex-web cannot be built on Windows due to EMFILE error. To build a "
"subset of pages for testing, set environment variable REFLEX_WEB_WINDOWS_OVERRIDE."
)
routes = routes[:WINDOWS_MAX_ROUTES]
# Add the pages to the app.
for route in routes:
# print(f"Adding route: {route}")
if _check_whitelisted_path(route.path):
page_args = {
"component": route.component,
"route": route.path,
"title": route.title,
"image": (
"/previews/index_preview.webp" if route.image is None else route.image
),
"meta": [
{"name": "theme-color", "content": route.background_color},
],
}
# Add the description only if it is not None
if route.description is not None:
page_args["description"] = route.description
# Add the extra meta data only if it is not None
|
# Call add_page with the dynamically constructed arguments
app.add_page(**page_args)
# Add redirects
redirects = [
("/docs/enterprise/ag-grid/index", "/docs/enterprise/ag-grid"),
("/docs/ai-builder/integrations", "/docs/ai-builder/integrations/overview"),
("/docs/ai-builder/app-lifecycle", "/docs/ai-builder/app-lifecycle/general"),
("/docs/ai-builder/features", "/docs/ai-builder/features/ide"),
("/docs/ai-builder", "/docs/ai-builder/overview/best-practices"),
("/docs/ai-builder/overview", "/docs/ai-builder/overview/best-practices"),
("/framework", "/open-source"),
("/docs", "/docs/getting-started/introduction"),
("/docs/getting-started", "/docs/getting-started/introduction"),
("/docs/state", "/docs/state/overview"),
("/docs/styling", "/docs/styling/overview"),
("/docs/database", "/docs/database/overview"),
("/docs/hosting", "/docs/hosting/self-hosting"),
("/docs/advanced-guide", "/docs/advanced-guide/custom-vars | if route.meta is not None:
page_args["meta"].extend(route.meta) |
arding/how-reflex-works",
),
# Recipes
("/docs/recipes/auth", "/docs/recipes"),
("/docs/recipes/layout", "/docs/recipes"),
("/docs/recipes/others", "/docs/recipes"),
("/docs/recipes/content", "/docs/recipes"),
# redirect previous chakra links to the new chakra docs
("/docs/library/chakra/[[...splat]]", "https://chakra.reflex.run/introduction/"),
("/gallery", "/templates"),
# Redirect any removed pages to their new home.
("/docs/components/style-props", "/docs/components/props"),
("/docs/components/conditional-props", "/docs/components/conditional-rendering"),
("/docs/enterprise", "/docs/enterprise/overview"),
("/docs/pages/routes", "/docs/pages/overview"),
("/docs/assets/referencing_assets", "/docs/assets/overview"),
("/changelog", "https://github.com/reflex-dev/reflex/releases"),
(
"/blog/2025-10-27-top-10-data-visualization-libraries",
"/blog/2025-01-27-top-10-data-visualization-libraries",
),
]
|
app.add_page(page404.component, route=page404.path)
| for source, target in redirects:
if _check_whitelisted_path(target):
app.add_page(lambda: rx.fragment(), route=source, on_load=rx.redirect(target)) |
# Recipes
("/docs/recipes/auth", "/docs/recipes"),
("/docs/recipes/layout", "/docs/recipes"),
("/docs/recipes/others", "/docs/recipes"),
("/docs/recipes/content", "/docs/recipes"),
# redirect previous chakra links to the new chakra docs
("/docs/library/chakra/[[...splat]]", "https://chakra.reflex.run/introduction/"),
("/gallery", "/templates"),
# Redirect any removed pages to their new home.
("/docs/components/style-props", "/docs/components/props"),
("/docs/components/conditional-props", "/docs/components/conditional-rendering"),
("/docs/enterprise", "/docs/enterprise/overview"),
("/docs/pages/routes", "/docs/pages/overview"),
("/docs/assets/referencing_assets", "/docs/assets/overview"),
("/changelog", "https://github.com/reflex-dev/reflex/releases"),
(
"/blog/2025-10-27-top-10-data-visualization-libraries",
"/blog/2025-01-27-top-10-data-visualization-libraries",
),
]
for source, target in redirects:
|
app.add_page(page404.component, route=page404.path)
| if _check_whitelisted_path(target):
app.add_page(lambda: rx.fragment(), route=source, on_load=rx.redirect(target)) |
"""Manage routing for the application."""
|
from typing import Callable
import reflex as rx
from reflex.base import Base
class Route(Base):
"""A page route."""
# The path of the route.
path: str
# The page title.
title: str | None = None
# The page description.
description: str | None = None
# The page image.
image: str | None = None
# The page extra meta data.
meta: list[dict[str, str]] | None = None
# Background color for the page.
background_color: str | None = None
# The component to render for the route.
component: Callable[[], rx.Component]
# whether to add the route to the app's pages. This is typically used
# to delay adding the 404 page(which is explicitly added in pcweb.py).
# https://github.com/reflex-dev/reflex-web/pull/659#pullrequestreview-2021171902
add_as_page: bool = True
def __hash__(self):
"""Hash the route based on the path and title."""
return hash(f"{self.path}-{self.title}")
def get_path(component | import inspect |
"""Manage routing for the application."""
import inspect
|
import reflex as rx
from reflex.base import Base
class Route(Base):
"""A page route."""
# The path of the route.
path: str
# The page title.
title: str | None = None
# The page description.
description: str | None = None
# The page image.
image: str | None = None
# The page extra meta data.
meta: list[dict[str, str]] | None = None
# Background color for the page.
background_color: str | None = None
# The component to render for the route.
component: Callable[[], rx.Component]
# whether to add the route to the app's pages. This is typically used
# to delay adding the 404 page(which is explicitly added in pcweb.py).
# https://github.com/reflex-dev/reflex-web/pull/659#pullrequestreview-2021171902
add_as_page: bool = True
def __hash__(self):
"""Hash the route based on the path and title."""
return hash(f"{self.path}-{self.title}")
def get_path(component_fn: Callable):
"""Get t | from typing import Callable |
"""Manage routing for the application."""
import inspect
from typing import Callable
|
from reflex.base import Base
class Route(Base):
"""A page route."""
# The path of the route.
path: str
# The page title.
title: str | None = None
# The page description.
description: str | None = None
# The page image.
image: str | None = None
# The page extra meta data.
meta: list[dict[str, str]] | None = None
# Background color for the page.
background_color: str | None = None
# The component to render for the route.
component: Callable[[], rx.Component]
# whether to add the route to the app's pages. This is typically used
# to delay adding the 404 page(which is explicitly added in pcweb.py).
# https://github.com/reflex-dev/reflex-web/pull/659#pullrequestreview-2021171902
add_as_page: bool = True
def __hash__(self):
"""Hash the route based on the path and title."""
return hash(f"{self.path}-{self.title}")
def get_path(component_fn: Callable):
"""Get the path for a page ba | import reflex as rx |
"""Manage routing for the application."""
import inspect
from typing import Callable
import reflex as rx
|
class Route(Base):
"""A page route."""
# The path of the route.
path: str
# The page title.
title: str | None = None
# The page description.
description: str | None = None
# The page image.
image: str | None = None
# The page extra meta data.
meta: list[dict[str, str]] | None = None
# Background color for the page.
background_color: str | None = None
# The component to render for the route.
component: Callable[[], rx.Component]
# whether to add the route to the app's pages. This is typically used
# to delay adding the 404 page(which is explicitly added in pcweb.py).
# https://github.com/reflex-dev/reflex-web/pull/659#pullrequestreview-2021171902
add_as_page: bool = True
def __hash__(self):
"""Hash the route based on the path and title."""
return hash(f"{self.path}-{self.title}")
def get_path(component_fn: Callable):
"""Get the path for a page based on the file location.
| from reflex.base import Base |
"""Manage routing for the application."""
import inspect
from typing import Callable
import reflex as rx
from reflex.base import Base
class Route(Base):
"""A page route."""
# The path of the route.
path: str
# The page title.
title: str | None = None
# The page description.
description: str | None = None
# The page image.
image: str | None = None
# The page extra meta data.
meta: list[dict[str, str]] | None = None
# Background color for the page.
background_color: str | None = None
# The component to render for the route.
component: Callable[[], rx.Component]
# whether to add the route to the app's pages. This is typically used
# to delay adding the 404 page(which is explicitly added in pcweb.py).
# https://github.com/reflex-dev/reflex-web/pull/659#pullrequestreview-2021171902
add_as_page: bool = True
|
def get_path(component_fn: Callable):
"""Get the path for a page based on the file location.
Args:
component_fn: The component function for the page.
"""
module = inspect.getmodule(component_fn)
# Create a path based on the module name.
return (
module.__name__.replace(".", "/").replace("_", "-").split("pcweb/pages")[1]
+ "/"
)
| def __hash__(self):
"""Hash the route based on the path and title."""
return hash(f"{self.path}-{self.title}") |
path: str
# The page title.
title: str | None = None
# The page description.
description: str | None = None
# The page image.
image: str | None = None
# The page extra meta data.
meta: list[dict[str, str]] | None = None
# Background color for the page.
background_color: str | None = None
# The component to render for the route.
component: Callable[[], rx.Component]
# whether to add the route to the app's pages. This is typically used
# to delay adding the 404 page(which is explicitly added in pcweb.py).
# https://github.com/reflex-dev/reflex-web/pull/659#pullrequestreview-2021171902
add_as_page: bool = True
def __hash__(self):
"""Hash the route based on the path and title."""
return hash(f"{self.path}-{self.title}")
def get_path(component_fn: Callable):
"""Get the path for a page based on the file location.
Args:
component_fn: The component function for the page.
"""
|
# Create a path based on the module name.
return (
module.__name__.replace(".", "/").replace("_", "-").split("pcweb/pages")[1]
+ "/"
)
| module = inspect.getmodule(component_fn) |
import os
from datetime import datetime
from typing import Any
import httpx
import reflex as rx
from email_validator import EmailNotValidError, ValidatedEmail, validate_email
from sqlmodel import Field
from pcweb.constants import (
API_BASE_URL_LOOPS,
REFLEX_DEV_WEB_NEWSLETTER_FORM_WEBHOOK_URL,
)
class Waitlist(rx.Model, table=True):
email: str
date_created: datetime = Field(default_factory=datetime.utcnow, nullable=False)
class IndexState(rx.State):
"""Hold the state for the home page."""
# Whether the user signed up for the newsletter.
signed_up: bool = False
# Whether to show the confetti.
show_confetti: bool = False
@rx.event(background=True)
async def send_contact_to_webhook(
self,
email: str,
) -> None:
with contextlib.suppress(httpx.HTTPError):
async with httpx.AsyncClient() as client:
response = await client.post(
REFLEX_DEV_WEB_NEWSLETTER_FORM_WEBHO | import contextlib | |
import contextlib
import os
|
from typing import Any
import httpx
import reflex as rx
from email_validator import EmailNotValidError, ValidatedEmail, validate_email
from sqlmodel import Field
from pcweb.constants import (
API_BASE_URL_LOOPS,
REFLEX_DEV_WEB_NEWSLETTER_FORM_WEBHOOK_URL,
)
class Waitlist(rx.Model, table=True):
email: str
date_created: datetime = Field(default_factory=datetime.utcnow, nullable=False)
class IndexState(rx.State):
"""Hold the state for the home page."""
# Whether the user signed up for the newsletter.
signed_up: bool = False
# Whether to show the confetti.
show_confetti: bool = False
@rx.event(background=True)
async def send_contact_to_webhook(
self,
email: str,
) -> None:
with contextlib.suppress(httpx.HTTPError):
async with httpx.AsyncClient() as client:
response = await client.post(
REFLEX_DEV_WEB_NEWSLETTER_FORM_WEBHOOK_URL,
json={
| from datetime import datetime |
import contextlib
import os
from datetime import datetime
|
import httpx
import reflex as rx
from email_validator import EmailNotValidError, ValidatedEmail, validate_email
from sqlmodel import Field
from pcweb.constants import (
API_BASE_URL_LOOPS,
REFLEX_DEV_WEB_NEWSLETTER_FORM_WEBHOOK_URL,
)
class Waitlist(rx.Model, table=True):
email: str
date_created: datetime = Field(default_factory=datetime.utcnow, nullable=False)
class IndexState(rx.State):
"""Hold the state for the home page."""
# Whether the user signed up for the newsletter.
signed_up: bool = False
# Whether to show the confetti.
show_confetti: bool = False
@rx.event(background=True)
async def send_contact_to_webhook(
self,
email: str,
) -> None:
with contextlib.suppress(httpx.HTTPError):
async with httpx.AsyncClient() as client:
response = await client.post(
REFLEX_DEV_WEB_NEWSLETTER_FORM_WEBHOOK_URL,
json={
"ema | from typing import Any |
import contextlib
import os
from datetime import datetime
from typing import Any
|
import reflex as rx
from email_validator import EmailNotValidError, ValidatedEmail, validate_email
from sqlmodel import Field
from pcweb.constants import (
API_BASE_URL_LOOPS,
REFLEX_DEV_WEB_NEWSLETTER_FORM_WEBHOOK_URL,
)
class Waitlist(rx.Model, table=True):
email: str
date_created: datetime = Field(default_factory=datetime.utcnow, nullable=False)
class IndexState(rx.State):
"""Hold the state for the home page."""
# Whether the user signed up for the newsletter.
signed_up: bool = False
# Whether to show the confetti.
show_confetti: bool = False
@rx.event(background=True)
async def send_contact_to_webhook(
self,
email: str,
) -> None:
with contextlib.suppress(httpx.HTTPError):
async with httpx.AsyncClient() as client:
response = await client.post(
REFLEX_DEV_WEB_NEWSLETTER_FORM_WEBHOOK_URL,
json={
"email": email,
| import httpx |
import contextlib
import os
from datetime import datetime
from typing import Any
import httpx
|
from email_validator import EmailNotValidError, ValidatedEmail, validate_email
from sqlmodel import Field
from pcweb.constants import (
API_BASE_URL_LOOPS,
REFLEX_DEV_WEB_NEWSLETTER_FORM_WEBHOOK_URL,
)
class Waitlist(rx.Model, table=True):
email: str
date_created: datetime = Field(default_factory=datetime.utcnow, nullable=False)
class IndexState(rx.State):
"""Hold the state for the home page."""
# Whether the user signed up for the newsletter.
signed_up: bool = False
# Whether to show the confetti.
show_confetti: bool = False
@rx.event(background=True)
async def send_contact_to_webhook(
self,
email: str,
) -> None:
with contextlib.suppress(httpx.HTTPError):
async with httpx.AsyncClient() as client:
response = await client.post(
REFLEX_DEV_WEB_NEWSLETTER_FORM_WEBHOOK_URL,
json={
"email": email,
}, | import reflex as rx |
import contextlib
import os
from datetime import datetime
from typing import Any
import httpx
import reflex as rx
|
from sqlmodel import Field
from pcweb.constants import (
API_BASE_URL_LOOPS,
REFLEX_DEV_WEB_NEWSLETTER_FORM_WEBHOOK_URL,
)
class Waitlist(rx.Model, table=True):
email: str
date_created: datetime = Field(default_factory=datetime.utcnow, nullable=False)
class IndexState(rx.State):
"""Hold the state for the home page."""
# Whether the user signed up for the newsletter.
signed_up: bool = False
# Whether to show the confetti.
show_confetti: bool = False
@rx.event(background=True)
async def send_contact_to_webhook(
self,
email: str,
) -> None:
with contextlib.suppress(httpx.HTTPError):
async with httpx.AsyncClient() as client:
response = await client.post(
REFLEX_DEV_WEB_NEWSLETTER_FORM_WEBHOOK_URL,
json={
"email": email,
},
)
response.raise_for_status()
@rx.event(backg | from email_validator import EmailNotValidError, ValidatedEmail, validate_email |
import contextlib
import os
from datetime import datetime
from typing import Any
import httpx
import reflex as rx
from email_validator import EmailNotValidError, ValidatedEmail, validate_email
|
from pcweb.constants import (
API_BASE_URL_LOOPS,
REFLEX_DEV_WEB_NEWSLETTER_FORM_WEBHOOK_URL,
)
class Waitlist(rx.Model, table=True):
email: str
date_created: datetime = Field(default_factory=datetime.utcnow, nullable=False)
class IndexState(rx.State):
"""Hold the state for the home page."""
# Whether the user signed up for the newsletter.
signed_up: bool = False
# Whether to show the confetti.
show_confetti: bool = False
@rx.event(background=True)
async def send_contact_to_webhook(
self,
email: str,
) -> None:
with contextlib.suppress(httpx.HTTPError):
async with httpx.AsyncClient() as client:
response = await client.post(
REFLEX_DEV_WEB_NEWSLETTER_FORM_WEBHOOK_URL,
json={
"email": email,
},
)
response.raise_for_status()
@rx.event(background=True)
async def a | from sqlmodel import Field |
import contextlib
import os
from datetime import datetime
from typing import Any
import httpx
import reflex as rx
from email_validator import EmailNotValidError, ValidatedEmail, validate_email
from sqlmodel import Field
|
class Waitlist(rx.Model, table=True):
email: str
date_created: datetime = Field(default_factory=datetime.utcnow, nullable=False)
class IndexState(rx.State):
"""Hold the state for the home page."""
# Whether the user signed up for the newsletter.
signed_up: bool = False
# Whether to show the confetti.
show_confetti: bool = False
@rx.event(background=True)
async def send_contact_to_webhook(
self,
email: str,
) -> None:
with contextlib.suppress(httpx.HTTPError):
async with httpx.AsyncClient() as client:
response = await client.post(
REFLEX_DEV_WEB_NEWSLETTER_FORM_WEBHOOK_URL,
json={
"email": email,
},
)
response.raise_for_status()
@rx.event(background=True)
async def add_contact_to_loops(
self,
email: str,
):
url: str = f"{API_BASE_URL_LOOPS}/c | from pcweb.constants import (
API_BASE_URL_LOOPS,
REFLEX_DEV_WEB_NEWSLETTER_FORM_WEBHOOK_URL,
) |
import contextlib
import os
from datetime import datetime
from typing import Any
import httpx
import reflex as rx
from email_validator import EmailNotValidError, ValidatedEmail, validate_email
from sqlmodel import Field
from pcweb.constants import (
API_BASE_URL_LOOPS,
REFLEX_DEV_WEB_NEWSLETTER_FORM_WEBHOOK_URL,
)
|
class IndexState(rx.State):
"""Hold the state for the home page."""
# Whether the user signed up for the newsletter.
signed_up: bool = False
# Whether to show the confetti.
show_confetti: bool = False
@rx.event(background=True)
async def send_contact_to_webhook(
self,
email: str,
) -> None:
with contextlib.suppress(httpx.HTTPError):
async with httpx.AsyncClient() as client:
response = await client.post(
REFLEX_DEV_WEB_NEWSLETTER_FORM_WEBHOOK_URL,
json={
"email": email,
},
)
response.raise_for_status()
@rx.event(background=True)
async def add_contact_to_loops(
self,
email: str,
):
url: str = f"{API_BASE_URL_LOOPS}/contacts/create"
loops_api_key: str | None = os.getenv("LOOPS_API_KEY")
if loops_api_key is None:
print("Loops A | class Waitlist(rx.Model, table=True):
email: str
date_created: datetime = Field(default_factory=datetime.utcnow, nullable=False) |
import contextlib
import os
from datetime import datetime
from typing import Any
import httpx
import reflex as rx
from email_validator import EmailNotValidError, ValidatedEmail, validate_email
from sqlmodel import Field
from pcweb.constants import (
API_BASE_URL_LOOPS,
REFLEX_DEV_WEB_NEWSLETTER_FORM_WEBHOOK_URL,
)
class Waitlist(rx.Model, table=True):
email: str
date_created: datetime = Field(default_factory=datetime.utcnow, nullable=False)
class IndexState(rx.State):
"""Hold the state for the home page."""
# Whether the user signed up for the newsletter.
signed_up: bool = False
# Whether to show the confetti.
show_confetti: bool = False
@rx.event(background=True)
async def send_contact_to_webhook(
self,
email: str,
) -> None:
with contextlib.suppress(httpx.HTTPError):
async with httpx.AsyncClient() as client:
|
response.raise_for_status()
@rx.event(background=True)
async def add_contact_to_loops(
self,
email: str,
):
url: str = f"{API_BASE_URL_LOOPS}/contacts/create"
loops_api_key: str | None = os.getenv("LOOPS_API_KEY")
if loops_api_key is None:
print("Loops API key does not exist")
return
headers = {
"Accept": "application/json",
"Authorization": f"Bearer {loops_api_key}",
}
try:
async with httpx.AsyncClient() as client:
response = await client.post(
url,
headers=headers,
json={
"email": email,
},
)
response.raise_for_status() # Raise an exception for HTTP errors (4xx and 5xx)
except httpx.HTTPError as e:
print(f"An error occurred: {e}")
@rx.event
def signup_for_ | response = await client.post(
REFLEX_DEV_WEB_NEWSLETTER_FORM_WEBHOOK_URL,
json={
"email": email,
},
) |
eld(default_factory=datetime.utcnow, nullable=False)
class IndexState(rx.State):
"""Hold the state for the home page."""
# Whether the user signed up for the newsletter.
signed_up: bool = False
# Whether to show the confetti.
show_confetti: bool = False
@rx.event(background=True)
async def send_contact_to_webhook(
self,
email: str,
) -> None:
with contextlib.suppress(httpx.HTTPError):
async with httpx.AsyncClient() as client:
response = await client.post(
REFLEX_DEV_WEB_NEWSLETTER_FORM_WEBHOOK_URL,
json={
"email": email,
},
)
response.raise_for_status()
@rx.event(background=True)
async def add_contact_to_loops(
self,
email: str,
):
url: str = f"{API_BASE_URL_LOOPS}/contacts/create"
loops_api_key: str | None = os.getenv("LOOPS_API_KEY")
|
headers = {
"Accept": "application/json",
"Authorization": f"Bearer {loops_api_key}",
}
try:
async with httpx.AsyncClient() as client:
response = await client.post(
url,
headers=headers,
json={
"email": email,
},
)
response.raise_for_status() # Raise an exception for HTTP errors (4xx and 5xx)
except httpx.HTTPError as e:
print(f"An error occurred: {e}")
@rx.event
def signup_for_another_user(self):
self.signed_up = False
@rx.event(background=True)
async def signup(
self,
form_data: dict[str, Any],
):
"""Sign the user up for the newsletter."""
email: str | None = None
if email_to_validate := form_data.get("input_email"):
try:
validated_email: ValidatedEmail = | if loops_api_key is None:
print("Loops API key does not exist")
return |
e)
async def send_contact_to_webhook(
self,
email: str,
) -> None:
with contextlib.suppress(httpx.HTTPError):
async with httpx.AsyncClient() as client:
response = await client.post(
REFLEX_DEV_WEB_NEWSLETTER_FORM_WEBHOOK_URL,
json={
"email": email,
},
)
response.raise_for_status()
@rx.event(background=True)
async def add_contact_to_loops(
self,
email: str,
):
url: str = f"{API_BASE_URL_LOOPS}/contacts/create"
loops_api_key: str | None = os.getenv("LOOPS_API_KEY")
if loops_api_key is None:
print("Loops API key does not exist")
return
headers = {
"Accept": "application/json",
"Authorization": f"Bearer {loops_api_key}",
}
try:
async with httpx.AsyncClient() as client:
|
response.raise_for_status() # Raise an exception for HTTP errors (4xx and 5xx)
except httpx.HTTPError as e:
print(f"An error occurred: {e}")
@rx.event
def signup_for_another_user(self):
self.signed_up = False
@rx.event(background=True)
async def signup(
self,
form_data: dict[str, Any],
):
"""Sign the user up for the newsletter."""
email: str | None = None
if email_to_validate := form_data.get("input_email"):
try:
validated_email: ValidatedEmail = validate_email(
email_to_validate,
check_deliverability=True,
)
email = validated_email.normalized
except EmailNotValidError as e:
# Alert the error message.
yield rx.toast.warning(
str(e),
style={
"border": "1px solid #3C3646",
| response = await client.post(
url,
headers=headers,
json={
"email": email,
},
) |
)
response.raise_for_status()
@rx.event(background=True)
async def add_contact_to_loops(
self,
email: str,
):
url: str = f"{API_BASE_URL_LOOPS}/contacts/create"
loops_api_key: str | None = os.getenv("LOOPS_API_KEY")
if loops_api_key is None:
print("Loops API key does not exist")
return
headers = {
"Accept": "application/json",
"Authorization": f"Bearer {loops_api_key}",
}
try:
async with httpx.AsyncClient() as client:
response = await client.post(
url,
headers=headers,
json={
"email": email,
},
)
response.raise_for_status() # Raise an exception for HTTP errors (4xx and 5xx)
except httpx.HTTPError as e:
print(f"An error occurred: {e}")
@rx.event
|
@rx.event(background=True)
async def signup(
self,
form_data: dict[str, Any],
):
"""Sign the user up for the newsletter."""
email: str | None = None
if email_to_validate := form_data.get("input_email"):
try:
validated_email: ValidatedEmail = validate_email(
email_to_validate,
check_deliverability=True,
)
email = validated_email.normalized
except EmailNotValidError as e:
# Alert the error message.
yield rx.toast.warning(
str(e),
style={
"border": "1px solid #3C3646",
"background": "linear-gradient(218deg, #1D1B23 -35.66%, #131217 100.84%)",
},
)
return
yield IndexState.send_contact_to_webhook(email)
yield IndexState.add_contact_to_loops(e | def signup_for_another_user(self):
self.signed_up = False |
for_status()
@rx.event(background=True)
async def add_contact_to_loops(
self,
email: str,
):
url: str = f"{API_BASE_URL_LOOPS}/contacts/create"
loops_api_key: str | None = os.getenv("LOOPS_API_KEY")
if loops_api_key is None:
print("Loops API key does not exist")
return
headers = {
"Accept": "application/json",
"Authorization": f"Bearer {loops_api_key}",
}
try:
async with httpx.AsyncClient() as client:
response = await client.post(
url,
headers=headers,
json={
"email": email,
},
)
response.raise_for_status() # Raise an exception for HTTP errors (4xx and 5xx)
except httpx.HTTPError as e:
print(f"An error occurred: {e}")
@rx.event
def signup_for_another_user(self):
|
@rx.event(background=True)
async def signup(
self,
form_data: dict[str, Any],
):
"""Sign the user up for the newsletter."""
email: str | None = None
if email_to_validate := form_data.get("input_email"):
try:
validated_email: ValidatedEmail = validate_email(
email_to_validate,
check_deliverability=True,
)
email = validated_email.normalized
except EmailNotValidError as e:
# Alert the error message.
yield rx.toast.warning(
str(e),
style={
"border": "1px solid #3C3646",
"background": "linear-gradient(218deg, #1D1B23 -35.66%, #131217 100.84%)",
},
)
return
yield IndexState.send_contact_to_webhook(email)
yield IndexState.add_contact_to_loops(e | self.signed_up = False |
try:
async with httpx.AsyncClient() as client:
response = await client.post(
url,
headers=headers,
json={
"email": email,
},
)
response.raise_for_status() # Raise an exception for HTTP errors (4xx and 5xx)
except httpx.HTTPError as e:
print(f"An error occurred: {e}")
@rx.event
def signup_for_another_user(self):
self.signed_up = False
@rx.event(background=True)
async def signup(
self,
form_data: dict[str, Any],
):
"""Sign the user up for the newsletter."""
email: str | None = None
if email_to_validate := form_data.get("input_email"):
try:
validated_email: ValidatedEmail = validate_email(
email_to_validate,
check_deliverability=True,
)
|
except EmailNotValidError as e:
# Alert the error message.
yield rx.toast.warning(
str(e),
style={
"border": "1px solid #3C3646",
"background": "linear-gradient(218deg, #1D1B23 -35.66%, #131217 100.84%)",
},
)
return
yield IndexState.send_contact_to_webhook(email)
yield IndexState.add_contact_to_loops(email)
async with self:
self.signed_up = True
yield
yield [
rx.call_script(
f"try {{ ko.identify('{email}'); }} catch(e) {{ console.warn('Koala identify failed:', e); }}"
),
rx.toast.success("Thanks for signing up to the Newsletter!"),
]
| email = validated_email.normalized |
def signup(
self,
form_data: dict[str, Any],
):
"""Sign the user up for the newsletter."""
email: str | None = None
if email_to_validate := form_data.get("input_email"):
try:
validated_email: ValidatedEmail = validate_email(
email_to_validate,
check_deliverability=True,
)
email = validated_email.normalized
except EmailNotValidError as e:
# Alert the error message.
yield rx.toast.warning(
str(e),
style={
"border": "1px solid #3C3646",
"background": "linear-gradient(218deg, #1D1B23 -35.66%, #131217 100.84%)",
},
)
return
yield IndexState.send_contact_to_webhook(email)
yield IndexState.add_contact_to_loops(email)
async with self:
|
yield
yield [
rx.call_script(
f"try {{ ko.identify('{email}'); }} catch(e) {{ console.warn('Koala identify failed:', e); }}"
),
rx.toast.success("Thanks for signing up to the Newsletter!"),
]
| self.signed_up = True |
"""A list of whitelist paths that should be built.
If the list is empty, all pages will be built.
Tips:
- Ensure that the path starts with a forward slash '/'.
- Do not include a trailing slash '/' at the end of the path.
Examples:
- Correct: WHITELISTED_PAGES = ["/docs/getting-started/introduction"]
- Incorrect: WHITELISTED_PAGES = ["/docs/getting-started/introduction/"]
"""
|
def _check_whitelisted_path(path: str):
if len(WHITELISTED_PAGES) == 0:
return True
# If the path is the root, always build it.
if path == "/":
return True
if len(WHITELISTED_PAGES) == 1 and WHITELISTED_PAGES[0] == "/":
return False
for whitelisted_path in WHITELISTED_PAGES:
if path.startswith(whitelisted_path):
return True
return False
| WHITELISTED_PAGES = [] |
"""A list of whitelist paths that should be built.
If the list is empty, all pages will be built.
Tips:
- Ensure that the path starts with a forward slash '/'.
- Do not include a trailing slash '/' at the end of the path.
Examples:
- Correct: WHITELISTED_PAGES = ["/docs/getting-started/introduction"]
- Incorrect: WHITELISTED_PAGES = ["/docs/getting-started/introduction/"]
"""
WHITELISTED_PAGES = []
def _check_whitelisted_path(path: str):
|
# If the path is the root, always build it.
if path == "/":
return True
if len(WHITELISTED_PAGES) == 1 and WHITELISTED_PAGES[0] == "/":
return False
for whitelisted_path in WHITELISTED_PAGES:
if path.startswith(whitelisted_path):
return True
return False
| if len(WHITELISTED_PAGES) == 0:
return True |
"""A list of whitelist paths that should be built.
If the list is empty, all pages will be built.
Tips:
- Ensure that the path starts with a forward slash '/'.
- Do not include a trailing slash '/' at the end of the path.
Examples:
- Correct: WHITELISTED_PAGES = ["/docs/getting-started/introduction"]
- Incorrect: WHITELISTED_PAGES = ["/docs/getting-started/introduction/"]
"""
WHITELISTED_PAGES = []
def _check_whitelisted_path(path: str):
if len(WHITELISTED_PAGES) == 0:
return True
# If the path is the root, always build it.
|
if len(WHITELISTED_PAGES) == 1 and WHITELISTED_PAGES[0] == "/":
return False
for whitelisted_path in WHITELISTED_PAGES:
if path.startswith(whitelisted_path):
return True
return False
| if path == "/":
return True |
"""A list of whitelist paths that should be built.
If the list is empty, all pages will be built.
Tips:
- Ensure that the path starts with a forward slash '/'.
- Do not include a trailing slash '/' at the end of the path.
Examples:
- Correct: WHITELISTED_PAGES = ["/docs/getting-started/introduction"]
- Incorrect: WHITELISTED_PAGES = ["/docs/getting-started/introduction/"]
"""
WHITELISTED_PAGES = []
def _check_whitelisted_path(path: str):
if len(WHITELISTED_PAGES) == 0:
return True
# If the path is the root, always build it.
if path == "/":
return True
if len(WHITELISTED_PAGES) == 1 and WHITELISTED_PAGES[0] == "/":
return False
for whitelisted_path in WHITELISTED_PAGES:
|
return False
| if path.startswith(whitelisted_path):
return True |
import reflex as rx
from pcweb.components.icons import get_icon
LiteralButtonVariant = Literal[
"primary", "success", "destructive", "secondary", "muted"
]
default_class_name = "text-sm font-semibold rounded-xl cursor-pointer inline-flex items-center justify-center px-[0.875rem] py-2 relative transition-bg border-t"
after_class_name = "after:absolute after:inset-[1px] after:border-t after:rounded-[11px] after:border-white after:opacity-[0.22]"
def get_variant_class(variant: str) -> str:
return (
f"bg-gradient-to-b from-(--{variant}-9) to-(--{variant}-9) hover:to-(--{variant}-10) text-white"
+ " "
)
variant_styles = {
"primary": {
"class_name": get_variant_class("violet"),
},
"success": {
"class_name": get_variant_class("green"),
},
"destructive": {
"class_name": get_variant_class("red"),
},
"muted": {
"class_name": "bg-slate-3 hover:bg-slate-5 text-slate-9 border-t !border-slate-5",
}, | from typing import Callable, Literal | |
from typing import Callable, Literal
|
from pcweb.components.icons import get_icon
LiteralButtonVariant = Literal[
"primary", "success", "destructive", "secondary", "muted"
]
default_class_name = "text-sm font-semibold rounded-xl cursor-pointer inline-flex items-center justify-center px-[0.875rem] py-2 relative transition-bg border-t"
after_class_name = "after:absolute after:inset-[1px] after:border-t after:rounded-[11px] after:border-white after:opacity-[0.22]"
def get_variant_class(variant: str) -> str:
return (
f"bg-gradient-to-b from-(--{variant}-9) to-(--{variant}-9) hover:to-(--{variant}-10) text-white"
+ " "
)
variant_styles = {
"primary": {
"class_name": get_variant_class("violet"),
},
"success": {
"class_name": get_variant_class("green"),
},
"destructive": {
"class_name": get_variant_class("red"),
},
"muted": {
"class_name": "bg-slate-3 hover:bg-slate-5 text-slate-9 border-t !border-slate-5",
},
"secondary": {
| import reflex as rx |
from typing import Callable, Literal
import reflex as rx
|
LiteralButtonVariant = Literal[
"primary", "success", "destructive", "secondary", "muted"
]
default_class_name = "text-sm font-semibold rounded-xl cursor-pointer inline-flex items-center justify-center px-[0.875rem] py-2 relative transition-bg border-t"
after_class_name = "after:absolute after:inset-[1px] after:border-t after:rounded-[11px] after:border-white after:opacity-[0.22]"
def get_variant_class(variant: str) -> str:
return (
f"bg-gradient-to-b from-(--{variant}-9) to-(--{variant}-9) hover:to-(--{variant}-10) text-white"
+ " "
)
variant_styles = {
"primary": {
"class_name": get_variant_class("violet"),
},
"success": {
"class_name": get_variant_class("green"),
},
"destructive": {
"class_name": get_variant_class("red"),
},
"muted": {
"class_name": "bg-slate-3 hover:bg-slate-5 text-slate-9 border-t !border-slate-5",
},
"secondary": {
"class_name": "bg-slate-4 hover:bg-sla | from pcweb.components.icons import get_icon |
from typing import Callable, Literal
import reflex as rx
from pcweb.components.icons import get_icon
|
default_class_name = "text-sm font-semibold rounded-xl cursor-pointer inline-flex items-center justify-center px-[0.875rem] py-2 relative transition-bg border-t"
after_class_name = "after:absolute after:inset-[1px] after:border-t after:rounded-[11px] after:border-white after:opacity-[0.22]"
def get_variant_class(variant: str) -> str:
return (
f"bg-gradient-to-b from-(--{variant}-9) to-(--{variant}-9) hover:to-(--{variant}-10) text-white"
+ " "
)
variant_styles = {
"primary": {
"class_name": get_variant_class("violet"),
},
"success": {
"class_name": get_variant_class("green"),
},
"destructive": {
"class_name": get_variant_class("red"),
},
"muted": {
"class_name": "bg-slate-3 hover:bg-slate-5 text-slate-9 border-t !border-slate-5",
},
"secondary": {
"class_name": "bg-slate-4 hover:bg-slate-5 text-slate-10 !border-none",
},
}
def button(
text: str,
variant: LiteralButto | LiteralButtonVariant = Literal[
"primary", "success", "destructive", "secondary", "muted"
] |
from typing import Callable, Literal
import reflex as rx
from pcweb.components.icons import get_icon
LiteralButtonVariant = Literal[
"primary", "success", "destructive", "secondary", "muted"
]
|
after_class_name = "after:absolute after:inset-[1px] after:border-t after:rounded-[11px] after:border-white after:opacity-[0.22]"
def get_variant_class(variant: str) -> str:
return (
f"bg-gradient-to-b from-(--{variant}-9) to-(--{variant}-9) hover:to-(--{variant}-10) text-white"
+ " "
)
variant_styles = {
"primary": {
"class_name": get_variant_class("violet"),
},
"success": {
"class_name": get_variant_class("green"),
},
"destructive": {
"class_name": get_variant_class("red"),
},
"muted": {
"class_name": "bg-slate-3 hover:bg-slate-5 text-slate-9 border-t !border-slate-5",
},
"secondary": {
"class_name": "bg-slate-4 hover:bg-slate-5 text-slate-10 !border-none",
},
}
def button(
text: str,
variant: LiteralButtonVariant = "primary",
onclick: Callable | None = None,
style: dict | None = None,
class_name: str = "",
*children,
**props,
) -> rx.Component:
| default_class_name = "text-sm font-semibold rounded-xl cursor-pointer inline-flex items-center justify-center px-[0.875rem] py-2 relative transition-bg border-t" |
from typing import Callable, Literal
import reflex as rx
from pcweb.components.icons import get_icon
LiteralButtonVariant = Literal[
"primary", "success", "destructive", "secondary", "muted"
]
default_class_name = "text-sm font-semibold rounded-xl cursor-pointer inline-flex items-center justify-center px-[0.875rem] py-2 relative transition-bg border-t"
|
def get_variant_class(variant: str) -> str:
return (
f"bg-gradient-to-b from-(--{variant}-9) to-(--{variant}-9) hover:to-(--{variant}-10) text-white"
+ " "
)
variant_styles = {
"primary": {
"class_name": get_variant_class("violet"),
},
"success": {
"class_name": get_variant_class("green"),
},
"destructive": {
"class_name": get_variant_class("red"),
},
"muted": {
"class_name": "bg-slate-3 hover:bg-slate-5 text-slate-9 border-t !border-slate-5",
},
"secondary": {
"class_name": "bg-slate-4 hover:bg-slate-5 text-slate-10 !border-none",
},
}
def button(
text: str,
variant: LiteralButtonVariant = "primary",
onclick: Callable | None = None,
style: dict | None = None,
class_name: str = "",
*children,
**props,
) -> rx.Component:
return rx.el.button(
text,
*children,
onclick=onclick,
style=style if style is not None else {} | after_class_name = "after:absolute after:inset-[1px] after:border-t after:rounded-[11px] after:border-white after:opacity-[0.22]" |
from typing import Callable, Literal
import reflex as rx
from pcweb.components.icons import get_icon
LiteralButtonVariant = Literal[
"primary", "success", "destructive", "secondary", "muted"
]
default_class_name = "text-sm font-semibold rounded-xl cursor-pointer inline-flex items-center justify-center px-[0.875rem] py-2 relative transition-bg border-t"
after_class_name = "after:absolute after:inset-[1px] after:border-t after:rounded-[11px] after:border-white after:opacity-[0.22]"
|
variant_styles = {
"primary": {
"class_name": get_variant_class("violet"),
},
"success": {
"class_name": get_variant_class("green"),
},
"destructive": {
"class_name": get_variant_class("red"),
},
"muted": {
"class_name": "bg-slate-3 hover:bg-slate-5 text-slate-9 border-t !border-slate-5",
},
"secondary": {
"class_name": "bg-slate-4 hover:bg-slate-5 text-slate-10 !border-none",
},
}
def button(
text: str,
variant: LiteralButtonVariant = "primary",
onclick: Callable | None = None,
style: dict | None = None,
class_name: str = "",
*children,
**props,
) -> rx.Component:
return rx.el.button(
text,
*children,
onclick=onclick,
style=style if style is not None else {},
class_name=default_class_name
+ " "
+ variant_styles[variant]["class_name"]
+ " "
+ class_name,
**props,
)
def button_with_icon( | def get_variant_class(variant: str) -> str:
return (
f"bg-gradient-to-b from-(--{variant}-9) to-(--{variant}-9) hover:to-(--{variant}-10) text-white"
+ " "
) |
from reflex.experimental.client_state import ClientStateVar
from pcweb.components.icons.hugeicons import hi
from pcweb.components.icons.icons import get_icon
@rx.memo
def install_command(
command: str,
show_dollar_sign: bool = True,
) -> rx.Component:
copied = ClientStateVar.create("is_copied", default=False, global_ref=False)
return rx.el.button(
rx.cond(
copied.value,
hi(
"tick-02",
size=14,
class_name="ml-[5px] shrink-0",
),
hi("copy-01", size=14, class_name="shrink-0 ml-[5px]"),
),
rx.text(
rx.cond(
show_dollar_sign,
f"${command}",
command,
),
as_="p",
class_name="font-small text-start truncate",
),
title=command,
on_click=[
rx.call_function(copied.set_value(True)),
rx.set_clipboard(command),
], | import reflex as rx | |
import reflex as rx
|
from pcweb.components.icons.hugeicons import hi
from pcweb.components.icons.icons import get_icon
@rx.memo
def install_command(
command: str,
show_dollar_sign: bool = True,
) -> rx.Component:
copied = ClientStateVar.create("is_copied", default=False, global_ref=False)
return rx.el.button(
rx.cond(
copied.value,
hi(
"tick-02",
size=14,
class_name="ml-[5px] shrink-0",
),
hi("copy-01", size=14, class_name="shrink-0 ml-[5px]"),
),
rx.text(
rx.cond(
show_dollar_sign,
f"${command}",
command,
),
as_="p",
class_name="font-small text-start truncate",
),
title=command,
on_click=[
rx.call_function(copied.set_value(True)),
rx.set_clipboard(command),
],
on_mouse_down=rx.call_function(copied.set_value(Fal | from reflex.experimental.client_state import ClientStateVar |
import reflex as rx
from reflex.experimental.client_state import ClientStateVar
|
from pcweb.components.icons.icons import get_icon
@rx.memo
def install_command(
command: str,
show_dollar_sign: bool = True,
) -> rx.Component:
copied = ClientStateVar.create("is_copied", default=False, global_ref=False)
return rx.el.button(
rx.cond(
copied.value,
hi(
"tick-02",
size=14,
class_name="ml-[5px] shrink-0",
),
hi("copy-01", size=14, class_name="shrink-0 ml-[5px]"),
),
rx.text(
rx.cond(
show_dollar_sign,
f"${command}",
command,
),
as_="p",
class_name="font-small text-start truncate",
),
title=command,
on_click=[
rx.call_function(copied.set_value(True)),
rx.set_clipboard(command),
],
on_mouse_down=rx.call_function(copied.set_value(False)).debounce(1500),
class_name="flex ite | from pcweb.components.icons.hugeicons import hi |
import reflex as rx
from reflex.experimental.client_state import ClientStateVar
from pcweb.components.icons.hugeicons import hi
|
@rx.memo
def install_command(
command: str,
show_dollar_sign: bool = True,
) -> rx.Component:
copied = ClientStateVar.create("is_copied", default=False, global_ref=False)
return rx.el.button(
rx.cond(
copied.value,
hi(
"tick-02",
size=14,
class_name="ml-[5px] shrink-0",
),
hi("copy-01", size=14, class_name="shrink-0 ml-[5px]"),
),
rx.text(
rx.cond(
show_dollar_sign,
f"${command}",
command,
),
as_="p",
class_name="font-small text-start truncate",
),
title=command,
on_click=[
rx.call_function(copied.set_value(True)),
rx.set_clipboard(command),
],
on_mouse_down=rx.call_function(copied.set_value(False)).debounce(1500),
class_name="flex items-center gap-1.5 border-slate-5 bg-slate-1 hover: | from pcweb.components.icons.icons import get_icon |
import reflex as rx
from reflex.experimental.client_state import ClientStateVar
from pcweb.components.icons.hugeicons import hi
from pcweb.components.icons.icons import get_icon
@rx.memo
def install_command(
command: str,
show_dollar_sign: bool = True,
) -> rx.Component:
|
return rx.el.button(
rx.cond(
copied.value,
hi(
"tick-02",
size=14,
class_name="ml-[5px] shrink-0",
),
hi("copy-01", size=14, class_name="shrink-0 ml-[5px]"),
),
rx.text(
rx.cond(
show_dollar_sign,
f"${command}",
command,
),
as_="p",
class_name="font-small text-start truncate",
),
title=command,
on_click=[
rx.call_function(copied.set_value(True)),
rx.set_clipboard(command),
],
on_mouse_down=rx.call_function(copied.set_value(False)).debounce(1500),
class_name="flex items-center gap-1.5 border-slate-5 bg-slate-1 hover:bg-slate-3 shadow-small pr-1.5 border rounded-md w-full text-slate-9 transition-bg cursor-pointer overflow-hidden min-w-0 flex-1 h-[24px]",
style={
"opacity": "1",
| copied = ClientStateVar.create("is_copied", default=False, global_ref=False) |
e=14, class_name="shrink-0 ml-[5px]"),
),
rx.text(
rx.cond(
show_dollar_sign,
f"${command}",
command,
),
as_="p",
class_name="font-small text-start truncate",
),
title=command,
on_click=[
rx.call_function(copied.set_value(True)),
rx.set_clipboard(command),
],
on_mouse_down=rx.call_function(copied.set_value(False)).debounce(1500),
class_name="flex items-center gap-1.5 border-slate-5 bg-slate-1 hover:bg-slate-3 shadow-small pr-1.5 border rounded-md w-full text-slate-9 transition-bg cursor-pointer overflow-hidden min-w-0 flex-1 h-[24px]",
style={
"opacity": "1",
"cursor": "pointer",
"transition": "background 0.250s ease-out",
"&>svg": {
"transition": "transform 0.250s ease-out, opacity 0.250s ease-out",
},
},
)
|
def code_card(app: dict) -> rx.Component:
return rx.flex(
rx.box(
rx.el.a(
rx.image(
src=app["image_url"],
loading="lazy",
alt="Image preview for app: " + app["name"],
class_name="size-full duration-150 object-top object-cover hover:scale-105 transition-transform ease-out",
),
href=app["demo_url"],
is_external=True,
),
class_name="relative border-slate-5 border-b border-solid w-full overflow-hidden h-[180px]",
),
rx.box(
rx.box(
rx.el.h4(
app["name"],
class_name="font-smbold text-slate-12 truncate",
),
class_name="flex flex-row justify-between items-center gap-3 p-[0.625rem_0.75rem_0rem_0.75rem] w-full",
),
rx.box(
install_command(
| def repo(repo_url: str) -> rx.Component:
return rx.link(
get_icon(icon="new_tab", class_name="p-[5px]"),
href=repo_url,
is_external=True,
class_name="border-slate-5 bg-slate-1 hover:bg-slate-3 shadow-small border border-solid rounded-md text-slate-9 hover:!text-slate-9 no-underline transition-bg cursor-pointer shrink-0",
) |
from reflex.event import EventHandler, passthrough_event_spec
from pcweb.components.utils.twmerge import cn
def dialog(
content: rx.Component,
trigger: rx.Component,
class_name: str = "",
trigger_class_name: str = "",
on_open_change: EventHandler[passthrough_event_spec(bool)] | None = None,
**props,
) -> rx.Component:
return rx.dialog.root(
rx.dialog.trigger(
trigger,
class_name=trigger_class_name,
),
rx.dialog.content(
content,
class_name=cn(
"!shadow-large !rounded-xl !bg-slate-1 !p-6 !font-sans",
class_name,
),
**props,
),
on_open_change=on_open_change,
)
| import reflex as rx | |
import reflex as rx
|
from pcweb.components.utils.twmerge import cn
def dialog(
content: rx.Component,
trigger: rx.Component,
class_name: str = "",
trigger_class_name: str = "",
on_open_change: EventHandler[passthrough_event_spec(bool)] | None = None,
**props,
) -> rx.Component:
return rx.dialog.root(
rx.dialog.trigger(
trigger,
class_name=trigger_class_name,
),
rx.dialog.content(
content,
class_name=cn(
"!shadow-large !rounded-xl !bg-slate-1 !p-6 !font-sans",
class_name,
),
**props,
),
on_open_change=on_open_change,
)
| from reflex.event import EventHandler, passthrough_event_spec |
import reflex as rx
from reflex.event import EventHandler, passthrough_event_spec
|
def dialog(
content: rx.Component,
trigger: rx.Component,
class_name: str = "",
trigger_class_name: str = "",
on_open_change: EventHandler[passthrough_event_spec(bool)] | None = None,
**props,
) -> rx.Component:
return rx.dialog.root(
rx.dialog.trigger(
trigger,
class_name=trigger_class_name,
),
rx.dialog.content(
content,
class_name=cn(
"!shadow-large !rounded-xl !bg-slate-1 !p-6 !font-sans",
class_name,
),
**props,
),
on_open_change=on_open_change,
)
| from pcweb.components.utils.twmerge import cn |
def hint(
text: str,
content: rx.Component,
side: str = "top",
align: str = "center",
active: bool = False,
class_name: str = "",
**props,
) -> rx.Component:
return rx.hover_card.root(
rx.hover_card.trigger(content, height="fit-content"),
rx.hover_card.content(
rx.text(text),
side=side,
align=align,
class_name="flex justify-center items-center bg-slate-11 px-1.5 py-0.5 rounded-lg font-small text-white-1",
),
class_name=class_name,
default_open=active,
open_delay=80,
close_delay=80,
**props,
)
| import reflex as rx | |
import reflex as rx
def glow() -> rx.Component:
return rx.box(
class_name="absolute w-[120rem] h-[23.75rem] flex-shrink-0 rounded-[120rem] left-1/2 -translate-x-1/2 z-[0] top-[-16rem] dark:[background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(58,45,118,1)_0%,_rgba(21,22,24,0.00)_100%)] [background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(235,228,255,0.95)_0%,_rgba(252,252,253,0.00)_100%)] saturate-200 dark:saturate-100 group-hover:saturate-300 transition-[saturate] dark:group-hover:saturate-100",
)
POST_LINK = "https://www.producthunt.com/products/reflex-5?launch=reflex-7"
# October 25, 2025 12:01 AM PDT (UTC-7) = October 25, 2025 07:01 AM UTC
DEADLINE = datetime.datetime(2025, 10, 25, 7, 1, tzinfo=datetime.UTC)
class HostingBannerState(rx.State):
show_banner: rx.Field[bool] = rx.field(False)
force_hide_banner: rx.Field[bool] = rx.field(False)
@rx.event
def hide_banner(self):
self.force_hide_banner = True
@rx.event
d | import datetime | |
import datetime
|
def glow() -> rx.Component:
return rx.box(
class_name="absolute w-[120rem] h-[23.75rem] flex-shrink-0 rounded-[120rem] left-1/2 -translate-x-1/2 z-[0] top-[-16rem] dark:[background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(58,45,118,1)_0%,_rgba(21,22,24,0.00)_100%)] [background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(235,228,255,0.95)_0%,_rgba(252,252,253,0.00)_100%)] saturate-200 dark:saturate-100 group-hover:saturate-300 transition-[saturate] dark:group-hover:saturate-100",
)
POST_LINK = "https://www.producthunt.com/products/reflex-5?launch=reflex-7"
# October 25, 2025 12:01 AM PDT (UTC-7) = October 25, 2025 07:01 AM UTC
DEADLINE = datetime.datetime(2025, 10, 25, 7, 1, tzinfo=datetime.UTC)
class HostingBannerState(rx.State):
show_banner: rx.Field[bool] = rx.field(False)
force_hide_banner: rx.Field[bool] = rx.field(False)
@rx.event
def hide_banner(self):
self.force_hide_banner = True
@rx.event
def check_deadline(sel | import reflex as rx |
import datetime
import reflex as rx
def glow() -> rx.Component:
return rx.box(
class_name="absolute w-[120rem] h-[23.75rem] flex-shrink-0 rounded-[120rem] left-1/2 -translate-x-1/2 z-[0] top-[-16rem] dark:[background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(58,45,118,1)_0%,_rgba(21,22,24,0.00)_100%)] [background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(235,228,255,0.95)_0%,_rgba(252,252,253,0.00)_100%)] saturate-200 dark:saturate-100 group-hover:saturate-300 transition-[saturate] dark:group-hover:saturate-100",
)
|
# October 25, 2025 12:01 AM PDT (UTC-7) = October 25, 2025 07:01 AM UTC
DEADLINE = datetime.datetime(2025, 10, 25, 7, 1, tzinfo=datetime.UTC)
class HostingBannerState(rx.State):
show_banner: rx.Field[bool] = rx.field(False)
force_hide_banner: rx.Field[bool] = rx.field(False)
@rx.event
def hide_banner(self):
self.force_hide_banner = True
@rx.event
def check_deadline(self):
if datetime.datetime.now(datetime.UTC) < DEADLINE:
self.show_banner = True
@rx.var
def is_banner_visible(self) -> bool:
return self.show_banner and not self.force_hide_banner
def timer():
remove_negative_sign = rx.vars.function.ArgsFunctionOperation.create(
args_names=("t",),
return_expr=rx.vars.sequence.string_replace_operation(
rx.Var("t").to(str), "-", ""
),
)
return rx.el.div(
rx.moment(
date=DEADLINE,
duration_from_now=True,
format="DD[d] HH[h] m | POST_LINK = "https://www.producthunt.com/products/reflex-5?launch=reflex-7" |
import datetime
import reflex as rx
def glow() -> rx.Component:
return rx.box(
class_name="absolute w-[120rem] h-[23.75rem] flex-shrink-0 rounded-[120rem] left-1/2 -translate-x-1/2 z-[0] top-[-16rem] dark:[background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(58,45,118,1)_0%,_rgba(21,22,24,0.00)_100%)] [background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(235,228,255,0.95)_0%,_rgba(252,252,253,0.00)_100%)] saturate-200 dark:saturate-100 group-hover:saturate-300 transition-[saturate] dark:group-hover:saturate-100",
)
POST_LINK = "https://www.producthunt.com/products/reflex-5?launch=reflex-7"
# October 25, 2025 12:01 AM PDT (UTC-7) = October 25, 2025 07:01 AM UTC
|
class HostingBannerState(rx.State):
show_banner: rx.Field[bool] = rx.field(False)
force_hide_banner: rx.Field[bool] = rx.field(False)
@rx.event
def hide_banner(self):
self.force_hide_banner = True
@rx.event
def check_deadline(self):
if datetime.datetime.now(datetime.UTC) < DEADLINE:
self.show_banner = True
@rx.var
def is_banner_visible(self) -> bool:
return self.show_banner and not self.force_hide_banner
def timer():
remove_negative_sign = rx.vars.function.ArgsFunctionOperation.create(
args_names=("t",),
return_expr=rx.vars.sequence.string_replace_operation(
rx.Var("t").to(str), "-", ""
),
)
return rx.el.div(
rx.moment(
date=DEADLINE,
duration_from_now=True,
format="DD[d] HH[h] mm[m] ss[s]",
custom_attrs={"filter": remove_negative_sign},
interval=1000,
class_name="font-medium text-sm" | DEADLINE = datetime.datetime(2025, 10, 25, 7, 1, tzinfo=datetime.UTC) |
import datetime
import reflex as rx
def glow() -> rx.Component:
return rx.box(
class_name="absolute w-[120rem] h-[23.75rem] flex-shrink-0 rounded-[120rem] left-1/2 -translate-x-1/2 z-[0] top-[-16rem] dark:[background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(58,45,118,1)_0%,_rgba(21,22,24,0.00)_100%)] [background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(235,228,255,0.95)_0%,_rgba(252,252,253,0.00)_100%)] saturate-200 dark:saturate-100 group-hover:saturate-300 transition-[saturate] dark:group-hover:saturate-100",
)
POST_LINK = "https://www.producthunt.com/products/reflex-5?launch=reflex-7"
# October 25, 2025 12:01 AM PDT (UTC-7) = October 25, 2025 07:01 AM UTC
DEADLINE = datetime.datetime(2025, 10, 25, 7, 1, tzinfo=datetime.UTC)
class HostingBannerState(rx.State):
show_banner: rx.Field[bool] = rx.field(False)
force_hide_banner: rx.Field[bool] = rx.field(False)
@rx.event
|
@rx.event
def check_deadline(self):
if datetime.datetime.now(datetime.UTC) < DEADLINE:
self.show_banner = True
@rx.var
def is_banner_visible(self) -> bool:
return self.show_banner and not self.force_hide_banner
def timer():
remove_negative_sign = rx.vars.function.ArgsFunctionOperation.create(
args_names=("t",),
return_expr=rx.vars.sequence.string_replace_operation(
rx.Var("t").to(str), "-", ""
),
)
return rx.el.div(
rx.moment(
date=DEADLINE,
duration_from_now=True,
format="DD[d] HH[h] mm[m] ss[s]",
custom_attrs={"filter": remove_negative_sign},
interval=1000,
class_name="font-medium text-sm",
),
class_name="items-center gap-1 z-[1] bg-orange-4 border border-orange-5 rounded-md px-1.5 py-0.5 text-orange-11 font-medium text-sm md:flex hidden",
)
def hosting_banner() -> rx.Component:
retu | def hide_banner(self):
self.force_hide_banner = True |
import datetime
import reflex as rx
def glow() -> rx.Component:
return rx.box(
class_name="absolute w-[120rem] h-[23.75rem] flex-shrink-0 rounded-[120rem] left-1/2 -translate-x-1/2 z-[0] top-[-16rem] dark:[background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(58,45,118,1)_0%,_rgba(21,22,24,0.00)_100%)] [background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(235,228,255,0.95)_0%,_rgba(252,252,253,0.00)_100%)] saturate-200 dark:saturate-100 group-hover:saturate-300 transition-[saturate] dark:group-hover:saturate-100",
)
POST_LINK = "https://www.producthunt.com/products/reflex-5?launch=reflex-7"
# October 25, 2025 12:01 AM PDT (UTC-7) = October 25, 2025 07:01 AM UTC
DEADLINE = datetime.datetime(2025, 10, 25, 7, 1, tzinfo=datetime.UTC)
class HostingBannerState(rx.State):
show_banner: rx.Field[bool] = rx.field(False)
force_hide_banner: rx.Field[bool] = rx.field(False)
@rx.event
def hide_banner(self):
|
@rx.event
def check_deadline(self):
if datetime.datetime.now(datetime.UTC) < DEADLINE:
self.show_banner = True
@rx.var
def is_banner_visible(self) -> bool:
return self.show_banner and not self.force_hide_banner
def timer():
remove_negative_sign = rx.vars.function.ArgsFunctionOperation.create(
args_names=("t",),
return_expr=rx.vars.sequence.string_replace_operation(
rx.Var("t").to(str), "-", ""
),
)
return rx.el.div(
rx.moment(
date=DEADLINE,
duration_from_now=True,
format="DD[d] HH[h] mm[m] ss[s]",
custom_attrs={"filter": remove_negative_sign},
interval=1000,
class_name="font-medium text-sm",
),
class_name="items-center gap-1 z-[1] bg-orange-4 border border-orange-5 rounded-md px-1.5 py-0.5 text-orange-11 font-medium text-sm md:flex hidden",
)
def hosting_banner() -> rx.Component:
retu | self.force_hide_banner = True |
e
import reflex as rx
def glow() -> rx.Component:
return rx.box(
class_name="absolute w-[120rem] h-[23.75rem] flex-shrink-0 rounded-[120rem] left-1/2 -translate-x-1/2 z-[0] top-[-16rem] dark:[background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(58,45,118,1)_0%,_rgba(21,22,24,0.00)_100%)] [background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(235,228,255,0.95)_0%,_rgba(252,252,253,0.00)_100%)] saturate-200 dark:saturate-100 group-hover:saturate-300 transition-[saturate] dark:group-hover:saturate-100",
)
POST_LINK = "https://www.producthunt.com/products/reflex-5?launch=reflex-7"
# October 25, 2025 12:01 AM PDT (UTC-7) = October 25, 2025 07:01 AM UTC
DEADLINE = datetime.datetime(2025, 10, 25, 7, 1, tzinfo=datetime.UTC)
class HostingBannerState(rx.State):
show_banner: rx.Field[bool] = rx.field(False)
force_hide_banner: rx.Field[bool] = rx.field(False)
@rx.event
def hide_banner(self):
self.force_hide_banner = True
@rx.event
|
@rx.var
def is_banner_visible(self) -> bool:
return self.show_banner and not self.force_hide_banner
def timer():
remove_negative_sign = rx.vars.function.ArgsFunctionOperation.create(
args_names=("t",),
return_expr=rx.vars.sequence.string_replace_operation(
rx.Var("t").to(str), "-", ""
),
)
return rx.el.div(
rx.moment(
date=DEADLINE,
duration_from_now=True,
format="DD[d] HH[h] mm[m] ss[s]",
custom_attrs={"filter": remove_negative_sign},
interval=1000,
class_name="font-medium text-sm",
),
class_name="items-center gap-1 z-[1] bg-orange-4 border border-orange-5 rounded-md px-1.5 py-0.5 text-orange-11 font-medium text-sm md:flex hidden",
)
def hosting_banner() -> rx.Component:
return rx.el.div(
rx.cond(
HostingBannerState.is_banner_visible,
rx.hstack(
rx.el.a(
| def check_deadline(self):
if datetime.datetime.now(datetime.UTC) < DEADLINE:
self.show_banner = True |
) -> rx.Component:
return rx.box(
class_name="absolute w-[120rem] h-[23.75rem] flex-shrink-0 rounded-[120rem] left-1/2 -translate-x-1/2 z-[0] top-[-16rem] dark:[background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(58,45,118,1)_0%,_rgba(21,22,24,0.00)_100%)] [background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(235,228,255,0.95)_0%,_rgba(252,252,253,0.00)_100%)] saturate-200 dark:saturate-100 group-hover:saturate-300 transition-[saturate] dark:group-hover:saturate-100",
)
POST_LINK = "https://www.producthunt.com/products/reflex-5?launch=reflex-7"
# October 25, 2025 12:01 AM PDT (UTC-7) = October 25, 2025 07:01 AM UTC
DEADLINE = datetime.datetime(2025, 10, 25, 7, 1, tzinfo=datetime.UTC)
class HostingBannerState(rx.State):
show_banner: rx.Field[bool] = rx.field(False)
force_hide_banner: rx.Field[bool] = rx.field(False)
@rx.event
def hide_banner(self):
self.force_hide_banner = True
@rx.event
def check_deadline(self):
|
@rx.var
def is_banner_visible(self) -> bool:
return self.show_banner and not self.force_hide_banner
def timer():
remove_negative_sign = rx.vars.function.ArgsFunctionOperation.create(
args_names=("t",),
return_expr=rx.vars.sequence.string_replace_operation(
rx.Var("t").to(str), "-", ""
),
)
return rx.el.div(
rx.moment(
date=DEADLINE,
duration_from_now=True,
format="DD[d] HH[h] mm[m] ss[s]",
custom_attrs={"filter": remove_negative_sign},
interval=1000,
class_name="font-medium text-sm",
),
class_name="items-center gap-1 z-[1] bg-orange-4 border border-orange-5 rounded-md px-1.5 py-0.5 text-orange-11 font-medium text-sm md:flex hidden",
)
def hosting_banner() -> rx.Component:
return rx.el.div(
rx.cond(
HostingBannerState.is_banner_visible,
rx.hstack(
rx.el.a(
| if datetime.datetime.now(datetime.UTC) < DEADLINE:
self.show_banner = True |
ute w-[120rem] h-[23.75rem] flex-shrink-0 rounded-[120rem] left-1/2 -translate-x-1/2 z-[0] top-[-16rem] dark:[background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(58,45,118,1)_0%,_rgba(21,22,24,0.00)_100%)] [background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(235,228,255,0.95)_0%,_rgba(252,252,253,0.00)_100%)] saturate-200 dark:saturate-100 group-hover:saturate-300 transition-[saturate] dark:group-hover:saturate-100",
)
POST_LINK = "https://www.producthunt.com/products/reflex-5?launch=reflex-7"
# October 25, 2025 12:01 AM PDT (UTC-7) = October 25, 2025 07:01 AM UTC
DEADLINE = datetime.datetime(2025, 10, 25, 7, 1, tzinfo=datetime.UTC)
class HostingBannerState(rx.State):
show_banner: rx.Field[bool] = rx.field(False)
force_hide_banner: rx.Field[bool] = rx.field(False)
@rx.event
def hide_banner(self):
self.force_hide_banner = True
@rx.event
def check_deadline(self):
if datetime.datetime.now(datetime.UTC) < DEADLINE:
|
@rx.var
def is_banner_visible(self) -> bool:
return self.show_banner and not self.force_hide_banner
def timer():
remove_negative_sign = rx.vars.function.ArgsFunctionOperation.create(
args_names=("t",),
return_expr=rx.vars.sequence.string_replace_operation(
rx.Var("t").to(str), "-", ""
),
)
return rx.el.div(
rx.moment(
date=DEADLINE,
duration_from_now=True,
format="DD[d] HH[h] mm[m] ss[s]",
custom_attrs={"filter": remove_negative_sign},
interval=1000,
class_name="font-medium text-sm",
),
class_name="items-center gap-1 z-[1] bg-orange-4 border border-orange-5 rounded-md px-1.5 py-0.5 text-orange-11 font-medium text-sm md:flex hidden",
)
def hosting_banner() -> rx.Component:
return rx.el.div(
rx.cond(
HostingBannerState.is_banner_visible,
rx.hstack(
rx.el.a(
| self.show_banner = True |
rounded-[120rem] left-1/2 -translate-x-1/2 z-[0] top-[-16rem] dark:[background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(58,45,118,1)_0%,_rgba(21,22,24,0.00)_100%)] [background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(235,228,255,0.95)_0%,_rgba(252,252,253,0.00)_100%)] saturate-200 dark:saturate-100 group-hover:saturate-300 transition-[saturate] dark:group-hover:saturate-100",
)
POST_LINK = "https://www.producthunt.com/products/reflex-5?launch=reflex-7"
# October 25, 2025 12:01 AM PDT (UTC-7) = October 25, 2025 07:01 AM UTC
DEADLINE = datetime.datetime(2025, 10, 25, 7, 1, tzinfo=datetime.UTC)
class HostingBannerState(rx.State):
show_banner: rx.Field[bool] = rx.field(False)
force_hide_banner: rx.Field[bool] = rx.field(False)
@rx.event
def hide_banner(self):
self.force_hide_banner = True
@rx.event
def check_deadline(self):
if datetime.datetime.now(datetime.UTC) < DEADLINE:
self.show_banner = True
@rx.var
|
def timer():
remove_negative_sign = rx.vars.function.ArgsFunctionOperation.create(
args_names=("t",),
return_expr=rx.vars.sequence.string_replace_operation(
rx.Var("t").to(str), "-", ""
),
)
return rx.el.div(
rx.moment(
date=DEADLINE,
duration_from_now=True,
format="DD[d] HH[h] mm[m] ss[s]",
custom_attrs={"filter": remove_negative_sign},
interval=1000,
class_name="font-medium text-sm",
),
class_name="items-center gap-1 z-[1] bg-orange-4 border border-orange-5 rounded-md px-1.5 py-0.5 text-orange-11 font-medium text-sm md:flex hidden",
)
def hosting_banner() -> rx.Component:
return rx.el.div(
rx.cond(
HostingBannerState.is_banner_visible,
rx.hstack(
rx.el.a(
rx.box(
rx.box(
# Header text with responsive spans
| def is_banner_visible(self) -> bool:
return self.show_banner and not self.force_hide_banner |
%,_rgba(58,45,118,1)_0%,_rgba(21,22,24,0.00)_100%)] [background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(235,228,255,0.95)_0%,_rgba(252,252,253,0.00)_100%)] saturate-200 dark:saturate-100 group-hover:saturate-300 transition-[saturate] dark:group-hover:saturate-100",
)
POST_LINK = "https://www.producthunt.com/products/reflex-5?launch=reflex-7"
# October 25, 2025 12:01 AM PDT (UTC-7) = October 25, 2025 07:01 AM UTC
DEADLINE = datetime.datetime(2025, 10, 25, 7, 1, tzinfo=datetime.UTC)
class HostingBannerState(rx.State):
show_banner: rx.Field[bool] = rx.field(False)
force_hide_banner: rx.Field[bool] = rx.field(False)
@rx.event
def hide_banner(self):
self.force_hide_banner = True
@rx.event
def check_deadline(self):
if datetime.datetime.now(datetime.UTC) < DEADLINE:
self.show_banner = True
@rx.var
def is_banner_visible(self) -> bool:
return self.show_banner and not self.force_hide_banner
def timer():
|
return rx.el.div(
rx.moment(
date=DEADLINE,
duration_from_now=True,
format="DD[d] HH[h] mm[m] ss[s]",
custom_attrs={"filter": remove_negative_sign},
interval=1000,
class_name="font-medium text-sm",
),
class_name="items-center gap-1 z-[1] bg-orange-4 border border-orange-5 rounded-md px-1.5 py-0.5 text-orange-11 font-medium text-sm md:flex hidden",
)
def hosting_banner() -> rx.Component:
return rx.el.div(
rx.cond(
HostingBannerState.is_banner_visible,
rx.hstack(
rx.el.a(
rx.box(
rx.box(
# Header text with responsive spans
rx.el.span(
"Launch",
class_name="items-center font-medium px-1.5 h-5 rounded-md text-xs bg-violet-9 text-slate-1 z-[1] inline-flex",
| remove_negative_sign = rx.vars.function.ArgsFunctionOperation.create(
args_names=("t",),
return_expr=rx.vars.sequence.string_replace_operation(
rx.Var("t").to(str), "-", ""
),
) |
import reflex as rx
LiteralButtonVariant = Literal[
"primary", "success", "destructive", "secondary", "muted"
]
default_class_name = "rounded-full w-8 h-8 inline-flex items-center justify-center cursor-pointer relative border-t border-[rgba(255,255,255,0.21)] shrink-0"
after_class_name = "after:absolute after:inset-[1px] after:border-t after:rounded-[11px] after:border-white after:opacity-[0.22]"
def get_variant_class(variant: str) -> str:
return (
f"bg-gradient-to-b from-[--{variant}-9] to-[--{variant}-9] hover:to-[--{variant}-10] text-white"
+ " "
)
variant_styles = {
"primary": {
"class_name": get_variant_class("violet"),
},
"success": {
"class_name": get_variant_class("green"),
},
"destructive": {
"class_name": get_variant_class("red"),
},
"muted": {
"class_name": "bg-slate-3 hover:bg-slate-6 text-slate-9 border-t !border-slate-5",
},
"secondary": {
"class_name": "bg-slat | from typing import Callable, Literal | |
from typing import Callable, Literal
|
LiteralButtonVariant = Literal[
"primary", "success", "destructive", "secondary", "muted"
]
default_class_name = "rounded-full w-8 h-8 inline-flex items-center justify-center cursor-pointer relative border-t border-[rgba(255,255,255,0.21)] shrink-0"
after_class_name = "after:absolute after:inset-[1px] after:border-t after:rounded-[11px] after:border-white after:opacity-[0.22]"
def get_variant_class(variant: str) -> str:
return (
f"bg-gradient-to-b from-[--{variant}-9] to-[--{variant}-9] hover:to-[--{variant}-10] text-white"
+ " "
)
variant_styles = {
"primary": {
"class_name": get_variant_class("violet"),
},
"success": {
"class_name": get_variant_class("green"),
},
"destructive": {
"class_name": get_variant_class("red"),
},
"muted": {
"class_name": "bg-slate-3 hover:bg-slate-6 text-slate-9 border-t !border-slate-5",
},
"secondary": {
"class_name": "bg-slate-4 hover:bg-slate-6 | import reflex as rx |
from typing import Callable, Literal
import reflex as rx
|
default_class_name = "rounded-full w-8 h-8 inline-flex items-center justify-center cursor-pointer relative border-t border-[rgba(255,255,255,0.21)] shrink-0"
after_class_name = "after:absolute after:inset-[1px] after:border-t after:rounded-[11px] after:border-white after:opacity-[0.22]"
def get_variant_class(variant: str) -> str:
return (
f"bg-gradient-to-b from-[--{variant}-9] to-[--{variant}-9] hover:to-[--{variant}-10] text-white"
+ " "
)
variant_styles = {
"primary": {
"class_name": get_variant_class("violet"),
},
"success": {
"class_name": get_variant_class("green"),
},
"destructive": {
"class_name": get_variant_class("red"),
},
"muted": {
"class_name": "bg-slate-3 hover:bg-slate-6 text-slate-9 border-t !border-slate-5",
},
"secondary": {
"class_name": "bg-slate-4 hover:bg-slate-6 text-slate-10 !border-none",
},
}
def icon_button(
icon: str,
variant: LiteralButto | LiteralButtonVariant = Literal[
"primary", "success", "destructive", "secondary", "muted"
] |
from typing import Callable, Literal
import reflex as rx
LiteralButtonVariant = Literal[
"primary", "success", "destructive", "secondary", "muted"
]
|
after_class_name = "after:absolute after:inset-[1px] after:border-t after:rounded-[11px] after:border-white after:opacity-[0.22]"
def get_variant_class(variant: str) -> str:
return (
f"bg-gradient-to-b from-[--{variant}-9] to-[--{variant}-9] hover:to-[--{variant}-10] text-white"
+ " "
)
variant_styles = {
"primary": {
"class_name": get_variant_class("violet"),
},
"success": {
"class_name": get_variant_class("green"),
},
"destructive": {
"class_name": get_variant_class("red"),
},
"muted": {
"class_name": "bg-slate-3 hover:bg-slate-6 text-slate-9 border-t !border-slate-5",
},
"secondary": {
"class_name": "bg-slate-4 hover:bg-slate-6 text-slate-10 !border-none",
},
}
def icon_button(
icon: str,
variant: LiteralButtonVariant = "primary",
onclick: Callable | None = None,
style: dict | None = None,
class_name: str = "",
*children,
**props,
) -> rx.Compone | default_class_name = "rounded-full w-8 h-8 inline-flex items-center justify-center cursor-pointer relative border-t border-[rgba(255,255,255,0.21)] shrink-0" |
from typing import Callable, Literal
import reflex as rx
LiteralButtonVariant = Literal[
"primary", "success", "destructive", "secondary", "muted"
]
default_class_name = "rounded-full w-8 h-8 inline-flex items-center justify-center cursor-pointer relative border-t border-[rgba(255,255,255,0.21)] shrink-0"
|
def get_variant_class(variant: str) -> str:
return (
f"bg-gradient-to-b from-[--{variant}-9] to-[--{variant}-9] hover:to-[--{variant}-10] text-white"
+ " "
)
variant_styles = {
"primary": {
"class_name": get_variant_class("violet"),
},
"success": {
"class_name": get_variant_class("green"),
},
"destructive": {
"class_name": get_variant_class("red"),
},
"muted": {
"class_name": "bg-slate-3 hover:bg-slate-6 text-slate-9 border-t !border-slate-5",
},
"secondary": {
"class_name": "bg-slate-4 hover:bg-slate-6 text-slate-10 !border-none",
},
}
def icon_button(
icon: str,
variant: LiteralButtonVariant = "primary",
onclick: Callable | None = None,
style: dict | None = None,
class_name: str = "",
*children,
**props,
) -> rx.Component:
return rx.el.button(
rx.icon(icon, size=16, class_name="shrink-0"),
*children,
onclick=onclick,
| after_class_name = "after:absolute after:inset-[1px] after:border-t after:rounded-[11px] after:border-white after:opacity-[0.22]" |
import reflex as rx
from pcweb.components.utils.twmerge import cn
LiteralButtonVariant = Literal[
"primary", "secondary", "transparent", "destructive", "outline"
]
LiteralButtonSize = Literal[
"xs", "sm", "md", "lg", "icon-xs", "icon-sm", "icon-md", "icon-lg"
]
DEFAULT_CLASS_NAME = "text-sm cursor-pointer inline-flex items-center justify-center relative transition-bg shrink-0 font-sans disabled:cursor-not-allowed disabled:border disabled:border-slate-5 disabled:!bg-slate-3 disabled:!text-slate-8 transition-bg outline-none peer-placeholder-shown:!bg-slate-3 peer-placeholder-shown:!bg-none peer-placeholder-shown:cursor-not-allowed peer-placeholder-shown:border peer-placeholder-shown:border-slate-5 peer-placeholder-shown:!text-slate-8 text-nowrap"
def get_variant_bg_cn(variant: str) -> str:
"""Get the background color class name for a button variant.
Args:
variant (str): The variant of the button.
Returns:
str: The background color class name.
| from typing import Dict, Literal | |
from typing import Dict, Literal
|
from pcweb.components.utils.twmerge import cn
LiteralButtonVariant = Literal[
"primary", "secondary", "transparent", "destructive", "outline"
]
LiteralButtonSize = Literal[
"xs", "sm", "md", "lg", "icon-xs", "icon-sm", "icon-md", "icon-lg"
]
DEFAULT_CLASS_NAME = "text-sm cursor-pointer inline-flex items-center justify-center relative transition-bg shrink-0 font-sans disabled:cursor-not-allowed disabled:border disabled:border-slate-5 disabled:!bg-slate-3 disabled:!text-slate-8 transition-bg outline-none peer-placeholder-shown:!bg-slate-3 peer-placeholder-shown:!bg-none peer-placeholder-shown:cursor-not-allowed peer-placeholder-shown:border peer-placeholder-shown:border-slate-5 peer-placeholder-shown:!text-slate-8 text-nowrap"
def get_variant_bg_cn(variant: str) -> str:
"""Get the background color class name for a button variant.
Args:
variant (str): The variant of the button.
Returns:
str: The background color class name.
"""
return f | import reflex as rx |
from typing import Dict, Literal
import reflex as rx
|
LiteralButtonVariant = Literal[
"primary", "secondary", "transparent", "destructive", "outline"
]
LiteralButtonSize = Literal[
"xs", "sm", "md", "lg", "icon-xs", "icon-sm", "icon-md", "icon-lg"
]
DEFAULT_CLASS_NAME = "text-sm cursor-pointer inline-flex items-center justify-center relative transition-bg shrink-0 font-sans disabled:cursor-not-allowed disabled:border disabled:border-slate-5 disabled:!bg-slate-3 disabled:!text-slate-8 transition-bg outline-none peer-placeholder-shown:!bg-slate-3 peer-placeholder-shown:!bg-none peer-placeholder-shown:cursor-not-allowed peer-placeholder-shown:border peer-placeholder-shown:border-slate-5 peer-placeholder-shown:!text-slate-8 text-nowrap"
def get_variant_bg_cn(variant: str) -> str:
"""Get the background color class name for a button variant.
Args:
variant (str): The variant of the button.
Returns:
str: The background color class name.
"""
return f"enabled:bg-gradient-to-b from-[--{variant}-9] | from pcweb.components.utils.twmerge import cn |
from typing import Dict, Literal
import reflex as rx
from pcweb.components.utils.twmerge import cn
|
LiteralButtonSize = Literal[
"xs", "sm", "md", "lg", "icon-xs", "icon-sm", "icon-md", "icon-lg"
]
DEFAULT_CLASS_NAME = "text-sm cursor-pointer inline-flex items-center justify-center relative transition-bg shrink-0 font-sans disabled:cursor-not-allowed disabled:border disabled:border-slate-5 disabled:!bg-slate-3 disabled:!text-slate-8 transition-bg outline-none peer-placeholder-shown:!bg-slate-3 peer-placeholder-shown:!bg-none peer-placeholder-shown:cursor-not-allowed peer-placeholder-shown:border peer-placeholder-shown:border-slate-5 peer-placeholder-shown:!text-slate-8 text-nowrap"
def get_variant_bg_cn(variant: str) -> str:
"""Get the background color class name for a button variant.
Args:
variant (str): The variant of the button.
Returns:
str: The background color class name.
"""
return f"enabled:bg-gradient-to-b from-[--{variant}-9] to-[--{variant}-10] dark:to-[--{variant}-9] hover:to-[--{variant}-9] dark:hover:to-[--{variant}-10] dis | LiteralButtonVariant = Literal[
"primary", "secondary", "transparent", "destructive", "outline"
] |
from typing import Dict, Literal
import reflex as rx
from pcweb.components.utils.twmerge import cn
LiteralButtonVariant = Literal[
"primary", "secondary", "transparent", "destructive", "outline"
]
|
DEFAULT_CLASS_NAME = "text-sm cursor-pointer inline-flex items-center justify-center relative transition-bg shrink-0 font-sans disabled:cursor-not-allowed disabled:border disabled:border-slate-5 disabled:!bg-slate-3 disabled:!text-slate-8 transition-bg outline-none peer-placeholder-shown:!bg-slate-3 peer-placeholder-shown:!bg-none peer-placeholder-shown:cursor-not-allowed peer-placeholder-shown:border peer-placeholder-shown:border-slate-5 peer-placeholder-shown:!text-slate-8 text-nowrap"
def get_variant_bg_cn(variant: str) -> str:
"""Get the background color class name for a button variant.
Args:
variant (str): The variant of the button.
Returns:
str: The background color class name.
"""
return f"enabled:bg-gradient-to-b from-[--{variant}-9] to-[--{variant}-10] dark:to-[--{variant}-9] hover:to-[--{variant}-9] dark:hover:to-[--{variant}-10] disabled:hover:bg-[--{variant}-9]"
BUTTON_STYLES: Dict[str, Dict[str, str]] = {
"size": {
" | LiteralButtonSize = Literal[
"xs", "sm", "md", "lg", "icon-xs", "icon-sm", "icon-md", "icon-lg"
] |
xt-slate-9 font-medium",
"destructive": f"{get_variant_bg_cn('red')} text-[#FCFCFD] font-semibold",
"outline": "bg-slate-1 hover:bg-slate-3 text-secondary-11 font-medium border border-slate-5",
},
}
def resources_button(
*children: rx.Component | str | rx.Var,
variant: LiteralButtonVariant = "primary",
size: LiteralButtonSize = "sm",
class_name: str | rx.Var[str] = "",
**props,
) -> rx.Component:
"""Create a button component.
Args:
*children: The content of the button.
variant (LiteralButtonVariant, optional): The button variant. Defaults to "primary".
size (LiteralButtonSize, optional): The button size. Defaults to "sm".
class_name (str, optional): Additional CSS classes to apply to the button. Defaults to "".
**props: Additional props to pass to the button element.
Returns:
rx.Component: A button component with the specified properties.
"""
# Validate size and variant
|
if variant not in BUTTON_STYLES["variant"]:
raise ValueError(
f"Invalid variant: {variant}. Must be one of {list(BUTTON_STYLES['variant'].keys())}"
)
variant_class = BUTTON_STYLES["variant"][variant]
# variant_class = variant_class() if callable(variant_class) else variant_class
internal_classes = [
DEFAULT_CLASS_NAME,
BUTTON_STYLES["size"][size],
variant_class,
]
return rx.el.button(
*children,
class_name=cn(internal_classes, class_name),
**props,
)
| if size not in BUTTON_STYLES["size"]:
raise ValueError(
f"Invalid size: {size}. Must be one of {list(BUTTON_STYLES['size'].keys())}"
) |
ary-11 font-medium border border-slate-5",
},
}
def resources_button(
*children: rx.Component | str | rx.Var,
variant: LiteralButtonVariant = "primary",
size: LiteralButtonSize = "sm",
class_name: str | rx.Var[str] = "",
**props,
) -> rx.Component:
"""Create a button component.
Args:
*children: The content of the button.
variant (LiteralButtonVariant, optional): The button variant. Defaults to "primary".
size (LiteralButtonSize, optional): The button size. Defaults to "sm".
class_name (str, optional): Additional CSS classes to apply to the button. Defaults to "".
**props: Additional props to pass to the button element.
Returns:
rx.Component: A button component with the specified properties.
"""
# Validate size and variant
if size not in BUTTON_STYLES["size"]:
raise ValueError(
f"Invalid size: {size}. Must be one of {list(BUTTON_STYLES['size'].keys())}"
)
|
variant_class = BUTTON_STYLES["variant"][variant]
# variant_class = variant_class() if callable(variant_class) else variant_class
internal_classes = [
DEFAULT_CLASS_NAME,
BUTTON_STYLES["size"][size],
variant_class,
]
return rx.el.button(
*children,
class_name=cn(internal_classes, class_name),
**props,
)
| if variant not in BUTTON_STYLES["variant"]:
raise ValueError(
f"Invalid variant: {variant}. Must be one of {list(BUTTON_STYLES['variant'].keys())}"
) |
alButtonSize = "sm",
class_name: str | rx.Var[str] = "",
**props,
) -> rx.Component:
"""Create a button component.
Args:
*children: The content of the button.
variant (LiteralButtonVariant, optional): The button variant. Defaults to "primary".
size (LiteralButtonSize, optional): The button size. Defaults to "sm".
class_name (str, optional): Additional CSS classes to apply to the button. Defaults to "".
**props: Additional props to pass to the button element.
Returns:
rx.Component: A button component with the specified properties.
"""
# Validate size and variant
if size not in BUTTON_STYLES["size"]:
raise ValueError(
f"Invalid size: {size}. Must be one of {list(BUTTON_STYLES['size'].keys())}"
)
if variant not in BUTTON_STYLES["variant"]:
raise ValueError(
f"Invalid variant: {variant}. Must be one of {list(BUTTON_STYLES['variant'].keys())}"
)
|
# variant_class = variant_class() if callable(variant_class) else variant_class
internal_classes = [
DEFAULT_CLASS_NAME,
BUTTON_STYLES["size"][size],
variant_class,
]
return rx.el.button(
*children,
class_name=cn(internal_classes, class_name),
**props,
)
| variant_class = BUTTON_STYLES["variant"][variant] |
*children: The content of the button.
variant (LiteralButtonVariant, optional): The button variant. Defaults to "primary".
size (LiteralButtonSize, optional): The button size. Defaults to "sm".
class_name (str, optional): Additional CSS classes to apply to the button. Defaults to "".
**props: Additional props to pass to the button element.
Returns:
rx.Component: A button component with the specified properties.
"""
# Validate size and variant
if size not in BUTTON_STYLES["size"]:
raise ValueError(
f"Invalid size: {size}. Must be one of {list(BUTTON_STYLES['size'].keys())}"
)
if variant not in BUTTON_STYLES["variant"]:
raise ValueError(
f"Invalid variant: {variant}. Must be one of {list(BUTTON_STYLES['variant'].keys())}"
)
variant_class = BUTTON_STYLES["variant"][variant]
# variant_class = variant_class() if callable(variant_class) else variant_class
|
return rx.el.button(
*children,
class_name=cn(internal_classes, class_name),
**props,
)
| internal_classes = [
DEFAULT_CLASS_NAME,
BUTTON_STYLES["size"][size],
variant_class,
] |
def logo(class_name: str = "") -> rx.Component:
return rx.link(
rx.fragment(
rx.image(
src="/logos/light/reflex.svg",
alt="Reflex Logo",
class_name="shrink-0 block dark:hidden" + class_name,
),
rx.image(
src="/logos/dark/reflex.svg",
alt="Reflex Logo",
class_name="shrink-0 hidden dark:block" + class_name,
),
),
class_name="flex items-start shrink-0",
href="/",
)
| import reflex as rx | |
import reflex as rx
class Marquee(rx.NoSSRComponent):
"""Marquee component."""
library = "react-fast-marquee@1.6.5"
tag = "Marquee"
is_default = True
# Behavior props
auto_fill: rx.Var[bool] = rx.Var.create(True)
play: rx.Var[bool] = rx.Var.create(True)
pause_on_hover: rx.Var[bool] = rx.Var.create(True)
pause_on_click: rx.Var[bool] = rx.Var.create(False)
direction: rx.Var[Literal["left", "right", "up", "down"]] = rx.Var.create("left")
# Animation props
speed: rx.Var[int] = rx.Var.create(35)
delay: rx.Var[int] = rx.Var.create(0)
loop: rx.Var[int] = rx.Var.create(0)
# Gradient props
gradient: rx.Var[bool] = rx.Var.create(True)
gradient_color: rx.Var[str] = rx.Var.create("var(--c-slate-1)")
gradient_width: rx.Var[Union[int, str]] = rx.Var.create(250)
marquee = Marquee.create
| from typing import Literal, Union | |
from typing import Literal, Union
|
class Marquee(rx.NoSSRComponent):
"""Marquee component."""
library = "react-fast-marquee@1.6.5"
tag = "Marquee"
is_default = True
# Behavior props
auto_fill: rx.Var[bool] = rx.Var.create(True)
play: rx.Var[bool] = rx.Var.create(True)
pause_on_hover: rx.Var[bool] = rx.Var.create(True)
pause_on_click: rx.Var[bool] = rx.Var.create(False)
direction: rx.Var[Literal["left", "right", "up", "down"]] = rx.Var.create("left")
# Animation props
speed: rx.Var[int] = rx.Var.create(35)
delay: rx.Var[int] = rx.Var.create(0)
loop: rx.Var[int] = rx.Var.create(0)
# Gradient props
gradient: rx.Var[bool] = rx.Var.create(True)
gradient_color: rx.Var[str] = rx.Var.create("var(--c-slate-1)")
gradient_width: rx.Var[Union[int, str]] = rx.Var.create(250)
marquee = Marquee.create
| import reflex as rx |
from typing import Literal, Union
import reflex as rx
class Marquee(rx.NoSSRComponent):
"""Marquee component."""
|
tag = "Marquee"
is_default = True
# Behavior props
auto_fill: rx.Var[bool] = rx.Var.create(True)
play: rx.Var[bool] = rx.Var.create(True)
pause_on_hover: rx.Var[bool] = rx.Var.create(True)
pause_on_click: rx.Var[bool] = rx.Var.create(False)
direction: rx.Var[Literal["left", "right", "up", "down"]] = rx.Var.create("left")
# Animation props
speed: rx.Var[int] = rx.Var.create(35)
delay: rx.Var[int] = rx.Var.create(0)
loop: rx.Var[int] = rx.Var.create(0)
# Gradient props
gradient: rx.Var[bool] = rx.Var.create(True)
gradient_color: rx.Var[str] = rx.Var.create("var(--c-slate-1)")
gradient_width: rx.Var[Union[int, str]] = rx.Var.create(250)
marquee = Marquee.create
| library = "react-fast-marquee@1.6.5" |
from typing import Literal, Union
import reflex as rx
class Marquee(rx.NoSSRComponent):
"""Marquee component."""
library = "react-fast-marquee@1.6.5"
|
is_default = True
# Behavior props
auto_fill: rx.Var[bool] = rx.Var.create(True)
play: rx.Var[bool] = rx.Var.create(True)
pause_on_hover: rx.Var[bool] = rx.Var.create(True)
pause_on_click: rx.Var[bool] = rx.Var.create(False)
direction: rx.Var[Literal["left", "right", "up", "down"]] = rx.Var.create("left")
# Animation props
speed: rx.Var[int] = rx.Var.create(35)
delay: rx.Var[int] = rx.Var.create(0)
loop: rx.Var[int] = rx.Var.create(0)
# Gradient props
gradient: rx.Var[bool] = rx.Var.create(True)
gradient_color: rx.Var[str] = rx.Var.create("var(--c-slate-1)")
gradient_width: rx.Var[Union[int, str]] = rx.Var.create(250)
marquee = Marquee.create
| tag = "Marquee" |
from typing import Literal, Union
import reflex as rx
class Marquee(rx.NoSSRComponent):
"""Marquee component."""
library = "react-fast-marquee@1.6.5"
tag = "Marquee"
|
# Behavior props
auto_fill: rx.Var[bool] = rx.Var.create(True)
play: rx.Var[bool] = rx.Var.create(True)
pause_on_hover: rx.Var[bool] = rx.Var.create(True)
pause_on_click: rx.Var[bool] = rx.Var.create(False)
direction: rx.Var[Literal["left", "right", "up", "down"]] = rx.Var.create("left")
# Animation props
speed: rx.Var[int] = rx.Var.create(35)
delay: rx.Var[int] = rx.Var.create(0)
loop: rx.Var[int] = rx.Var.create(0)
# Gradient props
gradient: rx.Var[bool] = rx.Var.create(True)
gradient_color: rx.Var[str] = rx.Var.create("var(--c-slate-1)")
gradient_width: rx.Var[Union[int, str]] = rx.Var.create(250)
marquee = Marquee.create
| is_default = True |
from typing import Literal, Union
import reflex as rx
class Marquee(rx.NoSSRComponent):
"""Marquee component."""
library = "react-fast-marquee@1.6.5"
tag = "Marquee"
is_default = True
# Behavior props
auto_fill: rx.Var[bool] = rx.Var.create(True)
play: rx.Var[bool] = rx.Var.create(True)
pause_on_hover: rx.Var[bool] = rx.Var.create(True)
pause_on_click: rx.Var[bool] = rx.Var.create(False)
direction: rx.Var[Literal["left", "right", "up", "down"]] = rx.Var.create("left")
# Animation props
speed: rx.Var[int] = rx.Var.create(35)
delay: rx.Var[int] = rx.Var.create(0)
loop: rx.Var[int] = rx.Var.create(0)
# Gradient props
gradient: rx.Var[bool] = rx.Var.create(True)
gradient_color: rx.Var[str] = rx.Var.create("var(--c-slate-1)")
gradient_width: rx.Var[Union[int, str]] = rx.Var.create(250)
| marquee = Marquee.create | |
import reflex as rx
from pcweb.components.utils.twmerge import cn
LiteralButtonVariant = Literal[
"primary", "secondary", "transparent", "destructive", "outline"
]
LiteralButtonSize = Literal[
"sm", "md", "lg", "xl", "icon-sm", "icon-md", "icon-lg", "icon-xl"
]
DEFAULT_CLASS_NAME = "text-sm cursor-pointer inline-flex items-center justify-center relative transition-bg shrink-0 font-sans disabled:cursor-not-allowed disabled:border disabled:border-slate-5 disabled:!bg-slate-3 disabled:!text-slate-8 transition-bg"
def get_variant_bg_cn(variant: str) -> str:
"""Get the background color class name for a button variant.
Args:
variant (str): The variant of the button.
Returns:
str: The background color class name.
"""
return f"enabled:bg-gradient-to-b from-(--{variant}-9) to-(--{variant}-10) dark:to-(--{variant}-9) hover:to-(--{variant}-9) dark:hover:to-(--{variant}-10) disabled:hover:bg-(--{variant}-9)"
BUTTON_STYLES: Dict[str, Dict[str, | from typing import Any, Dict, Literal, Optional | |
from typing import Any, Dict, Literal, Optional
|
from pcweb.components.utils.twmerge import cn
LiteralButtonVariant = Literal[
"primary", "secondary", "transparent", "destructive", "outline"
]
LiteralButtonSize = Literal[
"sm", "md", "lg", "xl", "icon-sm", "icon-md", "icon-lg", "icon-xl"
]
DEFAULT_CLASS_NAME = "text-sm cursor-pointer inline-flex items-center justify-center relative transition-bg shrink-0 font-sans disabled:cursor-not-allowed disabled:border disabled:border-slate-5 disabled:!bg-slate-3 disabled:!text-slate-8 transition-bg"
def get_variant_bg_cn(variant: str) -> str:
"""Get the background color class name for a button variant.
Args:
variant (str): The variant of the button.
Returns:
str: The background color class name.
"""
return f"enabled:bg-gradient-to-b from-(--{variant}-9) to-(--{variant}-10) dark:to-(--{variant}-9) hover:to-(--{variant}-9) dark:hover:to-(--{variant}-10) disabled:hover:bg-(--{variant}-9)"
BUTTON_STYLES: Dict[str, Dict[str, Dict[str, str]]] = { | import reflex as rx |
from typing import Any, Dict, Literal, Optional
import reflex as rx
|
LiteralButtonVariant = Literal[
"primary", "secondary", "transparent", "destructive", "outline"
]
LiteralButtonSize = Literal[
"sm", "md", "lg", "xl", "icon-sm", "icon-md", "icon-lg", "icon-xl"
]
DEFAULT_CLASS_NAME = "text-sm cursor-pointer inline-flex items-center justify-center relative transition-bg shrink-0 font-sans disabled:cursor-not-allowed disabled:border disabled:border-slate-5 disabled:!bg-slate-3 disabled:!text-slate-8 transition-bg"
def get_variant_bg_cn(variant: str) -> str:
"""Get the background color class name for a button variant.
Args:
variant (str): The variant of the button.
Returns:
str: The background color class name.
"""
return f"enabled:bg-gradient-to-b from-(--{variant}-9) to-(--{variant}-10) dark:to-(--{variant}-9) hover:to-(--{variant}-9) dark:hover:to-(--{variant}-10) disabled:hover:bg-(--{variant}-9)"
BUTTON_STYLES: Dict[str, Dict[str, Dict[str, str]]] = {
"size": {
"xs": "px-1.5 h-7 rounde | from pcweb.components.utils.twmerge import cn |
from typing import Any, Dict, Literal, Optional
import reflex as rx
from pcweb.components.utils.twmerge import cn
|
LiteralButtonSize = Literal[
"sm", "md", "lg", "xl", "icon-sm", "icon-md", "icon-lg", "icon-xl"
]
DEFAULT_CLASS_NAME = "text-sm cursor-pointer inline-flex items-center justify-center relative transition-bg shrink-0 font-sans disabled:cursor-not-allowed disabled:border disabled:border-slate-5 disabled:!bg-slate-3 disabled:!text-slate-8 transition-bg"
def get_variant_bg_cn(variant: str) -> str:
"""Get the background color class name for a button variant.
Args:
variant (str): The variant of the button.
Returns:
str: The background color class name.
"""
return f"enabled:bg-gradient-to-b from-(--{variant}-9) to-(--{variant}-10) dark:to-(--{variant}-9) hover:to-(--{variant}-9) dark:hover:to-(--{variant}-10) disabled:hover:bg-(--{variant}-9)"
BUTTON_STYLES: Dict[str, Dict[str, Dict[str, str]]] = {
"size": {
"xs": "px-1.5 h-7 rounded-md gap-1.5",
"sm": "px-2 h-8 rounded-lg gap-2",
"md": "px-2.5 h-9 rounded-[10px] gap- | LiteralButtonVariant = Literal[
"primary", "secondary", "transparent", "destructive", "outline"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.