-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(UsaGraphicListRow): implement
UsaGraphicListRow
component
ISSUES CLOSED: #38
- Loading branch information
1 parent
635e8cf
commit 493d4f4
Showing
4 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
src/components/UsaGraphicListRow/UsaGraphicListRow.stories.js
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,50 @@ | ||
import UsaGraphicListRow from './UsaGraphicListRow.vue' | ||
|
||
const defaultProps = {} | ||
|
||
const slotContent = ` | ||
<div class="usa-media-block tablet:grid-col"> | ||
<img class="usa-media-block__img" src="/assets/img/circle-124.png" alt=""> | ||
<div class="usa-media-block__body"> | ||
<h2 class="usa-graphic-list__heading">Graphic headings can vary.</h2> | ||
<p>Graphic headings can be used a few different ways, depending on what your landing page is for. Highlight your values, specific program areas, or results.</p> | ||
</div> | ||
</div> | ||
<div class="usa-media-block tablet:grid-col"> | ||
<img class="usa-media-block__img" src="/assets/img/circle-124.png" alt=""> | ||
<div class="usa-media-block__body"> | ||
<h2 class="usa-graphic-list__heading">Stick to 6 or fewer words.</h2> | ||
<p>Keep body text to about 30 words. They can be shorter, but try to be somewhat balanced across all four. It creates a clean appearance with good spacing.</p> | ||
</div> | ||
</div> | ||
` | ||
|
||
export default { | ||
component: UsaGraphicListRow, | ||
title: 'Components/UsaGraphicListRow', | ||
argTypes: { | ||
defaultSlot: { | ||
control: { type: 'text' }, | ||
}, | ||
}, | ||
args: { | ||
defaultSlot: slotContent, | ||
}, | ||
} | ||
|
||
const DefaultTemplate = (args, { argTypes }) => ({ | ||
components: { UsaGraphicListRow }, | ||
props: Object.keys(argTypes), | ||
setup() { | ||
return { ...args } | ||
}, | ||
template: `<UsaGraphicListRow class="grid-row grid-gap">${args.defaultSlot}</UsaGraphicListRow>`, | ||
}) | ||
|
||
export const DefaultGraphicListRow = DefaultTemplate.bind({}) | ||
DefaultGraphicListRow.args = { | ||
...defaultProps, | ||
} | ||
DefaultGraphicListRow.storyName = 'Default' | ||
|
||
// TODO: Document grid and `usa-graphic-list__heading` classes needing to be added. |
15 changes: 15 additions & 0 deletions
15
src/components/UsaGraphicListRow/UsaGraphicListRow.test.js
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,15 @@ | ||
import '@module/uswds/dist/css/uswds.min.css' | ||
import { mount } from '@cypress/vue' | ||
import UsaGraphicListRow from './UsaGraphicListRow.vue' | ||
|
||
describe('UsaGraphicListRow', () => { | ||
it('renders the component', () => { | ||
mount(UsaGraphicListRow, { | ||
slots: { | ||
default: () => 'Test row', | ||
}, | ||
}) | ||
|
||
cy.get('.usa-graphic-list__row').should('contain', 'Test row') | ||
}) | ||
}) |
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,7 @@ | ||
<script></script> | ||
|
||
<template> | ||
<div class="usa-graphic-list__row"> | ||
<slot></slot> | ||
</div> | ||
</template> |
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,4 @@ | ||
import UsaGraphicListRow from './UsaGraphicListRow.vue' | ||
|
||
export { UsaGraphicListRow } | ||
export default UsaGraphicListRow |