Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
huong-li-nguyen committed Oct 22, 2023
1 parent f8f5009 commit b2f32d1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
26 changes: 21 additions & 5 deletions vizro-core/src/scratch.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,34 @@ class Page(VizroBaseModel):
title: str = Field(..., description="Title to be displayed.")
layout: Optional[Layout]
controls: List[ControlType] = []
actions: List[ActionsChain] = []
path
path: Optional[str] = Field(None, description="Path to navigate to page.")
class Tab/SubPage(VizroBaseModel):
class Tab(VizroBaseModel):
components: List[ComponentType]
label: str = Field(..., description="Tab Lable to be displayed.")
title: Optional[str] # do we need this one?
layout: Optional[Layout]
# layout: Optional[Layout]
@_log_call
def build(self):
components = [component.build() for component in self.components]
return dcc.Tab(
html.Div(children=[html.H3(self.title, className="tab-title"), *components]),
id=self.id,
label=self.title,
)
class Tabs(VizroBaseModel):
type: Literal["tabs"] = "tabs"
tabs: List[Tab] = []
@_log_call
def build(self):
return html.Div(
[
dcc.Tabs(id=self.id, children=[tab.build() for tab in self.tabs], className="tabs_container"),
],
className="tabs_container_outer",
)
```
4 changes: 1 addition & 3 deletions vizro-core/src/vizro/models/_components/_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from typing import List, Optional

from dash import dcc, html
from pydantic import Field

from vizro.models import VizroBaseModel
from vizro.models._models_utils import _log_call
Expand All @@ -12,7 +11,6 @@

class Tab(VizroBaseModel):
components: List[ComponentType]
label: str = Field(..., description="Tab label to be displayed.")
title: Optional[str] # do we need this one?
# layout: Optional[Layout]

Expand All @@ -22,5 +20,5 @@ def build(self):
return dcc.Tab(
html.Div(children=[html.H3(self.title, className="tab-title"), *components]),
id=self.id,
label=self.label,
label=self.title,
)

0 comments on commit b2f32d1

Please sign in to comment.