Skip to content
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] Add banner to visual vocabulary dashboard #868

Merged
merged 6 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!--
A new scriv changelog fragment.

Uncomment the section that is right (remove the HTML comment wrapper).
-->

<!--
### Highlights ✨

- A bullet item for the Highlights ✨ category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Removed

- A bullet item for the Removed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Added

- A bullet item for the Added category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Changed

- A bullet item for the Changed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Deprecated

- A bullet item for the Deprecated category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Fixed

- A bullet item for the Fixed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Security

- A bullet item for the Security category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
11 changes: 11 additions & 0 deletions vizro-core/examples/visual-vocabulary/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

from typing import Union

import dash_bootstrap_components as dbc
import vizro.models as vm
from chart_groups import ALL_CHART_GROUP, CHART_GROUPS, ChartGroup, IncompletePage
from custom_components import FlexContainer, Markdown
from dash import get_asset_url, html
from vizro import Vizro


Expand Down Expand Up @@ -108,6 +110,15 @@ def make_navlink(chart_group: ChartGroup) -> vm.NavLink:
)

app = Vizro().build(dashboard)
app.dash.layout.children.append(
dbc.NavLink(
["Made with ", html.Img(src=get_asset_url("logo.svg"), id="banner", alt="Vizro logo"), "vizro"],
href="https://github.com/mckinsey/vizro",
target="_blank",
external_link=True,
huong-li-nguyen marked this conversation as resolved.
Show resolved Hide resolved
className="anchor-container",
)
)
server = app.dash.server

if __name__ == "__main__":
Expand Down
25 changes: 25 additions & 0 deletions vizro-core/examples/visual-vocabulary/assets/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,28 @@ img[src*="#chart-icon"] {
.intro-text ul:last-of-type {
margin-bottom: 0;
}

.anchor-container {
align-items: center;
background: var(--text-primary);
border-top-left-radius: 8px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😱 A rounded border?!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And one other thing I noticed. Do we really want the banner to block out the whole horizontal space rather than just floating on top of the underlying content?
image

Copy link
Contributor

@huong-li-nguyen huong-li-nguyen Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes 😄 I didn't like the border as is and for the banner we can make an exception 👍

It's not the banner that blocks the whole horizontal space. The banner floats already just on top of the underlying content. That horizontal space has always been there and is part of our initial layout design. It's coming from the right-side container and its padding :)

bottom: 0;
color: var(--text-contrast-primary);
display: flex;
font-size: 0.8rem;
font-weight: 500;
height: 24px;
padding: 0 12px;
position: fixed;
right: 0;
}

.anchor-container:focus,
.anchor-container:hover {
background: var(--text-secondary);
color: var(--text-contrast-primary);
}

img#banner {
height: 16px;
}