Skip to content

Commit 61899f3

Browse files
committed
Adjusting files structure
1 parent dfb0095 commit 61899f3

File tree

4 files changed

+30
-15
lines changed

4 files changed

+30
-15
lines changed

reactpy_material/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
__version__ = "0.0.1"
22

3-
from .core import button, button_group, autocomplete, checkbox, select, grid
3+
from .core.components import button, button_group, autocomplete, checkbox, select
4+
from .core.layout import grid
45

56
__all__ = [
67
"button",

reactpy_material/core/__init__.py

Whitespace-only changes.

reactpy_material/core.py renamed to reactpy_material/core/components.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88

99
_js_module = module_from_file(
1010
"reactpy-material",
11-
file=Path(__file__).parent / "bundle.js"
11+
file=Path(__file__).parents[1] / "bundle.js"
1212
)
1313

1414
md_button = export(_js_module, "MDButton")
1515
md_button_group = export(_js_module, "MDButtonGroup")
1616
md_autocomplete = export(_js_module, "MDAutoComplete")
1717
md_checkbox = export(_js_module, "MDCheckbox")
1818
md_select = export(_js_module, "MDSelect")
19-
md_grid = export(_js_module, "MDGrid")
19+
2020

2121
@component
2222
def button(*children: VdomChild, attrs: Any = {}):
@@ -43,15 +43,4 @@ def checkbox(attrs: Any = {}):
4343

4444
@component
4545
def select(attrs: Any = {}):
46-
return md_select(attrs)
47-
48-
@component
49-
def grid(*children: VdomChild, attrs: Any = {}):
50-
children_items = ()
51-
for c in children:
52-
if isinstance(c, Component):
53-
children_items += (c.render(), )
54-
else:
55-
children_items += (c, )
56-
57-
return md_grid(attrs, children_items)
46+
return md_select(attrs)

reactpy_material/core/layout.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from pathlib import Path
2+
from typing import Any
3+
4+
from reactpy import component
5+
from reactpy.core.component import Component
6+
from reactpy.web.module import export, module_from_file
7+
from reactpy.core.types import VdomChild
8+
9+
_js_module = module_from_file(
10+
"reactpy-material",
11+
file=Path(__file__).parents[1] / "bundle.js"
12+
)
13+
14+
md_grid = export(_js_module, "MDGrid")
15+
16+
@component
17+
def grid(*children: VdomChild, attrs: Any = {}):
18+
children_items = ()
19+
for c in children:
20+
if isinstance(c, Component):
21+
children_items += (c.render(), )
22+
else:
23+
children_items += (c, )
24+
25+
return md_grid(attrs, children_items)

0 commit comments

Comments
 (0)