From d3670359d01a965756fbf3edc03984ee3183f2d2 Mon Sep 17 00:00:00 2001 From: Mel Wong <46764557+melwong-jcc@users.noreply.github.com> Date: Wed, 20 Sep 2023 10:33:46 -0700 Subject: [PATCH] persistent offcanvas if third-party integration only (#846) --- .../03-organisms/offcanvas/offcanvas.twig | 96 ++++++++++--------- .../03-organisms/offcanvas/offcanvas.yml | 31 +++--- .../04-templates/drawer/drawer-example.twig | 8 +- .../04-templates/drawer/drawer-example.yml | 25 ++--- 4 files changed, 84 insertions(+), 76 deletions(-) diff --git a/source/_patterns/03-organisms/offcanvas/offcanvas.twig b/source/_patterns/03-organisms/offcanvas/offcanvas.twig index 9dc0ad300..dbfe425a7 100644 --- a/source/_patterns/03-organisms/offcanvas/offcanvas.twig +++ b/source/_patterns/03-organisms/offcanvas/offcanvas.twig @@ -1,58 +1,62 @@ {# TODO: Possibly refactor later as a "drawer" component since diverging from offcanvas intent ... https://getbootstrap.com/docs/5.0/components/offcanvas/ #}
- -
-
+ {% if offcanvas.dialog %} + +
+
+ {% include '@atoms/button/button.twig' with { + button: { + id: offcanvas.dialog.button_close.id|default('offcanvas_close'), + style: 'unstyled', + aria_label: offcanvas.dialog.button_close.aria_label|default('Close this dialog window'), + other_attributes: 'tabindex=-1 data-offcanvas=trigger-close', + icon: { + name: 'close', + set: 'fa', + }, + url: '#', + } + } %} +
+ + {% include '@molecules/hero/hero.twig' with { + hero: { + layout: offcanvas.dialog.hero.layout|default('full-main'), + background: offcanvas.dialog.hero.background|default('alt'), + main: { + icon: offcanvas.dialog.hero.main.icon, + title: offcanvas.dialog.hero.main.title, + title_tag: 'h2', + lead: offcanvas.dialog.hero.main.lead, + actions: offcanvas.dialog.hero.main.actions, + } + } + } %} +
+ + {% if offcanvas.dialog.embed %} +
+ {{ offcanvas.dialog.embed }} +
+ {% endif %} +
+ {% endif %} + +
+ {% if offcanvas.button %} +
{% include '@atoms/button/button.twig' with { button: { - id: offcanvas.button_close.id|default('offcanvas_close'), - style: 'unstyled', - aria_label: offcanvas.button_close.aria_label|default('Close this dialog window'), - other_attributes: 'tabindex=-1 data-offcanvas=trigger-close', - icon: { - name: 'close', - set: 'fa', - }, + id: offcanvas.button.id|default('offcanvas_open'), + text: offcanvas.button.text, + other_attributes: 'data-offcanvas=trigger', + icon: offcanvas.button.icon, + icon_layout: offcanvas.button.icon_layout|default('top'), url: '#', } } %}
- - {% include '@molecules/hero/hero.twig' with { - hero: { - layout: offcanvas.hero.layout|default('full-main'), - background: offcanvas.hero.background|default('alt'), - main: { - icon: offcanvas.hero.main.icon, - title: offcanvas.hero.main.title, - title_tag: 'h2', - lead: offcanvas.hero.main.lead, - actions: offcanvas.hero.main.actions, - } - } - } %} -
- - {% if offcanvas.embed %} -
- {{ offcanvas.embed }} -
{% endif %} -
- -
-
- {% include '@atoms/button/button.twig' with { - button: { - id: offcanvas.button.id|default('offcanvas_open'), - text: offcanvas.button.text, - other_attributes: 'data-offcanvas=trigger', - icon: offcanvas.button.icon, - icon_layout: offcanvas.button.icon_layout|default('top'), - url: '#', - } - } %} -
diff --git a/source/_patterns/03-organisms/offcanvas/offcanvas.yml b/source/_patterns/03-organisms/offcanvas/offcanvas.yml index ed3394c2e..547ba09dc 100644 --- a/source/_patterns/03-organisms/offcanvas/offcanvas.yml +++ b/source/_patterns/03-organisms/offcanvas/offcanvas.yml @@ -1,20 +1,21 @@ offcanvas: id: "feedback-id" - button_close: - id: "feedback_close" - hero: - main: - icon: - name: "like-dislike" - set: "fig" - width: 55 - height: 45 - title: "Was this helpful?" - lead: "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat." - actions: - - text: "Yes" - - text: "No" - embed: "" + dialog: + button_close: + id: "feedback_close" + hero: + main: + icon: + name: "like-dislike" + set: "fig" + width: 55 + height: 45 + title: "Was this helpful?" + lead: "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat." + actions: + - text: "Yes" + - text: "No" + embed: "" button: id: "feedback_open" text: "Was this helpful?" diff --git a/source/_patterns/04-templates/drawer/drawer-example.twig b/source/_patterns/04-templates/drawer/drawer-example.twig index a737e7778..286c107b4 100644 --- a/source/_patterns/04-templates/drawer/drawer-example.twig +++ b/source/_patterns/04-templates/drawer/drawer-example.twig @@ -12,9 +12,11 @@ {% include '@organisms/offcanvas/offcanvas.twig' with { offcanvas: { id: drawer_example.offcanvas.id, - button_close: drawer_example.offcanvas.button_close, - hero: drawer_example.offcanvas.hero, - embed: chat, + dialog: { + button_close: drawer_example.dialog.offcanvas.button_close, + hero: drawer_example.offcanvas.dialog.hero, + embed: chat, + }, button: drawer_example.offcanvas.button, } } %} diff --git a/source/_patterns/04-templates/drawer/drawer-example.yml b/source/_patterns/04-templates/drawer/drawer-example.yml index 658199aab..30f19b29f 100644 --- a/source/_patterns/04-templates/drawer/drawer-example.yml +++ b/source/_patterns/04-templates/drawer/drawer-example.yml @@ -73,19 +73,20 @@ drawer_example: url: "#" offcanvas: id: "chat_modal_id" - button_close: - id: "chat_close" - hero: - main: - icon: - name: "chat" - set: "fig" - width: 35 - height: 50 + dialog: + button_close: + id: "chat_close" + hero: + main: + icon: + name: "chat" + set: "fig" + width: 35 + height: 50 + title: "Chat Now" title: "Chat Now" - title: "Chat Now" - lead: "Duis autem vel eum iure reprehenderit qui in volup tate velit esse quam." - actions: false + lead: "Duis autem vel eum iure reprehenderit qui in volup tate velit esse quam." + actions: false button: id: "chat_open" text: "Chat Now"