Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
e16f5fa
content: Updated Step2 denied domain error message
shindigira Jan 12, 2024
41c8a69
content: updated content text regarding input field description text
shindigira Jan 12, 2024
4fe05cd
style: accesibility changed to entirely around FI group
shindigira Jan 17, 2024
5b786c9
style: removed interferring styles
shindigira Jan 17, 2024
cda6a6a
fix: trim leading and trailing white space
shindigira Jan 17, 2024
077ff53
chore: set default string empty
shindigira Jan 17, 2024
c07cc4b
chore: created a SectionIntro
shindigira Jan 17, 2024
864db06
chore: reformatted SectionIntro
shindigira Jan 17, 2024
10f64ca
Merge branch 'main' of github.com:cfpb/sbl-frontend into 85-part-2
shindigira Jan 18, 2024
98213e7
chore: defensive coding
shindigira Jan 18, 2024
42f238e
chore: removed unused code
shindigira Jan 18, 2024
f60e46b
style: added href to allow cursor:pointer on error links
shindigira Jan 19, 2024
4bf7005
chore: added eslint ignore exception
shindigira Jan 19, 2024
04a86a8
style: temp red border usage around checkbox
shindigira Jan 19, 2024
de6ec46
chore: revert step1formerrorheader messages
shindigira Jan 22, 2024
7b6e206
Merge branch 'main' of github.com:cfpb/sbl-frontend into 85-part-2
shindigira Jan 24, 2024
e447867
feat: Updated DSR with Checkbox status stylings
shindigira Jan 24, 2024
201a18b
Merge branch 'main' of github.com:cfpb/sbl-frontend into 85-part-2
shindigira Jan 25, 2024
97f5545
fix: Clear Form no longer unmounts Associated Financial Data
shindigira Jan 26, 2024
b462a63
chore: removed comment
shindigira Jan 26, 2024
6694cb7
style(fix): added -15px negative margin -- 45px below TextIntroduction
shindigira Jan 26, 2024
ce661c0
Revert "style(fix): added -15px negative margin -- 45px below TextInt…
shindigira Jan 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
352 changes: 146 additions & 206 deletions .pnp.cjs

Large diffs are not rendered by default.

14 changes: 6 additions & 8 deletions src/components/FieldGroup.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
interface FieldGroupProperties {
children: ReactNode
children: ReactNode;
}

function FieldGroup({ children }: FieldGroupProperties): JSX.Element {
return (
<div
className="bg-[#F7F8F9] p-[1.875rem] !border !border-solid !border-cfpbBorderColor"
>
{children}
</div>
)
<div className='max-w-[48.125rem] !border !border-solid !border-cfpbBorderColor bg-[#F7F8F9] p-[1.875rem]'>
{children}
</div>
);
}

export default FieldGroup;
export default FieldGroup;
15 changes: 7 additions & 8 deletions src/components/FormParagraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ interface FormParagraphProperties {
}

/**
*
*
* @returns FormParagraph
*/
function FormParagraph({ children, className}: FormParagraphProperties): JSX.Element {
return (
<p className={`max-w-[41.875rem] ${className}`}>
{children}
</p>
)
function FormParagraph({
children,
className = '',
}: FormParagraphProperties): JSX.Element {
return <p className={`max-w-[41.875rem] ${className}`}>{children}</p>;
}

export default FormParagraph;
export default FormParagraph;
2 changes: 1 addition & 1 deletion src/components/InputErrorMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function InputErrorMessage({
children,
}: InputErrorMessageProperties): JSX.Element {
return (
<div className='mt-[0.9375rem]'>
<div className='mt-[0.9375rem] max-w-[41.875rem]'>
<AlertFieldLevel message={children} status='error' />
</div>
);
Expand Down
21 changes: 21 additions & 0 deletions src/components/SectionIntro.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Heading } from 'design-system-react';
import FormParagraph from 'components/FormParagraph';

interface SectionIntroProperties {
heading: ReactNode;
children: ReactNode;
}

function SectionIntro({
heading = '',
children = '',
}: SectionIntroProperties): JSX.Element {
return (
<div className='mb-[1.625rem] max-w-[48.125rem]'>
<Heading type='2'>{heading}</Heading>
<FormParagraph>{children}</FormParagraph>
</div>
);
}

export default SectionIntro;
19 changes: 0 additions & 19 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,4 @@ https://v1.tailwindcss.com/docs/adding-base-styles#using-css */
&:hover {
color: #2284d5;
}
}

[type='text']:focus {
box-shadow: none;
}

:focus:not(#financialInstitutions) {
outline: 1px dotted #0072ce !important;
outline-offset: 3px;
}

/* Checkbox Border error styling - workaround */
.m-form-field__checkbox.error-checkbox .a-label::before, .m-form-field__radio .a-label::before {
@apply !border-errorColor !border-2
}

/* Workaround for styling the institution details on Profile-Form */
.m-form-field__checkbox .invisible::before {
visibility: hidden;
}
2 changes: 1 addition & 1 deletion src/pages/Filing/InstitutionDetails/PageIntro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function PageIntro(): JSX.Element {
}
callToAction={
<List isLinks>
<ListItem className='m-list_link'>
<ListItem>
<Links.UpdateInstitutionProfile isCallToAction />
</ListItem>
</List>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,10 @@ function AssociatedFinancialInstitution({
<div key={fiObject.lei}>
<Checkbox
id={`${fiObject.name} ${fiObject.lei}`}
className={`${hasError ? 'error-checkbox' : ''}`}
className={`${hasError ? 'm-form-field__checkbox__error' : ''}`}
label={
<div className=''>
<Paragraph className='font-medium'>{fiObject.name}</Paragraph>
</div>
}
checked={fiObject.checked}
name={fiObject.lei}
onChange={onCheckHandler}
{...rest}
/>
<Checkbox
id={`${fiObject.name} ${fiObject.lei}`}
labelClassName='invisible'
label={
<div className='visible'>
<div>
<Paragraph className='mb-0 font-medium'>{fiObject.name}</Paragraph>
<Paragraph className='mb-0'>LEI: {fiObject.lei}</Paragraph>
<Paragraph className='mb-0'>TIN: {fiObject.tax_id}</Paragraph>
{fiObject.rssd_id ? (
Expand All @@ -50,6 +38,10 @@ function AssociatedFinancialInstitution({
) : null}
</div>
}
checked={fiObject.checked}
name={fiObject.lei}
onChange={onCheckHandler}
{...rest}
/>
</div>
);
Expand Down
35 changes: 14 additions & 21 deletions src/pages/ProfileForm/Step1Form/Step1Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import AssociatedFinancialInstitutions from './AssociatedFinancialInstitutions';
import NoDatabaseResultError from './NoDatabaseResultError';
import FormParagraph from 'components/FormParagraph';
import FieldGroup from 'components/FieldGroup';
import SectionIntro from 'components/SectionIntro';

import { Button, Link, Paragraph, Heading } from 'design-system-react';

Expand Down Expand Up @@ -51,7 +52,7 @@ function Step1Form(): JSX.Element {
const {
isLoading,
isError,
data: afData,
data: afData = [],
} = useQuery({
queryKey: [`fetch-institutions-${emailDomain}`, emailDomain],
queryFn: async () => fetchInstitutions(auth, emailDomain),
Expand Down Expand Up @@ -106,7 +107,7 @@ function Step1Form(): JSX.Element {

for (const object of checkedListStateArray) {
if (object.checked) {
const foundObject: InstitutionDetailsApiType = afData?.find(
const foundObject: InstitutionDetailsApiType = afData.find(
institutionsObject => object.lei === institutionsObject.lei,
);
newFinancialInstitutions.push(foundObject);
Expand Down Expand Up @@ -188,19 +189,16 @@ function Step1Form(): JSX.Element {
<div className='mb-[3.75rem] mt-[2.84375rem]'>
<Step1FormHeader />
</div>
<div className='mb-[1.875rem] mt-[2.8125rem] w-full'>
<div className='mb-[2.8125rem] mt-[2.8125rem] w-full'>
<Element name='step1FormErrorHeader' id='step1FormErrorHeader'>
<Step1FormErrorHeader errors={formErrors} />
</Element>
</div>
<div className='mb-[1.625rem] mt-[2.8125rem]'>
<Heading type='2'>Provide your identifying information</Heading>
<FormParagraph>
Type your first name and last name in the fields below. Your email
address is automatically populated from{' '}
<Link href='#'>Login.gov</Link>.
</FormParagraph>
</div>
<SectionIntro heading='Provide your identifying information'>
{' '}
Type your first name and last name in the fields below. Your email
address is automatically populated from <Link href='#'>Login.gov</Link>.
</SectionIntro>
<form onSubmit={handleSubmit(onSubmit)}>
<div className='mb-[3.75rem]'>
<FieldGroup>
Expand Down Expand Up @@ -237,16 +235,11 @@ function Step1Form(): JSX.Element {
<Element name='financialInstitutions'>
{isSalesforce ? null : (
<>
<div className='mb-[1.625rem]'>
<Heading type='2'>
Select the institution you are authorized to file for
</Heading>
<FormParagraph>
If there is a match between your email domain and the email
domain of a financial institution in our system you will see a
list of matches below.
</FormParagraph>
</div>
<SectionIntro heading='Select the institution you are authorized to file for'>
If there is a match between your email domain and the email
domain of a financial institution in our system you will see a
list of matches below.
</SectionIntro>
<FieldGroup>
<AssociatedFinancialInstitutions
errors={formErrors}
Expand Down
43 changes: 21 additions & 22 deletions src/pages/ProfileForm/Step1Form/Step1FormErrorHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Alert, List } from 'design-system-react';
/* eslint-disable jsx-a11y/anchor-is-valid */
import { Alert, List, ListItem } from 'design-system-react';
import { Link } from 'react-scroll';

import { FormFieldsHeaderError as formFieldsHeaderError } from 'pages/ProfileForm/types';
Expand Down Expand Up @@ -43,27 +44,25 @@ function Step1FormErrorHeader({
};

return (
<span key={key}>
{/* Uses the ListLink styling */}
<li className='m-list_item'>
<Link
className='m-list_link'
to={key}
smooth
duration={300}
offset={-100}
onClick={onHandleFocus}
onKeyPress={onHandleKeyPress}
tabIndex={0}
>
{
formFieldsHeaderError[
key as keyof typeof formFieldsHeaderError
]
}
</Link>
</li>
</span>
<ListItem key={key}>
<Link
href='#'
className='m-list_link'
to={key}
smooth
duration={300}
offset={-100}
onClick={onHandleFocus}
onKeyPress={onHandleKeyPress}
tabIndex={0}
>
{
formFieldsHeaderError[
key as keyof typeof formFieldsHeaderError
]
}
</Link>
</ListItem>
);
})}
</List>
Expand Down
64 changes: 9 additions & 55 deletions src/pages/ProfileForm/Step2Form/Step2Form.tsx
Original file line number Diff line number Diff line change
@@ -1,71 +1,25 @@
import { useEffect } from 'react';
import useProfileForm from "store/useProfileForm";
import useProfileForm from 'store/useProfileForm';

import { Link, Alert } from 'design-system-react';
import Step2FormHeader from './Step2FormHeader';

import { Step2FormHeaderMessages } from './Step2FormHeader.data';

interface Properties {
}
interface Properties {}

function Step2Form({}: Properties): JSX.Element {
const selectedScenario = useProfileForm((state) => state.selectedScenario);
useEffect(()=>{
window.scrollTo({ top: 0});
const selectedScenario = useProfileForm(state => state.selectedScenario);

useEffect(() => {
window.scrollTo({ top: 0 });
}, []);

return (
<div id="step2form">
<div id='step2form'>
<Step2FormHeader scenario={selectedScenario} />
</div>
)
);
}

export default Step2Form;

function randomIntFromInterval(min, max) { // min and max included
return Math.floor(Math.random() * (max - min + 1) + min)
}

function SummaryProfile({}: Properties): JSX.Element {
const profileData = useProfileForm((state) => state.profileData);

console.log("Step 2 Form profileData:", profileData);

return (
<>
<h3 className='mb-[30px]'>User profile details</h3>
<div className='mb-[30px]'>
<h4 className="mb-2">First name</h4>
<p>{profileData.firstName}</p>
</div>
<div className='mb-[30px]'>
<h4 className="mb-2">Last name</h4>
<p>{profileData.lastName}</p>
</div>
<div className='mb-[30px]'>
<h4 className="mb-2">Email address</h4>
<p>{profileData.email}</p>
</div>
<div className='mb-[30px]'>
<h4 className="mb-2">Associated financial institution(s)</h4>
{profileData ? profileData.financialInstitutions.map(object => {
const success = Boolean(randomIntFromInterval(0, 1));
return (
<div key={object.lei} className='mb-2 flex flex-row gap-[0.9375rem]'>
<div className="min-w-[6.25rem]">
<Alert isFieldLevel status={ success ? "success" : "warning"} message={ success ? "Approved" : "Pending"} />
</div>
<Link className="border-b" href="#">{`${object.name} | ${object.lei}`}</Link>
</div>
)
})
:
null
}
</div>
</>
);
}
5 changes: 5 additions & 0 deletions src/pages/ProfileForm/Step2Form/Step2FormHeader.data.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { Link } from 'design-system-react';

export enum ScenarioHeader {
Error = 'Unable to complete your user profile',
Status = 'User profile submission status',
}

export enum Scenario {
// Success1,
// Warning1,
Expand Down
Loading