-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Demo] Adjust layout for smaller screensize #876
base: main
Are you sure you want to change the base?
Conversation
for more information, see https://pre-commit.ci
View the example dashboards of the current commit live on PyCafe ☕ 🚀Updated on: 2024-11-15 15:08:31 UTC Link: vizro-core/examples/dev/ Link: vizro-core/examples/scratch_dev |
Co-authored-by: Antony Milne <[email protected]>
for more information, see https://pre-commit.ci
html.Div( | ||
children=[ | ||
html.Span("download", className="material-symbols-outlined", id=f"{self.id}-icon"), | ||
dropdown_menu, | ||
dbc.Tooltip( | ||
"Download this plot to your device as a plotly JSON or interactive HTML file " | ||
"for easy sharing or future use.", | ||
target="dropdown-menu-icon", | ||
), | ||
], | ||
id="dropdown-menu-div", | ||
), | ||
className="dropdown-menu-outer-div", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The download icon and the download label should be in the same container and the tooltip should be around the entire button - this way this looks like one component.
Currently you get the tooltip if you hover of the icon only, but normally I would hover over the entire button instead of individual elements within.
So something like this. You still have to customise some CSS for it to look good, but structurally the button will be one component, so the tooltip will appear when you hover over the entire button, not only the icon and the label consists of the icon and the text label. I am not sure if you need all of these html.divs - I've removed some of them below. This way it's easier to customise CSS and see which of these containers we really need
class DropdownMenu(vm.VizroBaseModel):
"""Custom dropdown menu component."""
type: Literal["dropdown_menu"] = "dropdown_menu"
def build(self):
"""Returns custom dropdown menu."""
dropdown_menu = dbc.DropdownMenu(
id="dropdown-menu-button",
label=[html.Span("download", className="material-symbols-outlined", id=f"{self.id}-icon"), html.Span("Download")],
children=[
dbc.DropdownMenuItem(
children=[
dbc.Button(children="JSON", id=f"{self.id}-json", className="download-button"),
]
),
dbc.DropdownMenuItem(
children=[
dbc.Button(children="HTML", id=f"{self.id}-html", className="download-button"),
]
),
dcc.Download(id="download-file"),
dbc.Tooltip(
"Download this plot to your device as a plotly JSON or interactive HTML file "
"for easy sharing or future use.",
target="dropdown-menu-button",
),
],
toggleClassName="dropdown-menu-toggle-class",
)
return dropdown_menu
*[[4, 4, 4, 4]] * 2, | ||
*[[2, 2, 1, 1]] * 3, | ||
*[[3, 3, 1, 1]] * 4, | ||
*[[0, 0, 1, 1]] * 10, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure how the layout worked before for bigger/smaller screensizes, but when I see reduce the screen width, I see these containers still overlapping, and the buttons seem to be not readable anymore.
This might have to be done by switching to a flexbox model for small screen sizes, so getting rid of the grid-layout and have the form and chart underneath each other (see our current layout.css file)
Description
Adjust layout and css to allow Vizro-AI chart UI to render in smaller screen sizes well.
Screenshot
Notice
I acknowledge and agree that, by checking this box and clicking "Submit Pull Request":