-
Notifications
You must be signed in to change notification settings - Fork 0
/
header.py
46 lines (34 loc) · 1.08 KB
/
header.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from enum import Enum
from dash import dcc, html
class Page(Enum):
GOAL_TRACKING = "Goal tracking"
USAGE_STAT = "Usage statistics"
class Header:
def __init__(self):
self._current_page = Page.GOAL_TRACKING
self._html_component = self._build_html_component()
def get_current_page(self):
return self._current_page
def set_current_page(self, page):
self._current_page = page
def get_html_component(self):
return self._html_component
def _build_html_component(self):
controller_widget = self._build_controller()
header = html.Div(
id="header",
children=[controller_widget],
)
return header
def _build_controller(self):
div = html.Div(
id="header-controller",
children=[
dcc.Dropdown(
id="page-dropdown",
options=[Page.GOAL_TRACKING.value, Page.USAGE_STAT.value],
value=self.get_current_page().value,
)
],
)
return div