Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/avatars/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"styled-components": "^3.2.6"
},
"devDependencies": {
"@zendeskgarden/css-avatars": "3.0.11",
"@zendeskgarden/css-avatars": "4.0.0",
"@zendeskgarden/react-theming": "^3.1.3"
},
"keywords": [
Expand Down
22 changes: 22 additions & 0 deletions packages/avatars/src/Avatar.example.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ For accessibility ensure that all children include an `alt` description.
```jsx
<Grid>
<Row alignItems="center" justifyContent="center">
<Col md>
<Avatar size="extrasmall">
<img src="images/jason.png" alt="Example Avatar" />
</Avatar>
</Col>
<Col md>
<Avatar size="small">
<img src="images/jason.png" alt="Example Avatar" />
Expand All @@ -47,6 +52,23 @@ For accessibility ensure that all children include an `alt` description.

```jsx
<Grid>
<Row>
<Col md={4}>
<Avatar size="extrasmall">
<img src="images/jason.png" alt="Example Avatar" />
</Avatar>
</Col>
<Col md={4}>
<Avatar disabled size="extrasmall">
<img src="images/jason.png" alt="Example Avatar" />
</Avatar>
</Col>
<Col md={4}>
<Avatar isBorderless size="extrasmall">
<img src="images/amir.png" alt="Example Avatar" />
</Avatar>
</Col>
</Row>
<Row>
<Col md={4}>
<Avatar size="small">
Expand Down
8 changes: 5 additions & 3 deletions packages/avatars/src/Avatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import AvatarStyles from '@zendeskgarden/css-avatars';

const COMPONENT_ID = 'avatars.avatar';
const SIZE = {
EXTRASMALL: 'extrasmall',
SMALL: 'small',
LARGE: 'large'
};
Expand All @@ -29,8 +30,9 @@ const Avatar = styled.figure.attrs({
[AvatarStyles['c-avatar--system']]: props.system,

// Sizes
[AvatarStyles['c-avatar--small']]: props.size === SIZE.SMALL,
[AvatarStyles['c-avatar--large']]: props.size === SIZE.LARGE,
[AvatarStyles['c-avatar--xs']]: props.size === SIZE.EXTRASMALL,
[AvatarStyles['c-avatar--sm']]: props.size === SIZE.SMALL,
[AvatarStyles['c-avatar--lg']]: props.size === SIZE.LARGE,

// State
[AvatarStyles['is-disabled']]: props.disabled,
Expand All @@ -43,7 +45,7 @@ const Avatar = styled.figure.attrs({
Avatar.propTypes = {
/** Applies system styling */
system: PropTypes.bool,
size: PropTypes.oneOf([SIZE.SMALL, SIZE.LARGE]),
size: PropTypes.oneOf([SIZE.EXTRASMALL, SIZE.SMALL, SIZE.LARGE]),
disabled: PropTypes.bool,
/** Removes border for improved display on a dark background */
isBorderless: PropTypes.bool
Expand Down
2 changes: 1 addition & 1 deletion packages/avatars/src/Avatar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('Avatar', () => {
});

describe('Sizes', () => {
['small', 'large'].forEach(size => {
['extrasmall', 'small', 'large'].forEach(size => {
it(`applies ${size} correctly if provided`, () => {
const wrapper = shallow(<Avatar size={size}>{defaultImage}</Avatar>);

Expand Down
18 changes: 16 additions & 2 deletions packages/avatars/src/__snapshots__/Avatar.spec.js.snap
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Avatar Sizes applies extrasmall correctly if provided 1`] = `
<figure
className="c-avatar c-avatar--xs "
data-garden-id="avatars.avatar"
data-garden-version="version"
size="extrasmall"
>
<img
alt="test"
src="test"
/>
</figure>
`;

exports[`Avatar Sizes applies large correctly if provided 1`] = `
<figure
className="c-avatar c-avatar--large "
className="c-avatar c-avatar--lg "
data-garden-id="avatars.avatar"
data-garden-version="version"
size="large"
Expand All @@ -16,7 +30,7 @@ exports[`Avatar Sizes applies large correctly if provided 1`] = `

exports[`Avatar Sizes applies small correctly if provided 1`] = `
<figure
className="c-avatar c-avatar--small "
className="c-avatar c-avatar--sm "
data-garden-id="avatars.avatar"
data-garden-version="version"
size="small"
Expand Down