Skip to content

Commit

Permalink
website: Update avatar documentation & demos (#963)
Browse files Browse the repository at this point in the history
  • Loading branch information
FlyersPh9 authored Feb 8, 2023
1 parent 67f3903 commit e7a3c80
Show file tree
Hide file tree
Showing 11 changed files with 415 additions and 36 deletions.
34 changes: 34 additions & 0 deletions apps/website/src/examples/Avatar.group.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import * as React from 'react';
import { AvatarGroup, Avatar, getUserColor } from '@itwin/itwinui-react';

export default () => {
return (
<AvatarGroup stacked={false} iconSize='x-large'>
<Avatar
abbreviation='TR'
backgroundColor={getUserColor('Terry Rivers')}
title='Terry Rivers'
/>
<Avatar
abbreviation='RM'
backgroundColor={getUserColor('Robin Mercer')}
title='Robin Mercer'
/>
<Avatar abbreviation='MV' backgroundColor={getUserColor('Morgan Vera')} title='Morgan Vera' />
<Avatar
abbreviation='JM'
backgroundColor={getUserColor('Jean Mullins')}
title='Jean Mullins'
/>
<Avatar
abbreviation='AM'
backgroundColor={getUserColor('Ashley Miles')}
title='Ashley Miles'
/>
</AvatarGroup>
);
};
34 changes: 34 additions & 0 deletions apps/website/src/examples/Avatar.groupanimated.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import * as React from 'react';
import { AvatarGroup, Avatar, getUserColor } from '@itwin/itwinui-react';

export default () => {
return (
<AvatarGroup animated iconSize='x-large'>
<Avatar
abbreviation='TR'
backgroundColor={getUserColor('Terry Rivers')}
title='Terry Rivers'
/>
<Avatar
abbreviation='RM'
backgroundColor={getUserColor('Robin Mercer')}
title='Robin Mercer'
/>
<Avatar abbreviation='MV' backgroundColor={getUserColor('Morgan Vera')} title='Morgan Vera' />
<Avatar
abbreviation='JM'
backgroundColor={getUserColor('Jean Mullins')}
title='Jean Mullins'
/>
<Avatar
abbreviation='AM'
backgroundColor={getUserColor('Ashley Miles')}
title='Ashley Miles'
/>
</AvatarGroup>
);
};
76 changes: 76 additions & 0 deletions apps/website/src/examples/Avatar.groupoverflow.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import * as React from 'react';
import { AvatarGroup, Avatar, getUserColor } from '@itwin/itwinui-react';

export default () => {
return (
<AvatarGroup iconSize='x-large'>
<Avatar
abbreviation='TR'
backgroundColor={getUserColor('Terry Rivers')}
title='Terry Rivers'
/>
<Avatar
abbreviation='RM'
backgroundColor={getUserColor('Robin Mercer')}
title='Robin Mercer'
/>
<Avatar abbreviation='MV' backgroundColor={getUserColor('Morgan Vera')} title='Morgan Vera' />
<Avatar
abbreviation='JM'
backgroundColor={getUserColor('Jean Mullins')}
title='Jean Mullins'
/>
<Avatar
abbreviation='AM'
backgroundColor={getUserColor('Ashley Miles')}
title='Ashley Miles'
/>
<Avatar
abbreviation='TR'
backgroundColor={getUserColor('Terry Rivers')}
title='Terry Rivers'
/>
<Avatar
abbreviation='RM'
backgroundColor={getUserColor('Robin Mercer')}
title='Robin Mercer'
/>
<Avatar abbreviation='MV' backgroundColor={getUserColor('Morgan Vera')} title='Morgan Vera' />
<Avatar
abbreviation='JM'
backgroundColor={getUserColor('Jean Mullins')}
title='Jean Mullins'
/>
<Avatar
abbreviation='AM'
backgroundColor={getUserColor('Ashley Miles')}
title='Ashley Miles'
/>
<Avatar
abbreviation='TR'
backgroundColor={getUserColor('Terry Rivers')}
title='Terry Rivers'
/>
<Avatar
abbreviation='RM'
backgroundColor={getUserColor('Robin Mercer')}
title='Robin Mercer'
/>
<Avatar abbreviation='MV' backgroundColor={getUserColor('Morgan Vera')} title='Morgan Vera' />
<Avatar
abbreviation='JM'
backgroundColor={getUserColor('Jean Mullins')}
title='Jean Mullins'
/>
<Avatar
abbreviation='AM'
backgroundColor={getUserColor('Ashley Miles')}
title='Ashley Miles'
/>
</AvatarGroup>
);
};
34 changes: 34 additions & 0 deletions apps/website/src/examples/Avatar.groupstacked.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import * as React from 'react';
import { AvatarGroup, Avatar, getUserColor } from '@itwin/itwinui-react';

export default () => {
return (
<AvatarGroup iconSize='x-large'>
<Avatar
abbreviation='TR'
backgroundColor={getUserColor('Terry Rivers')}
title='Terry Rivers'
/>
<Avatar
abbreviation='RM'
backgroundColor={getUserColor('Robin Mercer')}
title='Robin Mercer'
/>
<Avatar abbreviation='MV' backgroundColor={getUserColor('Morgan Vera')} title='Morgan Vera' />
<Avatar
abbreviation='JM'
backgroundColor={getUserColor('Jean Mullins')}
title='Jean Mullins'
/>
<Avatar
abbreviation='AM'
backgroundColor={getUserColor('Ashley Miles')}
title='Ashley Miles'
/>
</AvatarGroup>
);
};
19 changes: 19 additions & 0 deletions apps/website/src/examples/Avatar.icon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import * as React from 'react';
import { Avatar, getUserColor } from '@itwin/itwinui-react';
import { SvgUser } from '@itwin/itwinui-icons-react';

export default () => {
return (
<Avatar
abbreviation='AU'
backgroundColor={getUserColor('Anonymous user')}
image={<SvgUser aria-hidden='true' />}
size='x-large'
title='Anonymous user'
/>
);
};
17 changes: 17 additions & 0 deletions apps/website/src/examples/Avatar.initials.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import * as React from 'react';
import { Avatar, getUserColor } from '@itwin/itwinui-react';

export default () => {
return (
<Avatar
abbreviation='TR'
backgroundColor={getUserColor('Terry Rivers')}
size='x-large'
title='Terry Rivers'
/>
);
};
44 changes: 36 additions & 8 deletions apps/website/src/examples/Avatar.main.tsx

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions apps/website/src/examples/Avatar.picture.tsx

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions apps/website/src/examples/Avatar.sizes.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import * as React from 'react';
import { Avatar, getUserColor } from '@itwin/itwinui-react';

export default () => {
return (
<div
style={{
display: 'flex',
gap: 'var(--iui-size-s)',
placeItems: 'center',
}}
>
<Avatar
abbreviation='TR'
backgroundColor={getUserColor('Terry Rivers')}
size='small'
title='Terry Rivers'
/>
<Avatar
abbreviation='RM'
backgroundColor={getUserColor('Robin Mercer')}
size='medium'
title='Robin Mercer'
/>
<Avatar
abbreviation='MV'
backgroundColor={getUserColor('Morgan Vera')}
size='large'
title='Morgan Vera'
/>
<Avatar
abbreviation='JM'
backgroundColor={getUserColor('Jean Mullins')}
size='x-large'
title='Jean Mullins'
/>
</div>
);
};
47 changes: 47 additions & 0 deletions apps/website/src/examples/Avatar.statuses.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import * as React from 'react';
import { Avatar, getUserColor } from '@itwin/itwinui-react';

export default () => {
return (
<div
style={{
display: 'flex',
gap: 'var(--iui-size-s)',
placeItems: 'center',
}}
>
<Avatar
abbreviation='TR'
backgroundColor={getUserColor('Terry Rivers')}
title='Terry Rivers'
size='x-large'
status='online'
/>
<Avatar
abbreviation='RM'
backgroundColor={getUserColor('Robin Mercer')}
title='Robin Mercer'
size='x-large'
status='away'
/>
<Avatar
abbreviation='JM'
backgroundColor={getUserColor('Jean Mullins')}
title='Jean Mullins'
size='x-large'
status='busy'
/>
<Avatar
abbreviation='AM'
backgroundColor={getUserColor('Ashley Miles')}
title='Ashley Miles'
size='x-large'
status='offline'
/>
</div>
);
};
Loading

0 comments on commit e7a3c80

Please sign in to comment.