Skip to content

Commit

Permalink
📝 Improve components type hinting
Browse files Browse the repository at this point in the history
  • Loading branch information
GusFurtado committed Jun 14, 2022
1 parent 9764cf2 commit 7aea4bb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
9 changes: 5 additions & 4 deletions dash_charlotte/components/box.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from uuid import uuid4

from dash import html
from dash.development.base_component import Component



Expand Down Expand Up @@ -47,13 +48,13 @@ class Box(html.Div):

def __init__(
self,
children = None,
title = None,
subtitle = None,
children: Optional[Component] = None,
title: Optional[Component] = None,
subtitle: Optional[Component] = None,
title_color: str = 'blue',
title_style: Optional[dict] = None,
icon: Optional[str] = None,
header_content = None,
header_content: Optional[Component] = None,
style: Optional[dict] = None,
padding: float = 10,
id: Optional[str] = None
Expand Down
11 changes: 8 additions & 3 deletions dash_charlotte/components/dashboard.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
from typing import Optional

from dash import dcc, html
from dash.development.base_component import Component
from dash_bootstrap_components import Container

from . import Drawer, Navbar



class Dashboard(Container):
Expand Down Expand Up @@ -30,9 +35,9 @@ class Dashboard(Container):

def __init__(
self,
children = None,
navbar = None,
drawer = None,
children: Optional[Component] = None,
navbar: Optional[Navbar] = None,
drawer: Optional[Drawer] = None,
id: str = 'dashboard'
):

Expand Down
5 changes: 3 additions & 2 deletions dash_charlotte/components/footer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from uuid import uuid4

from dash import html
from dash.development.base_component import Component



Expand Down Expand Up @@ -30,8 +31,8 @@ class Footer(html.Footer):

def __init__(
self,
left_text: Optional[str] = None,
right_text: Optional[str] = None,
left_text: Optional[Component] = None,
right_text: Optional[Component] = None,
id: Optional[str] = None
):

Expand Down
4 changes: 2 additions & 2 deletions dash_charlotte/components/navbar.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Optional, Union
from typing import Optional
import uuid

from dash import html
Expand All @@ -9,7 +9,7 @@
class Navbar(html.Nav):
def __init__(
self,
title: Union[str, Component],
title: Component,
children: Optional[Component] = None,
id: Optional[str] = None
):
Expand Down

0 comments on commit 7aea4bb

Please sign in to comment.