From 03b73b9f3687ac33a19bc873ae1e295e75adc6a9 Mon Sep 17 00:00:00 2001 From: Li Nguyen <90609403+huong-li-nguyen@users.noreply.github.com> Date: Wed, 27 Sep 2023 10:12:16 +0200 Subject: [PATCH] Remove `left_side` container by default if no content present (#68) --- ...173346_huong_li_nguyen_remove_left_side.md | 41 +++++++++++++++++++ vizro-core/docs/pages/development/authors.md | 16 ++++---- vizro-core/src/vizro/models/_page.py | 5 +-- .../tests/unit/vizro/models/test_page.py | 3 ++ 4 files changed, 54 insertions(+), 11 deletions(-) create mode 100644 vizro-core/changelog.d/20230926_173346_huong_li_nguyen_remove_left_side.md diff --git a/vizro-core/changelog.d/20230926_173346_huong_li_nguyen_remove_left_side.md b/vizro-core/changelog.d/20230926_173346_huong_li_nguyen_remove_left_side.md new file mode 100644 index 000000000..a3b5639d3 --- /dev/null +++ b/vizro-core/changelog.d/20230926_173346_huong_li_nguyen_remove_left_side.md @@ -0,0 +1,41 @@ + + + + + +### Changed + +- Remove `left_side` container by default if there are no elements present ([#68](https://github.com/mckinsey/vizro/pull/68)) + + + + diff --git a/vizro-core/docs/pages/development/authors.md b/vizro-core/docs/pages/development/authors.md index 9bc3d4bc2..5af936c38 100644 --- a/vizro-core/docs/pages/development/authors.md +++ b/vizro-core/docs/pages/development/authors.md @@ -1,19 +1,21 @@ ## Current team members -[Joseph Perkins](https://github.com/Joseph-Perkins), -[Dan Dumitriu](https://github.com/dandumitriu1), +[Chiara Pullem](https://github.com/chiara-sophie), [Antony Milne](https://github.com/antonymilne), -[Huong Li Nguyen](https://github.com/huong-li-nguyen), -[Maximilian Schulz](https://github.com/maxschulz-COL), +[Anna Xiong](https://github.com/AnnaXiongQB), [Lingyi Zhang](https://github.com/lingyielia), -[Alexey Snigir](https://github.com/l0uden), [Nadija Graca](https://github.com/nadijagraca), -[Chiara Pullem](https://github.com/chiara-sophie), -[Anna Xiong](https://github.com/AnnaXiongQB), [Petar Pejovic](https://github.com/petar-qb) +[Alexey Snigir](https://github.com/l0uden), +[Maximilian Schulz](https://github.com/maxschulz-COL), +[Huong Li Nguyen](https://github.com/huong-li-nguyen), +[Dan Dumitriu](https://github.com/dandumitriu1), +[Joseph Perkins](https://github.com/Joseph-Perkins), ## Previous team members and code contributors +[Jo Stichbury](https://github.com/stichbury) +[Juan Luis Cano Rodríguez](https://github.com/astrojuanlu) [Denis Lebedev](https://github.com/DenisLebedevMcK), [Qiuyi Chen](https://github.com/Qiuyi-Chen), [Elena Fridman](https://github.com/EllenWie), diff --git a/vizro-core/src/vizro/models/_page.py b/vizro-core/src/vizro/models/_page.py index dffac713a..5906a26f9 100644 --- a/vizro-core/src/vizro/models/_page.py +++ b/vizro-core/src/vizro/models/_page.py @@ -215,10 +215,7 @@ def _arrange_containers(page_title, theme_switch, nav_panel, control_panel, comp children=header_elements, className="header", ) - left_side = html.Div( - children=left_side_elements, - className="left_side", - ) + left_side = html.Div(children=left_side_elements, className="left_side") if any(left_side_elements) else None right_side_elements = [header, component_container] right_side = html.Div( children=right_side_elements, diff --git a/vizro-core/tests/unit/vizro/models/test_page.py b/vizro-core/tests/unit/vizro/models/test_page.py index 4cef8003e..bbc9ef5a5 100644 --- a/vizro-core/tests/unit/vizro/models/test_page.py +++ b/vizro-core/tests/unit/vizro/models/test_page.py @@ -95,3 +95,6 @@ def test_action_auto_generation_valid(self, standard_px_chart): assert len(page.actions) == 1 assert isinstance(page.actions[0], ActionsChain) assert page.actions[0].id == f"{ON_PAGE_LOAD_ACTION_PREFIX}_Page 1" + + +# TODO: Add unit tests for private methods in page build