Skip to content

Commit

Permalink
Get reflex tests to pass
Browse files Browse the repository at this point in the history
  • Loading branch information
ElijahAhianyo committed Sep 6, 2024
1 parent f2f5e82 commit 6fb904f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "reflex-chakra"
version = "0.6.0a2"
version = "0.6.0a4"
description = "reflex using chakra components"
authors = [
"Elijah Ahianyo <elijah@reflex.dev>"
Expand Down
16 changes: 11 additions & 5 deletions reflex_chakra/components/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,21 @@ def _get_dependencies_imports(cls) -> ImportDict:
}

@classmethod
def create(cls, *children, **props) -> rx.Component:
def create(cls, *children, **props) -> Component:
# copy color mode provider file to client's asset dir if it doesnt exist.
client_asset_dir = Path.cwd() / constants.ASSETS_DIR_NAME
if not (
color_mode_provider := (
constants.ASSETS_DIR / constants.COLOR_MODE_PROVIDER_FILENAME
client_color_mode_provider := (
Path.cwd()
/ constants.ASSETS_DIR_NAME
/ constants.COLOR_MODE_PROVIDER_FILENAME
)
).exists():
shutil.copy(color_mode_provider, (Path.cwd() / "assets"))

client_asset_dir.mkdir(exist_ok=True)
shutil.copy(
constants.ASSETS_DIR / constants.COLOR_MODE_PROVIDER_FILENAME,
client_color_mode_provider.parent,
)
return super().create(*children, **props)


Expand Down
4 changes: 2 additions & 2 deletions reflex_chakra/constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pathlib import Path

ASSET_DIR_NAME = "assets"
ASSETS_DIR = (Path(__file__).parent / ASSET_DIR_NAME).resolve()
ASSETS_DIR_NAME = "assets"
ASSETS_DIR = (Path(__file__).parent / ASSETS_DIR_NAME).resolve()

COLOR_MODE_PROVIDER_FILENAME = "chakra_color_mode_provider.js"

0 comments on commit 6fb904f

Please sign in to comment.