-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial build of service-list web component. Added Storybook and e2e …
…test.
- Loading branch information
Belle P
authored and
Belle P
committed
Jan 31, 2025
1 parent
23cb016
commit 2b710e0
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import React from 'react'; | ||
import { getWebComponentDocs, propStructure, StoryDocs } from './wc-helpers'; | ||
|
||
const serviceListDocs = getWebComponentDocs('va-service-list'); | ||
|
||
export default { | ||
title: 'Components/Service list', | ||
id: 'components/va-service-list', | ||
parameters: { | ||
componentSubtitle: 'va-service-list web component', | ||
docs: { | ||
page: () => <StoryDocs storyDefault={Default} data={serviceListDocs} />, | ||
}, | ||
}, | ||
}; | ||
|
||
const Template = (args) => { | ||
const ref = React.useRef(null); | ||
const { serviceDetails, icon, serviceName, serviceStatus, action, optionalLink } = args | ||
|
||
React.useEffect(() => { | ||
if (ref.current) { | ||
Object.entries(args).forEach(([key, value]) => { | ||
ref.current[key] = value; | ||
}); | ||
} | ||
}, [args]); | ||
|
||
return ( | ||
<va-service-list | ||
ref={ref} | ||
key={JSON.stringify(args)} | ||
serviceDetails={JSON.stringify(serviceDetails)} | ||
icon={icon} | ||
serviceName={serviceName} | ||
serviceStatus={serviceStatus} | ||
action={JSON.stringify(action)} | ||
optionalLink={optionalLink} | ||
/> | ||
); | ||
}; | ||
|
||
|
||
export const Default = Template.bind({}); | ||
Default.args = { | ||
serviceDetails: { | ||
'Approved on': 'May 5, 2011', | ||
'Program': 'Post-9/11 GI Bill', | ||
'Eligibility': '70%', | ||
}, | ||
icon: 'school', | ||
serviceName: 'Education', | ||
serviceStatus: 'Eligible', | ||
action: { href: 'https://www.va.gov/education', text: 'Verify income' }, | ||
optionalLink: 'https://www.va.gov', | ||
}; | ||
Default.argTypes = propStructure(serviceListDocs); |