Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit 335669c

Browse files
authored
fix(Avatar): add white border around avatar in contrast theme (#795)
changes to add white border around avatar in contrast theme
1 parent 0c6e355 commit 335669c

File tree

5 files changed

+13
-1
lines changed

5 files changed

+13
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
8383
- Fix alignment of `Layout`'s `main` area @kuzhelov ([#752](https://github.com/stardust-ui/react/pull/752))
8484
- Call `Popup` `onOpenChange` on all user initiated events @levithomason ([#619](https://github.com/stardust-ui/react/pull/619))
8585
- Fix `ChatMessage` - Author element should always be rendered @sophieH29 ([#761](https://github.com/stardust-ui/react/pull/761))
86+
- Fix `Avatar` - Add white circle border in contrast theme @bcalvery ([#795](https://github.com/stardust-ui/react/pull/795))
8687

8788
### Features
8889
- Add and export 'missed call' icon in Teams theme @codepretty ([#748](https://github.com/stardust-ui/react/pull/748))

docs/src/examples/components/Avatar/Variations/AvatarExampleImageCustomization.shorthand.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ const AvatarExampleImageCustomizationShorthand = () => (
1010
 
1111
<Avatar
1212
image={
13+
// This example does not react to the avatar size variable
14+
// and otherwise produces bad results when border is applied compared to "normal" image
1315
<Icon name="user" circular variables={{ color: 'blue' }} styles={{ padding: '8px' }} />
1416
}
1517
status={{ color: 'green', icon: 'check', title: 'Available' }}

src/themes/teams-high-contrast/components/Avatar/avatarVariables.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@ import { AvatarVariables } from '../../../teams/components/Avatar/avatarVariable
22
import { Partial } from 'types/utils'
33

44
export default (siteVariables: any): Partial<AvatarVariables> => ({
5+
avatarBorderColor: siteVariables.white,
6+
avatarBorderWidth: 2,
57
statusBorderColor: siteVariables.black,
68
})

src/themes/teams/components/Avatar/avatarStyles.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ const avatarStyles: ComponentSlotStylesInput<AvatarPropsWithDefaults, any> = {
1414
width: sizeInRem,
1515
}
1616
},
17-
image: (): ICSSInJSStyle => ({
17+
image: ({ variables }): ICSSInJSStyle => ({
1818
verticalAlign: 'top',
19+
borderStyle: 'solid',
20+
borderColor: variables.avatarBorderColor,
21+
borderWidth: `${variables.avatarBorderWidth}px`,
1922
}),
2023
label: ({ props: { size } }): ICSSInJSStyle => {
2124
const sizeInRem = pxToRem(size)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
export interface AvatarVariables {
2+
avatarBorderColor: string
3+
avatarBorderWidth: number
24
statusBorderColor: string
35
statusBorderWidth: number
46
}
57

68
export default (siteVariables): AvatarVariables => ({
9+
avatarBorderColor: '',
10+
avatarBorderWidth: 0,
711
statusBorderColor: siteVariables.bodyBackground,
812
statusBorderWidth: 2,
913
})

0 commit comments

Comments
 (0)