Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update visual progress indicator #490

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ const meta: Meta<typeof FormManagerLayout> = {
export default meta;
export const Configure = {
args: {
step: NavPage.configure,
step: NavPage.settings,
next: '#',
},
} satisfies StoryObj<typeof FormManagerLayout>;

export const Create = {
export const Edit = {
args: {
step: NavPage.create,
step: NavPage.edit,
next: '#',
back: '#',
preview: '#',
Expand All @@ -55,12 +55,3 @@ export const Publish = {
preview: '#',
},
} satisfies StoryObj<typeof FormManagerLayout>;

export const Upload = {
args: {
step: NavPage.upload,
next: '#',
back: '#',
preview: '#',
},
} satisfies StoryObj<typeof FormManagerLayout>;
32 changes: 10 additions & 22 deletions packages/design/src/FormManager/FormManagerLayout/TopNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ import { useFormManagerStore } from '../store.js';
import styles from './formManagerStyles.module.css';

export enum NavPage {
upload = 1,
create = 2,
configure = 3,
publish = 4,
preview = 5,
edit = 1,
settings = 2,
publish = 3,
preview = 4,
}

const stepClass = (page: NavPage, curPage: NavPage) => {
Expand Down Expand Up @@ -66,35 +65,25 @@ export const TopNavigation = ({
<MyFormsLink uswdsRoot={uswdsRoot} />
</div>
<ol className="usa-step-indicator__segments desktop:grid-col-6 tablet:grid-col-5">
<li
className={classNames(
'usa-step-indicator__segment',
stepClass(NavPage.upload, curPage)
)}
>
<span className="usa-step-indicator__segment-label">
Upload {srHint(NavPage.upload, curPage)}
</span>
</li>
<li
className={classNames(
'usa-step-indicator__segment font-body-xs',
stepClass(NavPage.create, curPage)
stepClass(NavPage.edit, curPage)
)}
>
<span className="usa-step-indicator__segment-label">
Create {srHint(NavPage.create, curPage)}
Edit {srHint(NavPage.edit, curPage)}
</span>
</li>
<li
className={classNames(
'usa-step-indicator__segment font-body-xs',
stepClass(NavPage.configure, curPage)
stepClass(NavPage.settings, curPage)
)}
aria-current="true"
>
<span className="usa-step-indicator__segment-label">
Configure {srHint(NavPage.configure, curPage)}
Settings {srHint(NavPage.settings, curPage)}
</span>
</li>
<li
Expand Down Expand Up @@ -191,9 +180,8 @@ const MobileStepIndicator = ({ curPage }: { curPage: NavPage }) => (
id="options"
defaultValue={curPage}
>
<option value={NavPage.upload}>Upload</option>
<option value={NavPage.create}>Create</option>
<option value={NavPage.configure}>Configure</option>
<option value={NavPage.edit}>Edit</option>
<option value={NavPage.settings}>Settings</option>
<option value={NavPage.publish}>Publish</option>
</select>
</div>
Expand Down
4 changes: 2 additions & 2 deletions packages/design/src/FormManager/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export default function FormManager(props: FormManagerProps) {
savePeriodically={true}
>
<FormManagerLayout
step={NavPage.create}
step={NavPage.edit}
back={AppRoutes.GuidedFormCreation.getUrl()}
next={AppRoutes.Configure.getUrl(formId)}
preview={AppRoutes.Preview.getUrl(formId)}
Expand Down Expand Up @@ -201,7 +201,7 @@ export default function FormManager(props: FormManagerProps) {
session={createFormSession(form)}
>
<FormManagerLayout
step={NavPage.configure}
step={NavPage.settings}
back={AppRoutes.Create.getUrl(formId)}
next={AppRoutes.Publish.getUrl(formId)}
preview={AppRoutes.Preview.getUrl(formId)}
Expand Down