-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
46 changed files
with
2,381 additions
and
393 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: Auto approve | ||
|
||
on: pull_request | ||
|
||
jobs: | ||
auto-approve: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: hmarr/auto-approve-action@v2.0.0 | ||
if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]' | ||
with: | ||
github-token: '${{ secrets.GITHUB_TOKEN }}' |
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,40 @@ | ||
name: Deploy Storybook | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
deploy-storybook: | ||
runs-on: ubuntu-latest | ||
name: Deploy Storybook | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up node | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: '10.x' | ||
|
||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
|
||
- uses: actions/cache@v1 | ||
id: yarn-cache | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- name: Install dependencies | ||
if: steps.yarn-cache.outputs.cache-hit != 'true' | ||
run: yarn install | ||
|
||
- name: Deploy Storybook to Github page | ||
run: yarn storybook:deploy --ci | ||
env: | ||
GH_TOKEN: trussworks:${{ secrets.GITHUB_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
{ | ||
"plugins": ["stylelint-prettier"], | ||
"plugins": ["stylelint-scss", "stylelint-prettier"], | ||
"rules": { | ||
"at-rule-no-unknown": null, | ||
"scss/at-rule-no-unknown": true, | ||
"prettier/prettier": true, | ||
"selector-class-pattern": "" | ||
}, | ||
"extends": ["stylelint-config-recommended", "stylelint-prettier/recommended", "stylelint-config-sass-guidelines"], | ||
"extends": ["stylelint-config-recommended", "stylelint-prettier/recommended", "stylelint-config-sass-guidelines", "stylelint-config-css-modules"], | ||
} |
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
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,21 @@ | ||
import React from 'react' | ||
import { SearchInput } from './SearchInput' | ||
|
||
export default { | ||
title: 'SearchInput', | ||
parameters: { | ||
info: ` | ||
USWDS 2.0 SearchInput component | ||
Source: https://designsystem.digital.gov/components/header/ | ||
`, | ||
}, | ||
} | ||
|
||
const mockSubmit = (): void => { | ||
/* mock submit fn */ | ||
} | ||
|
||
export const defaultSearchInput = (): React.ReactElement => ( | ||
<SearchInput onSubmit={mockSubmit}></SearchInput> | ||
) |
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,24 @@ | ||
import React from 'react' | ||
import { render, fireEvent } from '@testing-library/react' | ||
|
||
import { SearchInput } from './SearchInput' | ||
|
||
describe('SearchInput component', () => { | ||
it('renders without errors', () => { | ||
const mockSubmit = jest.fn() | ||
const { queryByTestId } = render( | ||
<SearchInput onSubmit={mockSubmit}></SearchInput> | ||
) | ||
expect(queryByTestId('searchInput')).toBeInTheDocument() | ||
}) | ||
|
||
it('implements an onSubmit handler', () => { | ||
const mockSubmit = jest.fn() | ||
const { getByTestId } = render( | ||
<SearchInput onSubmit={mockSubmit}></SearchInput> | ||
) | ||
|
||
fireEvent.submit(getByTestId('searchInput')) | ||
expect(mockSubmit).toHaveBeenCalledTimes(1) | ||
}) | ||
}) |
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,38 @@ | ||
import React from 'react' | ||
import classnames from 'classnames' | ||
|
||
interface SearchInputProps { | ||
onSubmit?: (event: React.FormEvent<HTMLFormElement>) => void | ||
className?: string | ||
} | ||
|
||
export const SearchInput = ( | ||
props: SearchInputProps & React.FormHTMLAttributes<HTMLFormElement> | ||
): React.ReactElement => { | ||
const { onSubmit, className, ...formProps } = props | ||
const classes = classnames('usa-search usa-search--small', className) | ||
|
||
return ( | ||
<form | ||
data-testid="searchInput" | ||
className={classes} | ||
role="search" | ||
onSubmit={onSubmit} | ||
{...formProps}> | ||
<label className="usa-sr-only" htmlFor="basic-search-field-small"> | ||
Search small | ||
</label> | ||
<input | ||
className="usa-input" | ||
id="basic-search-field-small" | ||
type="search" | ||
name="search" | ||
/> | ||
<button className="usa-button" type="submit"> | ||
<span className="usa-sr-only">Search</span> | ||
</button> | ||
</form> | ||
) | ||
} | ||
|
||
export default SearchInput |
Oops, something went wrong.