From c9ec4d4f2dbf28bc96aeeb575e4130117ba5af93 Mon Sep 17 00:00:00 2001 From: Ryan Koch Date: Thu, 9 Jan 2025 12:39:08 -0600 Subject: [PATCH 1/2] VAGOV-TEAM-100673: Removes navbar and replaces with subtitle. --- .../css/va_gov_form_builder.css | 49 +++---------------- .../Controller/VaGovFormBuilderController.php | 14 +++--- .../page--va-gov-form-builder.html.twig | 40 +-------------- .../functional/Form/IntroTest.php | 8 --- .../functional/Form/NameAndDobTest.php | 8 --- .../functional/Form/StartConversionTest.php | 8 --- .../templates/FormBuilderPageTemplateTest.php | 2 +- 7 files changed, 16 insertions(+), 113 deletions(-) diff --git a/docroot/modules/custom/va_gov_form_builder/css/va_gov_form_builder.css b/docroot/modules/custom/va_gov_form_builder/css/va_gov_form_builder.css index 967c868c90..7c73c407f7 100644 --- a/docroot/modules/custom/va_gov_form_builder/css/va_gov_form_builder.css +++ b/docroot/modules/custom/va_gov_form_builder/css/va_gov_form_builder.css @@ -16,10 +16,6 @@ font-size: var(--vads-font-size-heading-level-2); } -.form-builder-page-container h2 { - font-size: var(--vads-font-size-heading-level-2); -} - .form-builder-page-container h3 { font-size: var(--vads-font-size-heading-level-3); } @@ -53,43 +49,10 @@ margin-bottom: var(--units-1p5); } -/* navbar */ -.form-builder-navbar__nav { - display: flex; -} - -.form-builder-navbar__tabs { - display: flex; - gap: var(--units-5); - list-style: none; - margin: 0; -} - -.form-builder-navbar__tab { - min-width: 100px; - padding: var(--units-1); - position: relative; - text-align: center; -} - -.form-builder-navbar__tab--active { - border-bottom: var(--units-0p5) solid var(--uswds-system-color-gold-vivid-20); -} - -.form-builder-navbar__link { - color: var(--vads-color-white); - font-size: var(--font-size-lg); - font-weight: var(--font-weight-bold); - line-height: var(--vads-font-line-height-default); - text-decoration: none; -} - -.form-builder-navbar__link:hover { - background: transparent; - color: var(--vads-color-white); -} - -.form-builder-navbar__tab--active .form-builder-navbar__link, -.form-builder-navbar__tab--active .form-builder-navbar__link:hover { - color: var(--uswds-system-color-gold-vivid-20); +/* subtitle */ +.form-builder-subtitle { + font-size: var(--vads-font-size-heading-level-3); + font-weight: 700; + line-height: var(--units-3); + padding: var(--units-1p5); } diff --git a/docroot/modules/custom/va_gov_form_builder/src/Controller/VaGovFormBuilderController.php b/docroot/modules/custom/va_gov_form_builder/src/Controller/VaGovFormBuilderController.php index 5217021410..58709040ae 100644 --- a/docroot/modules/custom/va_gov_form_builder/src/Controller/VaGovFormBuilderController.php +++ b/docroot/modules/custom/va_gov_form_builder/src/Controller/VaGovFormBuilderController.php @@ -32,11 +32,11 @@ class VaGovFormBuilderController extends ControllerBase { private $drupalFormBuilder; /** - * The active tab in the form builder. + * The page subtitle. * - * @var 'forms'|'content'|'layout' + * @var string */ - private $activeTab; + private $subtitle; /** * {@inheritdoc} @@ -65,7 +65,7 @@ private function getFormPage($formName, $nid = NULL) { 'content' => $form, // Add custom data. 'form_builder_page_data' => [ - 'active_tab' => $this->activeTab, + 'subtitle' => $this->subtitle, ], // Add styles. '#attached' => [ @@ -87,7 +87,7 @@ public function entry() { * Intro page. */ public function intro() { - $this->activeTab = 'forms'; + $this->subtitle = 'Subtitle Placeholder'; return $this->getFormPage('Intro'); } @@ -95,7 +95,7 @@ public function intro() { * Start-conversion page. */ public function startConversion() { - $this->activeTab = 'forms'; + $this->subtitle = 'Subtitle Placeholder'; return $this->getFormPage('StartConversion'); } @@ -103,7 +103,7 @@ public function startConversion() { * Name-and-date-of-birth page. */ public function nameAndDob($nid) { - $this->activeTab = 'content'; + $this->subtitle = 'Subtitle Placeholder'; return $this->getFormPage('NameAndDob', $nid); } diff --git a/docroot/modules/custom/va_gov_form_builder/templates/page--va-gov-form-builder.html.twig b/docroot/modules/custom/va_gov_form_builder/templates/page--va-gov-form-builder.html.twig index 1856f29d91..51e898e704 100644 --- a/docroot/modules/custom/va_gov_form_builder/templates/page--va-gov-form-builder.html.twig +++ b/docroot/modules/custom/va_gov_form_builder/templates/page--va-gov-form-builder.html.twig @@ -15,44 +15,8 @@
- -
-

Form Builder

-
- - {% set active_tab = page.form_builder_page_data.active_tab %} -
- -
+

Form Builder

+
{{ page.form_builder_page_data.subtitle }}
diff --git a/tests/phpunit/va_gov_form_builder/functional/Form/IntroTest.php b/tests/phpunit/va_gov_form_builder/functional/Form/IntroTest.php index 955211e368..7c310d9aff 100644 --- a/tests/phpunit/va_gov_form_builder/functional/Form/IntroTest.php +++ b/tests/phpunit/va_gov_form_builder/functional/Form/IntroTest.php @@ -52,14 +52,6 @@ public function testFormDoesNotLoad() { $this->sharedTestFormDoesNotLoad($this->getFormPageUrl()); } - /** - * Test that the active tab is correct. - */ - public function testActiveTab() { - $activeTab = $this->getSession()->getPage()->find('css', '.form-builder-navbar__tab--active'); - $this->assertTrue($activeTab->hasClass('form-builder-navbar__tab--forms'), 'The expected tab is active.'); - } - /** * Test the 'Start conversion' button. */ diff --git a/tests/phpunit/va_gov_form_builder/functional/Form/NameAndDobTest.php b/tests/phpunit/va_gov_form_builder/functional/Form/NameAndDobTest.php index f12f632c1f..06a3d883ab 100644 --- a/tests/phpunit/va_gov_form_builder/functional/Form/NameAndDobTest.php +++ b/tests/phpunit/va_gov_form_builder/functional/Form/NameAndDobTest.php @@ -78,14 +78,6 @@ public function testFormDoesNotLoad() { $this->sharedTestFormDoesNotLoad($this->getFormPageUrl()); } - /** - * Test that the active tab is correct. - */ - public function testActiveTab() { - $activeTab = $this->getSession()->getPage()->find('css', '.form-builder-navbar__tab--active'); - $this->assertTrue($activeTab->hasClass('form-builder-navbar__tab--content'), 'The expected tab is active.'); - } - /** * Test that the form submission adds a chapter when not already present. */ diff --git a/tests/phpunit/va_gov_form_builder/functional/Form/StartConversionTest.php b/tests/phpunit/va_gov_form_builder/functional/Form/StartConversionTest.php index 53de9e642a..597fa905fa 100644 --- a/tests/phpunit/va_gov_form_builder/functional/Form/StartConversionTest.php +++ b/tests/phpunit/va_gov_form_builder/functional/Form/StartConversionTest.php @@ -55,14 +55,6 @@ public function testFormDoesNotLoad() { $this->sharedTestFormDoesNotLoad($this->getFormPageUrl()); } - /** - * Test that the active tab is correct. - */ - public function testActiveTab() { - $activeTab = $this->getSession()->getPage()->find('css', '.form-builder-navbar__tab--active'); - $this->assertTrue($activeTab->hasClass('form-builder-navbar__tab--forms'), 'The expected tab is active.'); - } - /** * Test that the form submission succeeds. * diff --git a/tests/phpunit/va_gov_form_builder/functional/templates/FormBuilderPageTemplateTest.php b/tests/phpunit/va_gov_form_builder/functional/templates/FormBuilderPageTemplateTest.php index 0e1e0d04b7..44c2395318 100644 --- a/tests/phpunit/va_gov_form_builder/functional/templates/FormBuilderPageTemplateTest.php +++ b/tests/phpunit/va_gov_form_builder/functional/templates/FormBuilderPageTemplateTest.php @@ -49,7 +49,7 @@ public function testExpectedElementsExist() { $containerElement = $this->cssSelect('.form-builder-page-container'); $this->assertCount(1, $containerElement); - $navbarElement = $this->cssSelect('.form-builder-navbar'); + $navbarElement = $this->cssSelect('.form-builder-subtitle'); $this->assertCount(1, $navbarElement); } From f8dd97b093fc77cec636bcf60227df78821aa97b Mon Sep 17 00:00:00 2001 From: Ryan Koch Date: Thu, 9 Jan 2025 14:03:56 -0600 Subject: [PATCH 2/2] Replace `div` with `p` on subtitle. --- .../templates/page--va-gov-form-builder.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docroot/modules/custom/va_gov_form_builder/templates/page--va-gov-form-builder.html.twig b/docroot/modules/custom/va_gov_form_builder/templates/page--va-gov-form-builder.html.twig index 51e898e704..fbc0fb433f 100644 --- a/docroot/modules/custom/va_gov_form_builder/templates/page--va-gov-form-builder.html.twig +++ b/docroot/modules/custom/va_gov_form_builder/templates/page--va-gov-form-builder.html.twig @@ -16,7 +16,7 @@

Form Builder

-
{{ page.form_builder_page_data.subtitle }}
+

{{ page.form_builder_page_data.subtitle }}