Skip to content

Commit

Permalink
[Feat] Update to use dmc 0.15.1 Part 2 (#960)
Browse files Browse the repository at this point in the history
  • Loading branch information
antonymilne authored Jan 21, 2025
1 parent 5d21dc9 commit 00cdb96
Show file tree
Hide file tree
Showing 7 changed files with 546 additions and 28 deletions.
1 change: 1 addition & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
**/static/css/vizro-bootstrap.min.css
**/static/css/vizro-bootstrap.min.css.map
**/static/css/mantine_dates.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!--
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

- Bumped library used for `vm.DatePicker` to `dash_mantine_components~=0.15.1`. ([#924](https://github.com/mckinsey/vizro/pull/924))

<!--
### 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))
-->
2 changes: 1 addition & 1 deletion vizro-core/examples/dev/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,6 @@ def multiple_cards(data_frame: pd.DataFrame, n_rows: Optional[int] = 1) -> html.
target="_blank",
className="anchor-container",
)
app.dash.layout.children = [app.dash.layout.children, banner]
app.dash.layout.children.append(banner)
server = app.dash.server
app.run()
8 changes: 0 additions & 8 deletions vizro-core/src/vizro/_vizro.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from typing import TYPE_CHECKING, TypedDict, cast

import dash
import dash_mantine_components as dmc
import plotly.io as pio
from dash.development.base_component import ComponentRegistry
from flask_caching import SimpleCache
Expand Down Expand Up @@ -53,13 +52,6 @@ def __init__(self, **kwargs):
use_pages=True,
)

# Ensure external_stylesheets is a list and append the additional stylesheet
external_stylesheets = self.dash.config.external_stylesheets
self.dash.config.external_stylesheets = (
external_stylesheets if isinstance(external_stylesheets, list) else [external_stylesheets]
)
self.dash.config.external_stylesheets.append(dmc.styles.DATES)

# When Vizro is used as a framework, we want to include the library and framework resources.
# Dash serves resources in the order 1. external_stylesheets/scripts; 2. library resources from the
# ComponentRegistry; 3. resources added by append_css/scripts.
Expand Down
10 changes: 7 additions & 3 deletions vizro-core/src/vizro/models/_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,14 @@ def build(self):
dash.page_container,
],
)

# children=[layout] as a list rather than children=layout, so that app.dash.layout.children.append works to
# easily add things to the Dash layout. In future we might have a neater function for patching components into
# the Dash layout in which case this could change.
return dmc.MantineProvider(
layout,
# Applies to all Mantine components
theme={"fontFamily": "Inter, sans-serif, Arial, serif", "primaryColor": "gray", "defaultRadius": 0},
children=[layout],
# Use the `theme` to style all Mantine components with a Vizro theme. For more info see https://www.dash-mantine-components.com/components/mantineprovider
theme={"primaryColor": "gray"},
)

def _validate_logos(self):
Expand Down
Loading

0 comments on commit 00cdb96

Please sign in to comment.