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

fix(Avatar): add white border around avatar in contrast theme #795

Merged
merged 7 commits into from
Jan 31, 2019
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Fix alignment of `Layout`'s `main` area @kuzhelov ([#752](https://github.com/stardust-ui/react/pull/752))
- Call `Popup` `onOpenChange` on all user initiated events @levithomason ([#619](https://github.com/stardust-ui/react/pull/619))
- Fix `ChatMessage` - Author element should always be rendered @sophieH29 ([#761](https://github.com/stardust-ui/react/pull/761))
- Fix `Avatar` - Add white circle border in contrast theme @bcalvery ([#795](https://github.com/stardust-ui/react/pull/795))

### Features
- Add and export 'missed call' icon in Teams theme @codepretty ([#748](https://github.com/stardust-ui/react/pull/748))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const AvatarExampleImageCustomizationShorthand = () => (
 
<Avatar
image={
// This example does not react to the avatar size variable
Copy link
Contributor

@kuzhelov kuzhelov Jan 31, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thanks for spotting this!

// and otherwise produces bad results when border is applied compared to "normal" image
<Icon name="user" circular variables={{ color: 'blue' }} styles={{ padding: '8px' }} />
}
status={{ color: 'green', icon: 'check', title: 'Available' }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ import { AvatarVariables } from '../../../teams/components/Avatar/avatarVariable
import { Partial } from 'types/utils'

export default (siteVariables: any): Partial<AvatarVariables> => ({
avatarBorderColor: siteVariables.white,
avatarBorderWidth: 2,
statusBorderColor: siteVariables.black,
})
5 changes: 4 additions & 1 deletion src/themes/teams/components/Avatar/avatarStyles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ const avatarStyles: ComponentSlotStylesInput<AvatarPropsWithDefaults, any> = {
width: sizeInRem,
}
},
image: (): ICSSInJSStyle => ({
image: ({ variables }): ICSSInJSStyle => ({
verticalAlign: 'top',
borderStyle: 'solid',
borderColor: variables.avatarBorderColor,
borderWidth: `${variables.avatarBorderWidth}px`,
}),
label: ({ props: { size } }): ICSSInJSStyle => {
const sizeInRem = pxToRem(size)
Expand Down
4 changes: 4 additions & 0 deletions src/themes/teams/components/Avatar/avatarVariables.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
export interface AvatarVariables {
avatarBorderColor: string
avatarBorderWidth: number
statusBorderColor: string
statusBorderWidth: number
}

export default (siteVariables): AvatarVariables => ({
avatarBorderColor: '',
avatarBorderWidth: 0,
statusBorderColor: siteVariables.bodyBackground,
statusBorderWidth: 2,
})