-
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.
Merge branch 'main' into asteele-passthrough-tokens-1967
- Loading branch information
Showing
21 changed files
with
733 additions
and
147 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
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
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
99 changes: 99 additions & 0 deletions
99
packages/storybook/stories/va-pagination-uswds.stories.jsx
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,99 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import { getWebComponentDocs, propStructure, StoryDocs } from './wc-helpers'; | ||
|
||
const paginationDocs = getWebComponentDocs('va-pagination'); | ||
|
||
export default { | ||
title: 'USWDS/Pagination USWDS', | ||
id: 'uswds/va-pagination', | ||
parameters: { | ||
componentSubtitle: 'va-pagination web component', | ||
docs: { | ||
page: () => <StoryDocs data={paginationDocs} />, | ||
} | ||
} | ||
} | ||
|
||
const defaultArgs = { | ||
page: 1, | ||
pages: 24, | ||
'max-page-list-length': 7, | ||
unbounded: false | ||
} | ||
|
||
const Template = ({ | ||
page, | ||
pages, | ||
'max-page-list-length': maxPageListLength, | ||
unbounded | ||
}) => { | ||
return ( | ||
<va-pagination | ||
page={page} | ||
pages={pages} | ||
max-page-list-length={maxPageListLength} | ||
uswds | ||
unbounded={unbounded} /> | ||
); | ||
} | ||
|
||
export const Default = Template.bind(null); | ||
Default.args = { | ||
...defaultArgs, | ||
}; | ||
Default.argTypes = propStructure(paginationDocs); | ||
|
||
export const WithMiddle = Template.bind(null); | ||
WithMiddle.args = { | ||
...defaultArgs, page: 10 | ||
} | ||
|
||
export const WithLast = Template.bind(null); | ||
WithLast.args = { | ||
...defaultArgs, page: 24 | ||
} | ||
|
||
export const WithUnboundedFirst = Template.bind(null); | ||
WithUnboundedFirst.args = { | ||
...defaultArgs, unbounded: true | ||
} | ||
|
||
export const WithUnboundedMiddle = Template.bind(null); | ||
WithUnboundedMiddle.args = { | ||
...defaultArgs, unbounded: true, page: 10 | ||
} | ||
|
||
export const WithSevenOrLess = Template.bind(null); | ||
WithSevenOrLess.args = { | ||
...defaultArgs, pages: 7 | ||
} | ||
|
||
export const WithSevenOrLessMiddle = Template.bind(null); | ||
WithSevenOrLessMiddle.args = { | ||
...defaultArgs, pages: 7, page: 3 | ||
} | ||
|
||
export const WithSevenOrLessLast = Template.bind(null); | ||
WithSevenOrLessLast.args = { | ||
...defaultArgs, pages: 7, page: 7 | ||
} | ||
|
||
export const Internationalization = () => { | ||
const [lang, setLang] = useState('en'); | ||
|
||
useEffect(() => { | ||
document.querySelector('main').setAttribute('lang', lang); | ||
}, [lang]); | ||
|
||
return ( | ||
<div> | ||
<button onClick={e => setLang('es')}>Español</button> | ||
<button onClick={e => setLang('en')}>English</button> | ||
<div style={{ marginTop: '20px' }}> | ||
<h4>Default</h4> | ||
<va-pagination page="10" pages="24" uswds /> | ||
<h4>Unbounded</h4> | ||
<va-pagination page="10" pages="24" unbounded uswds /> | ||
</div> | ||
</div> | ||
)}; |
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
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
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
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
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
Oops, something went wrong.