-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsidebar.py
81 lines (62 loc) · 3.35 KB
/
sidebar.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
from dash import html, dcc
from dash_spa import prefix
from dash_spa.components.dropdown_folder_aoi import DropdownFolderContext, DropdownFolderAIO, SidebarNavItem, dropdownFolderEntry
from ..icons.hero import ICON
def _sidebarLink(text, icon, href, hyperlink=False, target=""):
Element = html.A if hyperlink else dcc.Link
el = Element([
html.Span([
icon
], className='sidebar-icon'),
html.Span(text, className='mt-1 ms-1 sidebar-text')
], href=href, className='nav-link')
if target:
el.target = target
return SidebarNavItem(el, SidebarNavItem.is_active(href))
def _sidebarButtonLink(text, icon, href):
return SidebarNavItem([
dcc.Link([
html.Span([
icon
], className='sidebar-icon d-inline-flex align-items-center justify-content-center'),
html.Span(text, className="sidebar-text")
], href=href, className='btn btn-secondary d-flex align-items-center justify-content-center btn-upgrade-pro')
], active=SidebarNavItem.is_active(href))
@DropdownFolderContext.Provider()
def sideBar():
pid = prefix('sidebar')
return html.Nav([
html.Div([
# Sidebar List of entries
html.Ul([
_sidebarLink("DashSPA", ICON.LIGHTENING, '/', target="_blank"),
_sidebarLink("Dashboard", ICON.CHART_PIE, '/pages/dashboard'),
_sidebarLink("Transactions", ICON.CREDIT_CARD, '/pages/transactions'),
_sidebarLink("Settings", ICON.VIEW_GRID, '/pages/settings'),
_sidebarLink("Calendar", ICON.CALENDER, 'https://demo.themesberg.com/volt-pro/pages/calendar'),
DropdownFolderAIO([
dropdownFolderEntry("Bootstrap Tables", '/pages/tables/bootstrap-tables'),
], "Tables", ICON.TABLE, id=pid('tables')),
# Page examples drop down
DropdownFolderAIO([
dropdownFolderEntry("Sign In", '/pages/sign-in'),
dropdownFolderEntry("Sign Up", '/pages/sign-up'),
dropdownFolderEntry("Forgot password", '/pages/forgot-password'),
dropdownFolderEntry("Reset password", '/pages/reset-password'),
dropdownFolderEntry("Lock", '/pages/lock'),
dropdownFolderEntry("404 Not Found", '/pages/???'),
dropdownFolderEntry("500 Not Found", '/pages/500'),
], "Page examples", ICON.PAGES, id=pid('examples')),
# Components drop down
DropdownFolderAIO([
dropdownFolderEntry("Buttons", '/pages/components/buttons'),
dropdownFolderEntry("Notifications", '/pages/components/notifications'),
dropdownFolderEntry("Forms", '/pages/components/forms'),
dropdownFolderEntry("Modals", '/pages/components/modals'),
dropdownFolderEntry("Typography", '/pages/components/typography'),
], "Components", ICON.ARCHIVE, id=pid('components')),
# Bottom Item
_sidebarButtonLink("Exit", ICON.FIRE.ME2, '/')
], className='nav flex-column pt-3 pt-md-0')
], className='sidebar-inner px-4 pt-3')
], id='sidebarMenu', className='sidebar d-lg-block bg-gray-800 text-white collapse')