-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(feature): added packages from av-react to public
- Loading branch information
1 parent
afa8b25
commit 2c32cf3
Showing
118 changed files
with
8,620 additions
and
16,656 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,44 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
function AppIcon({ | ||
tag: Tag, | ||
color, | ||
size, | ||
branded, | ||
className, | ||
children, | ||
...props | ||
}) { | ||
const classname = [ | ||
className, | ||
'app-icon', | ||
branded ? `app-icon-branded-${color}` : `app-icon-${color}`, | ||
size && `app-icon-${size}`, | ||
] | ||
.filter(a => a) | ||
.join(' '); | ||
|
||
return ( | ||
<Tag {...props} className={classname}> | ||
{children} | ||
{branded && <span className="caret" />} | ||
</Tag> | ||
); | ||
} | ||
|
||
AppIcon.propTypes = { | ||
color: PropTypes.string, | ||
size: PropTypes.string, | ||
branded: PropTypes.bool, | ||
className: PropTypes.string, | ||
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]), | ||
children: PropTypes.node, | ||
}; | ||
|
||
AppIcon.defaultProps = { | ||
tag: 'span', | ||
color: 'black', | ||
}; | ||
|
||
export default AppIcon; |
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,41 @@ | ||
# @availity/app-icon | ||
|
||
> Availity UI Kit application icon react component. | ||
## Installation | ||
|
||
```bash | ||
npm install @availity/app-icon --save | ||
``` | ||
|
||
### Usage | ||
|
||
```javascript | ||
import React from 'react'; | ||
import AppIcon from '@availity/app-icon'; | ||
// ... | ||
<AppIcon> | ||
{/* ... */} | ||
</AppIcon> | ||
// ... | ||
``` | ||
|
||
#### AppIcon (Default export) | ||
A component which outputs one of the "App Icons" from [Availity UI Kit](http://availity.github.io/availity-uikit/v3/components#App-Icons) | ||
|
||
##### Props | ||
|
||
- **`size`**: string, optional. Potential values: `"lg"`, `"xl"` | ||
- **`color`**: string, optional. Potential values: `"black"`, `"blue"`, `"green"`, `"orange"`. Default value: `"black"` | ||
- **`branded`**: boolean, optional. Triggers "branded" styles. | ||
- All other props will be passed through; `className` will be merged. | ||
|
||
##### Usage | ||
|
||
```javascript | ||
import React from 'react'; | ||
import AppIcon from '@availity/app-icon'; | ||
// ... | ||
<AppIcon title="Payer Space" color="green" branded size="xl">PS</AppIcon> | ||
// ... | ||
``` |
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,3 @@ | ||
import AppIcon from './AppIcon'; | ||
|
||
export default AppIcon; |
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,30 @@ | ||
{ | ||
"name": "@availity/app-icon", | ||
"version": "1.0.0", | ||
"author": "Evan Sharp <evan.sharp@availity.com>", | ||
"description": "Availity UI Kit application icon react component.", | ||
"main": "index.js", | ||
"keywords": [ | ||
"react", | ||
"availity" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://git.availity.com/projects/PUI/repos/av-react" | ||
}, | ||
"bugs": { | ||
"url": "https://jira.availity.com/projects/PLT" | ||
}, | ||
"license": "UNLICENSED", | ||
"publishConfig": { | ||
"registry": "https://artifactory.availity.com/artifactory/api/npm/local-npm/" | ||
}, | ||
"devDependencies": { | ||
"prop-types": "^15.5.8", | ||
"react": "^16.3.0", | ||
"react-dom": "^16.3.0" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.3.0" | ||
} | ||
} |
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,53 @@ | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
import AppIcon from '..'; | ||
|
||
describe('AppIcon', () => { | ||
test('should render', () => { | ||
const component = renderer.create(<AppIcon />); | ||
const json = component.toJSON(); | ||
expect(json).toMatchSnapshot(); | ||
}); | ||
|
||
test('should render color', () => { | ||
const component = renderer.create(<AppIcon color="green" />); | ||
const json = component.toJSON(); | ||
expect(json).toMatchSnapshot(); | ||
}); | ||
|
||
test('should render size', () => { | ||
const component = renderer.create(<AppIcon size="lg" />); | ||
const json = component.toJSON(); | ||
expect(json).toMatchSnapshot(); | ||
}); | ||
|
||
test('should render children', () => { | ||
const component = renderer.create(<AppIcon>AI</AppIcon>); | ||
const json = component.toJSON(); | ||
expect(json).toMatchSnapshot(); | ||
}); | ||
|
||
test('should render branded', () => { | ||
const component = renderer.create(<AppIcon branded />); | ||
const json = component.toJSON(); | ||
expect(json).toMatchSnapshot(); | ||
}); | ||
|
||
test('should render additional classNames', () => { | ||
const component = renderer.create(<AppIcon className="and-more" />); | ||
const json = component.toJSON(); | ||
expect(json).toMatchSnapshot(); | ||
}); | ||
|
||
test('should render additional attributes', () => { | ||
const component = renderer.create(<AppIcon title="Availity Icon" />); | ||
const json = component.toJSON(); | ||
expect(json).toMatchSnapshot(); | ||
}); | ||
|
||
test('should render custom tags', () => { | ||
const component = renderer.create(<AppIcon tag="i" />); | ||
const json = component.toJSON(); | ||
expect(json).toMatchSnapshot(); | ||
}); | ||
}); |
56 changes: 56 additions & 0 deletions
56
packages/app-icon/tests/__snapshots__/AppIcon.test.js.snap
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,56 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AppIcon should render 1`] = ` | ||
<span | ||
className="app-icon app-icon-black" | ||
/> | ||
`; | ||
|
||
exports[`AppIcon should render additional attributes 1`] = ` | ||
<span | ||
className="app-icon app-icon-black" | ||
title="Availity Icon" | ||
/> | ||
`; | ||
|
||
exports[`AppIcon should render additional classNames 1`] = ` | ||
<span | ||
className="and-more app-icon app-icon-black" | ||
/> | ||
`; | ||
|
||
exports[`AppIcon should render branded 1`] = ` | ||
<span | ||
className="app-icon app-icon-branded-black" | ||
> | ||
<span | ||
className="caret" | ||
/> | ||
</span> | ||
`; | ||
|
||
exports[`AppIcon should render children 1`] = ` | ||
<span | ||
className="app-icon app-icon-black" | ||
> | ||
AI | ||
</span> | ||
`; | ||
|
||
exports[`AppIcon should render color 1`] = ` | ||
<span | ||
className="app-icon app-icon-green" | ||
/> | ||
`; | ||
|
||
exports[`AppIcon should render custom tags 1`] = ` | ||
<i | ||
className="app-icon app-icon-black" | ||
/> | ||
`; | ||
|
||
exports[`AppIcon should render size 1`] = ` | ||
<span | ||
className="app-icon app-icon-black app-icon-lg" | ||
/> | ||
`; |
Oops, something went wrong.