From bd06d3e15b4275389e7d442450a1c70e13825ce1 Mon Sep 17 00:00:00 2001 From: Jordan Willis <31868510+will0684@users.noreply.github.com> Date: Wed, 17 Jan 2024 15:00:09 -0500 Subject: [PATCH] Consolidate Design System Components (#960) * setup jsconfig to support finding file references in vscode * consolidate components from design-system * properly format component paths in design-system component stories * Add resources for stories and tests * integrate DSButton styling with SCLabs styling * remove duplicate CallToAction.js * various fixes to stories, unit tests and styling * move default brandLinks story prop to Footer.js default props * fix vertical alignment of text in DSButton supertask state * add missing axe check in Footer unit test * fix SubFooterBand margin-left * fix Footer unit test --- .../Button.jsx => atoms/DSButton.js} | 44 +++- components/atoms/DSButton.stories.js | 61 ++++++ components/atoms/DSButton.test.js | 69 +++++++ .../Image.jsx => atoms/Image.js} | 0 components/atoms/Image.stories.js | 41 ++++ components/atoms/Image.test.js | 47 +++++ .../{design-system/Link.jsx => atoms/Link.js} | 2 + components/atoms/Link.stories.js | 56 ++++++ components/atoms/Link.test.js | 99 +++++++++ components/atoms/ProjectInfo.js | 2 +- components/design-system/Footer.jsx | 144 -------------- .../fragment_components/ArticleCTA.js | 2 +- .../CTA.jsx => molecules/CTA.js} | 8 +- components/molecules/CTA.stories.js | 30 +++ components/molecules/CTA.test.js | 25 +++ components/molecules/CallToAction.js | 120 ----------- components/molecules/CallToAction.stories.js | 25 --- components/molecules/CallToAction.test.js | 38 ---- .../Collapse.jsx => molecules/Collapse.js} | 0 components/molecules/Collapse.stories.js | 36 ++++ components/molecules/Collapse.test.js | 42 ++++ .../ContextualAlert.js} | 0 .../molecules/ContextualAlert.stories.js | 70 +++++++ components/molecules/ContextualAlert.test.js | 34 ++++ .../Heading.jsx => molecules/Heading.js} | 0 components/molecules/Heading.stories.js | 23 +++ components/molecules/Heading.test.js | 31 +++ .../MainBand.jsx => molecules/MainBand.js} | 2 +- .../SubFooterBand.js} | 33 ++- components/organisms/Footer.js | 188 +++++++++--------- components/organisms/Footer.stories.js | 84 +------- components/organisms/Footer.test.js | 35 ++-- .../HelpIcon.jsx => organisms/HelpIcon.js} | 4 +- components/organisms/HelpIcon.stories.js | 31 +++ components/organisms/HelpIcon.test.js | 19 ++ components/organisms/Layout.js | 32 +-- jsconfig.json | 9 + pages/home.js | 4 +- pages/projects/benefits-navigator/[id].js | 2 +- pages/projects/benefits-navigator/index.js | 4 +- pages/projects/dashboard/index.js | 4 +- .../digital-standards-playbook/index.js | 2 +- pages/projects/oas-benefits-estimator/[id].js | 2 +- .../projects/oas-benefits-estimator/index.js | 3 +- public/image1.png | Bin 0 -> 979895 bytes public/image2.png | Bin 0 -> 169907 bytes public/plus.svg | 3 + 47 files changed, 932 insertions(+), 578 deletions(-) rename components/{design-system/Button.jsx => atoms/DSButton.js} (68%) create mode 100644 components/atoms/DSButton.stories.js create mode 100644 components/atoms/DSButton.test.js rename components/{design-system/Image.jsx => atoms/Image.js} (100%) create mode 100644 components/atoms/Image.stories.js create mode 100644 components/atoms/Image.test.js rename components/{design-system/Link.jsx => atoms/Link.js} (97%) create mode 100644 components/atoms/Link.stories.js create mode 100644 components/atoms/Link.test.js delete mode 100644 components/design-system/Footer.jsx rename components/{design-system/CTA.jsx => molecules/CTA.js} (88%) create mode 100644 components/molecules/CTA.stories.js create mode 100644 components/molecules/CTA.test.js delete mode 100644 components/molecules/CallToAction.js delete mode 100644 components/molecules/CallToAction.stories.js delete mode 100644 components/molecules/CallToAction.test.js rename components/{design-system/Collapse.jsx => molecules/Collapse.js} (100%) create mode 100644 components/molecules/Collapse.stories.js create mode 100644 components/molecules/Collapse.test.js rename components/{design-system/ContextualAlert.jsx => molecules/ContextualAlert.js} (100%) create mode 100644 components/molecules/ContextualAlert.stories.js create mode 100644 components/molecules/ContextualAlert.test.js rename components/{design-system/Heading.jsx => molecules/Heading.js} (100%) create mode 100644 components/molecules/Heading.stories.js create mode 100644 components/molecules/Heading.test.js rename components/{design-system/MainBand.jsx => molecules/MainBand.js} (97%) rename components/{design-system/SubFooterBand.jsx => molecules/SubFooterBand.js} (81%) rename components/{design-system/HelpIcon.jsx => organisms/HelpIcon.js} (98%) create mode 100644 components/organisms/HelpIcon.stories.js create mode 100644 components/organisms/HelpIcon.test.js create mode 100644 jsconfig.json create mode 100644 public/image1.png create mode 100644 public/image2.png create mode 100644 public/plus.svg diff --git a/components/design-system/Button.jsx b/components/atoms/DSButton.js similarity index 68% rename from components/design-system/Button.jsx rename to components/atoms/DSButton.js index 65eaeb3d84..e5cf722d72 100644 --- a/components/design-system/Button.jsx +++ b/components/atoms/DSButton.js @@ -1,11 +1,37 @@ import PropTypes from "prop-types"; import { Image } from "./Image"; -export function Button(props) { - const style = "btn-" + props.styling; +// Button used in HelpIcon.js and CTA.js +// Use ActionButton.js for all other buttons in the app +export function DSButton(props) { + //Styling for buttons and links + const PRIMARY = + "text-multi-neutrals-white bg-multi-blue-blue70 hover:bg-multi-blue-blue60g focus:bg-multi-blue-blue60g"; + const SECONDARY = + "text-multi-blue-blue60b bg-multi-neutrals-grey30a hover:bg-multi-neutrals-grey50a focus:bg-multi-neutrals-grey60"; + const SUPERTASK = + "text-multi-neutrals-white bg-specific-green-green50 hover:bg-specific-green-green70 focus:bg-sepcific-green-green70"; + const DANGER = + "text-multi-neutrals-white bg-specific-red-red50 hover:bg-specific-red-red70 focus:bg-specific-red-red70"; + const LINK = + "text-multi-blue-blue60c hover:text-multi-blue-blue50b focus:text-multi-blue-blue60f"; + + const styling = + props.styling === "primary" + ? PRIMARY + : props.styling === "secondary" + ? SECONDARY + : props.styling === "supertask" + ? SUPERTASK + : props.styling === "danger" + ? DANGER + : props.styling === "link" + ? LINK + : ""; + return props.href === "no ref" ? (