create-dara-app 1.20.2__py3-none-any.whl → 1.21.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,17 +1,34 @@
1
1
  from {{cookiecutter.__package_name}}.pages.components_page import components_page
2
2
  from {{cookiecutter.__package_name}}.pages.intro_page import intro_page
3
- from {{cookiecutter.__package_name}}.utils.template import template_renderer
4
3
 
5
- from dara.core import ConfigurationBuilder
4
+ from dara.core import ConfigurationBuilder, MenuLink, Outlet, SideBarFrame
6
5
  from dara.core.css import get_icon
7
6
 
7
+ from dara.components import Icon, Stack, Text
8
+
8
9
  # Create the configuration builder
9
10
  config = ConfigurationBuilder()
10
11
 
11
- # Add the template renderer to the configuration
12
- config.add_template_renderer('side-bar', template_renderer)
13
- config.template = 'side-bar'
12
+ # Root layout that displays a sidebar with links to the two pages
13
+ def RootLayout():
14
+ return SideBarFrame(
15
+ content=Outlet(),
16
+ side_bar=Stack(
17
+ MenuLink(
18
+ Icon(icon=get_icon('newspaper')),
19
+ Text('Welcome'),
20
+ to='/',
21
+ ),
22
+ MenuLink(
23
+ Icon(icon=get_icon('spell-check')),
24
+ Text('A-Z Components'),
25
+ to='/components',
26
+ ),
27
+ )
28
+ )
29
+
30
+ # Add the layout and pages to the configuration
31
+ root = config.router.add_layout(content=RootLayout)
32
+ root.add_page(path='/', content=intro_page)
33
+ root.add_page(path='/components', content=components_page)
14
34
 
15
- # Add the pages to the configuration
16
- config.add_page(name='Welcome', content=intro_page(), icon=get_icon('newspaper'))
17
- config.add_page(name='A-Z Components', content=components_page(), icon=get_icon('spell-check'))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: create-dara-app
3
- Version: 1.20.2
3
+ Version: 1.21.0
4
4
  Summary: CLI to quickly bootstrap a Dara app
5
5
  Home-page: https://dara.causalens.com/
6
6
  License: Apache-2.0
@@ -21,7 +21,7 @@ Description-Content-Type: text/markdown
21
21
 
22
22
  # Create Dara App
23
23
 
24
- <img src="https://github.com/causalens/dara/blob/v1.20.2/img/dara_light.svg?raw=true">
24
+ <img src="https://github.com/causalens/dara/blob/v1.21.0/img/dara_light.svg?raw=true">
25
25
 
26
26
  ![Master tests](https://github.com/causalens/dara/actions/workflows/tests.yml/badge.svg?branch=master)
27
27
  [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
@@ -10,13 +10,12 @@ create_dara_app/templates/default/{{ cookiecutter.__project_slug }}/README.md,sh
10
10
  create_dara_app/templates/default/{{ cookiecutter.__project_slug }}/poetry.toml,sha256=RIOzGh1iOYR1gohOvPoQvv7Fe3a-1HJQ-9bDQuoyFDE,46
11
11
  create_dara_app/templates/default/{{ cookiecutter.__project_slug }}/pyproject.toml,sha256=O-K9WBpnUNaZTGdjnO_xe6Ed8PVSTFRhNxA1cWvpzr4,1277
12
12
  create_dara_app/templates/default/{{ cookiecutter.__project_slug }}/static/dara_light.svg,sha256=rX8oRQ3Uhcm7yQPO6NXsgRydcz4-mXkkChpZqEY8dOU,318043
13
- create_dara_app/templates/default/{{ cookiecutter.__project_slug }}/{{ cookiecutter.__package_name }}/main.py,sha256=yntXq115p6VWoWF7SFi6r5_sE_1ZUL_oxWzmZf3Fskk,733
13
+ create_dara_app/templates/default/{{ cookiecutter.__project_slug }}/{{ cookiecutter.__package_name }}/main.py,sha256=lpwkkBOBaIRBmJi3eCid9zTe5sqAZl17Pg4LdoRmSqU,1068
14
14
  create_dara_app/templates/default/{{ cookiecutter.__project_slug }}/{{ cookiecutter.__package_name }}/pages/components_page.py,sha256=Ij1Brq2tRkorpmmNY-63KRUdfZwl51YY9eb7m3QdeEo,4929
15
15
  create_dara_app/templates/default/{{ cookiecutter.__project_slug }}/{{ cookiecutter.__package_name }}/pages/intro_page.py,sha256=_G4z_9N66t6eMhIenzIFbIM-p_EzJM8LPGiJ_emRI8k,1590
16
16
  create_dara_app/templates/default/{{ cookiecutter.__project_slug }}/{{ cookiecutter.__package_name }}/utils/components.py,sha256=xAjhKxPC1cgMda5tpLyCwZEEJTVOALR4C7V3REUpxbo,65462
17
- create_dara_app/templates/default/{{ cookiecutter.__project_slug }}/{{ cookiecutter.__package_name }}/utils/template.py,sha256=R8EgjNKD5bou9HkT7CEEISAcO5H7R-sSWFtifFJyK5M,737
18
- create_dara_app-1.20.2.dist-info/LICENSE,sha256=r9u1w2RvpLMV6YjuXHIKXRBKzia3fx_roPwboGcLqCc,10944
19
- create_dara_app-1.20.2.dist-info/METADATA,sha256=QdRQrA53Pjchrdya_k5nvCWIFG8pBTLcq-qsUt3EryM,1984
20
- create_dara_app-1.20.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
21
- create_dara_app-1.20.2.dist-info/entry_points.txt,sha256=RZETW6Q9lb0vM1gptGnobZGlD2qvU-0ZgztNoboRRTk,59
22
- create_dara_app-1.20.2.dist-info/RECORD,,
17
+ create_dara_app-1.21.0.dist-info/LICENSE,sha256=r9u1w2RvpLMV6YjuXHIKXRBKzia3fx_roPwboGcLqCc,10944
18
+ create_dara_app-1.21.0.dist-info/METADATA,sha256=DqkptQ7gWrcMFCOLEUstcNgxLWNG8F3UMa01ixfmAKE,1984
19
+ create_dara_app-1.21.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
20
+ create_dara_app-1.21.0.dist-info/entry_points.txt,sha256=RZETW6Q9lb0vM1gptGnobZGlD2qvU-0ZgztNoboRRTk,59
21
+ create_dara_app-1.21.0.dist-info/RECORD,,
@@ -1,20 +0,0 @@
1
- from dara.core.configuration import Configuration
2
- from dara.core.visual.components import Menu, RouterContent
3
- from dara.core.visual.components.sidebar_frame import SideBarFrame
4
- from dara.core.visual.template import TemplateBuilder
5
-
6
-
7
- def template_renderer(config: Configuration):
8
- builder = TemplateBuilder(name='side-bar')
9
-
10
- # Using the TemplateBuilder's helper method - add_router_from_pages
11
- # to construct a router of page definitions
12
- router = builder.add_router_from_pages(list(config.pages.values()))
13
-
14
- builder.layout = SideBarFrame(
15
- content=RouterContent(routes=router.content),
16
- side_bar=Menu(routes=router.links),
17
- logo_path='/static/dara_light.svg',
18
- )
19
-
20
- return builder.to_template()