Skip to content

Commit

Permalink
Initial build of service-list web component. Added Storybook and e2e …
Browse files Browse the repository at this point in the history
…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.
57 changes: 57 additions & 0 deletions packages/storybook/stories/va-service-list.stories.jsx
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);

0 comments on commit 2b710e0

Please sign in to comment.