From 0b733ca031ae76b8ddc68182be48185da5334c79 Mon Sep 17 00:00:00 2001 From: "Manbir.Jandu" Date: Fri, 17 Nov 2023 16:14:21 +0000 Subject: [PATCH 1/6] New Checkout Box --- .../components/plotly/context_box.py | 34 +++++++++++++++++++ setup.py | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 gov_uk_dashboards/components/plotly/context_box.py diff --git a/gov_uk_dashboards/components/plotly/context_box.py b/gov_uk_dashboards/components/plotly/context_box.py new file mode 100644 index 0000000..ff1d3d3 --- /dev/null +++ b/gov_uk_dashboards/components/plotly/context_box.py @@ -0,0 +1,34 @@ +"""Context_box""" +from dash import html + + +def put_context_banner( + text: str, text_class_name: str = "govuk-warning-text__text", style: dict = None +): + """ + Return Context Box based on Gov UK Design notification banner component. + """ + banner = html.Div( + [ + html.Div( + [ + html.P( + [ + text, + ], + className=text_class_name, + ) + ], + className="govuk-notification-banner__content", + ), + ], + className="govuk-notification-banner", + role="region", + style=style, + **{ + "aria-labelledby": "govuk-notification-banner-title", + "data-module": "govuk-notification-banner", + } + ) + return banner + diff --git a/setup.py b/setup.py index f9d6441..0eb5a7a 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ author="Department for Levelling Up, Housing and Communities", description="Provides access to functionality common to creating a data dashboard.", name="gov_uk_dashboards", - version="9.18.0", + version="9.19.0", long_description=long_description, long_description_content_type="text/markdown", packages=find_packages(), From 92d622d221b1ba1d6f87cec239b3d54a1c6f7118 Mon Sep 17 00:00:00 2001 From: "Manbir.Jandu" Date: Fri, 17 Nov 2023 16:33:24 +0000 Subject: [PATCH 2/6] ContextBoxFix --- gov_uk_dashboards/components/plotly/captioned_figure.py | 1 + gov_uk_dashboards/components/plotly/context_box.py | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gov_uk_dashboards/components/plotly/captioned_figure.py b/gov_uk_dashboards/components/plotly/captioned_figure.py index c6ead7e..bf8cd3f 100644 --- a/gov_uk_dashboards/components/plotly/captioned_figure.py +++ b/gov_uk_dashboards/components/plotly/captioned_figure.py @@ -16,6 +16,7 @@ def captioned_figure( desktop_only: bool = False, double_click_attribute: Union[str, bool] = True, ): + # pylint: disable=too-many-arguments """ Return figure with attached caption that can be read by a screen reader. diff --git a/gov_uk_dashboards/components/plotly/context_box.py b/gov_uk_dashboards/components/plotly/context_box.py index ff1d3d3..0b45ced 100644 --- a/gov_uk_dashboards/components/plotly/context_box.py +++ b/gov_uk_dashboards/components/plotly/context_box.py @@ -4,7 +4,7 @@ def put_context_banner( text: str, text_class_name: str = "govuk-warning-text__text", style: dict = None -): +): # pylint: disable=duplicate-code """ Return Context Box based on Gov UK Design notification banner component. """ @@ -31,4 +31,3 @@ def put_context_banner( } ) return banner - From 82a53ff8559bdf53aa065dfd088debbf30901a24 Mon Sep 17 00:00:00 2001 From: "Manbir.Jandu" Date: Fri, 17 Nov 2023 16:51:01 +0000 Subject: [PATCH 3/6] pylintoverride --- gov_uk_dashboards/components/plotly/notification_banner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gov_uk_dashboards/components/plotly/notification_banner.py b/gov_uk_dashboards/components/plotly/notification_banner.py index 112862d..52ea57f 100644 --- a/gov_uk_dashboards/components/plotly/notification_banner.py +++ b/gov_uk_dashboards/components/plotly/notification_banner.py @@ -4,7 +4,7 @@ def notification_banner( text: str, text_class_name: str = "govuk-warning-text__text", style: dict = None -): +): # pylint: disable=duplicate-code """ Return Gov UK Design component notification banner component. """ From 6e5c058dacfb96cdc410adbe00f21f8fa4b89534 Mon Sep 17 00:00:00 2001 From: Duncan Bradley Date: Tue, 21 Nov 2023 11:49:59 +0000 Subject: [PATCH 4/6] remove pylint disable=duplicate-code --- .../components/plotly/context_box.py | 18 +++++++----------- .../components/plotly/notification_banner.py | 2 +- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/gov_uk_dashboards/components/plotly/context_box.py b/gov_uk_dashboards/components/plotly/context_box.py index 0b45ced..2d3bb4b 100644 --- a/gov_uk_dashboards/components/plotly/context_box.py +++ b/gov_uk_dashboards/components/plotly/context_box.py @@ -2,11 +2,9 @@ from dash import html -def put_context_banner( - text: str, text_class_name: str = "govuk-warning-text__text", style: dict = None -): # pylint: disable=duplicate-code +def put_context_banner(): """ - Return Context Box based on Gov UK Design notification banner component. + Return context banner based on Gov UK Design component notification banner component. """ banner = html.Div( [ @@ -14,9 +12,11 @@ def put_context_banner( [ html.P( [ - text, + "Data on its own does not present a complete picture. This explorer" + " should be used to generate questions and not reach judgements." + " See about the data section for more information.", ], - className=text_class_name, + className="govuk-warning-text__text notification-banner-under-filter-panel", ) ], className="govuk-notification-banner__content", @@ -24,10 +24,6 @@ def put_context_banner( ], className="govuk-notification-banner", role="region", - style=style, - **{ - "aria-labelledby": "govuk-notification-banner-title", - "data-module": "govuk-notification-banner", - } + style={"maxWidth": "1000px", "margin-top": "20px", "margin-bottom": "20px"}, ) return banner diff --git a/gov_uk_dashboards/components/plotly/notification_banner.py b/gov_uk_dashboards/components/plotly/notification_banner.py index 52ea57f..46746ac 100644 --- a/gov_uk_dashboards/components/plotly/notification_banner.py +++ b/gov_uk_dashboards/components/plotly/notification_banner.py @@ -4,7 +4,7 @@ def notification_banner( text: str, text_class_name: str = "govuk-warning-text__text", style: dict = None -): # pylint: disable=duplicate-code +): """ Return Gov UK Design component notification banner component. """ From 523d628a641c778bf8e670dbb0bd8ec4e203ddb7 Mon Sep 17 00:00:00 2001 From: Duncan Bradley Date: Tue, 21 Nov 2023 11:59:33 +0000 Subject: [PATCH 5/6] remove trailing whitespace --- gov_uk_dashboards/components/plotly/notification_banner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gov_uk_dashboards/components/plotly/notification_banner.py b/gov_uk_dashboards/components/plotly/notification_banner.py index 46746ac..112862d 100644 --- a/gov_uk_dashboards/components/plotly/notification_banner.py +++ b/gov_uk_dashboards/components/plotly/notification_banner.py @@ -4,7 +4,7 @@ def notification_banner( text: str, text_class_name: str = "govuk-warning-text__text", style: dict = None -): +): """ Return Gov UK Design component notification banner component. """ From 99059c619b43d6c20039c8e28ad5e8fda4e465cf Mon Sep 17 00:00:00 2001 From: Duncan Bradley Date: Tue, 21 Nov 2023 14:03:59 +0000 Subject: [PATCH 6/6] change context_box() to context_banner() and remove put_ before function name --- .../components/plotly/{context_box.py => context_banner.py} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename gov_uk_dashboards/components/plotly/{context_box.py => context_banner.py} (95%) diff --git a/gov_uk_dashboards/components/plotly/context_box.py b/gov_uk_dashboards/components/plotly/context_banner.py similarity index 95% rename from gov_uk_dashboards/components/plotly/context_box.py rename to gov_uk_dashboards/components/plotly/context_banner.py index 2d3bb4b..52885a0 100644 --- a/gov_uk_dashboards/components/plotly/context_box.py +++ b/gov_uk_dashboards/components/plotly/context_banner.py @@ -1,8 +1,8 @@ -"""Context_box""" +"""Context_banner""" from dash import html -def put_context_banner(): +def context_banner(): """ Return context banner based on Gov UK Design component notification banner component. """