From a399350f3b05be6b36b8a7bd1c1f34cbaaae5ad3 Mon Sep 17 00:00:00 2001 From: Natasha Pierre-Louis Date: Wed, 24 Apr 2024 22:48:37 -0600 Subject: [PATCH 1/5] Styled and updated the sections components --- packages/design/sass/styles.scss | 53 ++++++++++++++++++ .../components/Fieldset/Fieldset.stories.tsx | 9 +-- .../src/Form/components/Fieldset/index.tsx | 13 ++++- packages/design/src/Form/index.tsx | 2 +- .../FormEdit/AddPatternDropdown.tsx | 6 +- .../FormEdit/components/FieldsetEdit.tsx | 56 ++++++++++++++++--- .../FormEdit/components/FormSummaryEdit.tsx | 6 +- .../FormEdit/components/InputPatternEdit.tsx | 2 +- .../components/ParagraphPatternEdit.tsx | 8 +-- .../PreviewSequencePattern/DraggableList.tsx | 6 +- .../components/SubmissionConfirmationEdit.tsx | 12 ++-- .../components/common/PatternEditActions.tsx | 22 ++++---- .../design/src/FormManager/FormEdit/index.tsx | 14 +++-- .../FormManagerLayout/TopNavigation.tsx | 2 +- packages/forms/src/components.ts | 1 + packages/forms/src/patterns/fieldset.ts | 5 ++ 16 files changed, 164 insertions(+), 53 deletions(-) diff --git a/packages/design/sass/styles.scss b/packages/design/sass/styles.scss index 9359d3b7..8c1b937f 100644 --- a/packages/design/sass/styles.scss +++ b/packages/design/sass/styles.scss @@ -166,3 +166,56 @@ iframe:focus { padding-bottom: 62.5%; height: 0; } + +.usa-fieldset { + width: 100%; + + .usa-legend, + .usa-alert__text { + font-size: 1rem; + } + + .usa-legend { + font-weight: normal; + line-height: 1.5rem; + text-transform: uppercase; + } + + h3.section-heading-h3 { + font-size: 1.375rem; + padding-top: 0.5rem; + padding-bottom: 0.5rem; + } + + .usa-alert__text { + span { + display: inline-block; + vertical-align: top; + margin-right: 1rem; + } + } +} + +.edit-component-panel { + input, + select { + background: #f4f1f9; + font-weight: 700; + } +} + +.draggable-list-item-wrapper { + .draggable-list-item { + cursor: pointer; + } + .draggable-list-button { + cursor: 'grab'; + } +} + +.pattern-edit-panel { + .usa-button--unstyled { + color: #565C65; + + } +} diff --git a/packages/design/src/Form/components/Fieldset/Fieldset.stories.tsx b/packages/design/src/Form/components/Fieldset/Fieldset.stories.tsx index 9e435e3f..2e6bc14e 100644 --- a/packages/design/src/Form/components/Fieldset/Fieldset.stories.tsx +++ b/packages/design/src/Form/components/Fieldset/Fieldset.stories.tsx @@ -8,17 +8,18 @@ export default { tags: ['autodocs'], } satisfies Meta; -export const FieldsetSection1 = { +export const FieldsetSectionWithSubheader = { args: { - legend: 'Section 1', + legend: 'Default Heading', + subheader: 'Default Subhead', type: 'fieldset', _patternId: 'test-id', }, } satisfies StoryObj; -export const FieldsetSection2 = { +export const FieldsetSectionWithoutSubheader = { args: { - legend: 'Section 2', + legend: 'Default Heading', type: 'fieldset', _patternId: 'test-id', }, diff --git a/packages/design/src/Form/components/Fieldset/index.tsx b/packages/design/src/Form/components/Fieldset/index.tsx index 5a622daa..4b5541c1 100644 --- a/packages/design/src/Form/components/Fieldset/index.tsx +++ b/packages/design/src/Form/components/Fieldset/index.tsx @@ -6,9 +6,16 @@ import { type PatternComponent } from '../../../Form'; const Fieldset: PatternComponent = props => { return ( -
- {props.legend} - {props.children} +
+ {props.legend !== '' && props.legend !== undefined && ( + {props.legend} + )} + + {props.subheader !== '' && props.subheader !== undefined && ( +

{props.subheader}

+ )} + + {props.children}
); }; diff --git a/packages/design/src/Form/index.tsx b/packages/design/src/Form/index.tsx index a821467f..a24caea7 100644 --- a/packages/design/src/Form/index.tsx +++ b/packages/design/src/Form/index.tsx @@ -137,7 +137,7 @@ export default function Form({ )} -
+
{!isPreview ? (
{ })); return ( -
-
+
+ +
+ {/*
*/}
); }; -export default FieldsetEdit; +export default FieldsetEdit; \ No newline at end of file diff --git a/packages/design/src/FormManager/FormEdit/components/FormSummaryEdit.tsx b/packages/design/src/FormManager/FormEdit/components/FormSummaryEdit.tsx index ebe3dfe4..087362ca 100644 --- a/packages/design/src/FormManager/FormEdit/components/FormSummaryEdit.tsx +++ b/packages/design/src/FormManager/FormEdit/components/FormSummaryEdit.tsx @@ -32,8 +32,8 @@ const FormSummaryEdit: PatternEditComponent = props => { const EditComponent = ({ patternId }: { patternId: PatternId }) => { const { register } = usePatternEditFormContext(); return ( -
-
+
+
-
+
diff --git a/packages/design/src/FormManager/FormEdit/components/InputPatternEdit.tsx b/packages/design/src/FormManager/FormEdit/components/InputPatternEdit.tsx index 1d8a301a..790bb79a 100644 --- a/packages/design/src/FormManager/FormEdit/components/InputPatternEdit.tsx +++ b/packages/design/src/FormManager/FormEdit/components/InputPatternEdit.tsx @@ -41,7 +41,7 @@ const EditComponent = ({ patternId }: { patternId: PatternId }) => { Field label { Default field value { Maximum length { Field type {