Skip to content

Commit

Permalink
✨ Add children attribute to Navbar
Browse files Browse the repository at this point in the history
  • Loading branch information
GusFurtado committed Jun 14, 2022
1 parent 0390452 commit 9764cf2
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions dash_charlotte/components/navbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Navbar(html.Nav):
def __init__(
self,
title: Union[str, Component],
children: Optional[Component] = None,
id: Optional[str] = None
):
"""Navbar components.
Expand All @@ -18,11 +19,22 @@ def __init__(
----------
title : str | Dash Component
Text displayed inside the navbar.
children : Dash Component, optional
Content in the right of the navbar.
id : str, optional
Component's ID.
Components IDs
--------------
{id}--title
Navbar title.
{id}--children
Content in the right of the navbar.
"""

id = id or str(uuid.uuid4())

super().__init__(
className = 'home-content shade7',
children = [
Expand All @@ -31,9 +43,23 @@ def __init__(
id = 'open-drawer'
),
html.Span(
className = 'text',
children = title,
id = id or str(uuid.uuid4())
children = [
html.Span(
className = 'text',
children = title,
id = f'{id}--title'
),
html.Span(
className = 'text',
children = children,
id = f'{id}--children'
)
],
style = {
'width': '100%',
'display': 'flex',
'justify-content': 'space-between'
}
)
]
)

0 comments on commit 9764cf2

Please sign in to comment.