portfolio_management / sidebar.py
huggingface112's picture
added side nav bar
cd1bf03
raw
history blame
781 Bytes
from panel.viewable import Viewer
import panel as pn
class SideNavBar(Viewer):
def __init__(self, **params):
self.pages = {
'编辑Portfolio': "/portfolioEditingPage",
'主页': "/index_page",
}
self.styles = {
'text-decoration': 'none',
'color': '#1E90FF',
'font-size': '18px',
'font-weight': 'bold'
}
super().__init__(**params)
def _create_link(self, name, url):
return pn.pane.HTML(f"""<a href="{url}">{name}</a>""", styles=self.styles)
def __panel__(self):
self._layout = pn.Column()
self._layout.extend(
[self._create_link(name, url) for name, url in self.pages.items()]
)
return self._layout