-
Notifications
You must be signed in to change notification settings - Fork 841
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added more customizations to Avatar (#903)
- Loading branch information
Showing
10 changed files
with
365 additions
and
60 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
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
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
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,36 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
EuiAvatar, | ||
EuiTitle, | ||
EuiSpacer, | ||
} from '../../../../src/components'; | ||
|
||
export default () => ( | ||
<div> | ||
|
||
<EuiTitle size="xs"><h3>Single vs multi-word</h3></EuiTitle> | ||
<EuiSpacer /> | ||
|
||
<EuiAvatar size="m" name="Single" /> | ||
  | ||
<EuiAvatar size="m" name="Two Words" /> | ||
  | ||
<EuiAvatar size="m" name="More Than Two Words" /> | ||
  | ||
<EuiAvatar size="m" name="lowercase words"/> | ||
|
||
<EuiSpacer /> | ||
<EuiTitle size="xs"><h4>Custom & Spaces type</h4></EuiTitle> | ||
<EuiSpacer /> | ||
|
||
<EuiAvatar size="m" type="space" name="Kibana" initialsLength={2} /> | ||
  | ||
<EuiAvatar size="m" type="space" name="Leornardo Dude" initialsLength={1} /> | ||
  | ||
<EuiAvatar size="m" type="space" name="Not provided" initials="?" /> | ||
  | ||
<EuiAvatar size="m" type="space" name="Engineering Space" initials="En" initialsLength={2} /> | ||
|
||
</div> | ||
); |
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
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 |
---|---|---|
@@ -1,39 +1,46 @@ | ||
.euiAvatar { | ||
@include innerBorder('dark', 50%); | ||
|
||
border-radius: 50%; | ||
display: inline-block; | ||
background-size: cover; | ||
color: $euiColorGhost; | ||
text-align: center; | ||
text-shadow: 1px 1px rgba(0,0,0,.2); | ||
vertical-align: middle; | ||
overflow-x: hidden; | ||
cursor: default; // Make sure we don't get the text cursor | ||
} | ||
|
||
.euiAvatar--s { | ||
width: $euiSizeL; | ||
height: $euiSizeL; | ||
line-height: $euiSizeL; | ||
font-size: $euiSizeM; | ||
.euiAvatar--user { | ||
@include innerBorder('dark', 50%, .05); | ||
border-radius: 50%; | ||
} | ||
|
||
.euiAvatar--m { | ||
width: $euiSizeXL; | ||
height: $euiSizeXL; | ||
line-height: $euiSizeXL; | ||
font-size: $euiSize; | ||
.euiAvatar--space { | ||
@include innerBorder('dark', $euiBorderRadius, .05); | ||
border-radius: $euiBorderRadius; | ||
} | ||
|
||
.euiAvatar--l { | ||
width: $euiSizeXXL; | ||
height: $euiSizeXXL; | ||
line-height: $euiSizeXXL; | ||
font-size: $euiSizeL; | ||
} | ||
// Modifiers for sizing. | ||
$avatarSizing: ( | ||
s: ( | ||
size: $euiSizeL, | ||
font-size: $euiSizeM | ||
), | ||
m: ( | ||
size: $euiSizeXL, | ||
font-size: $euiSize | ||
), | ||
l: ( | ||
size: $euiSizeXXL, | ||
font-size: $euiSizeL | ||
), | ||
xl: ( | ||
size: ($euiSize * 4), | ||
font-size: $euiSizeXL | ||
), | ||
); | ||
|
||
.euiAvatar--xl { | ||
width: $euiSize * 4; | ||
height: $euiSize * 4; | ||
line-height: $euiSize * 4; | ||
font-size: $euiSizeXL; | ||
@each $size, $map in $avatarSizing { | ||
.euiAvatar--#{$size} { | ||
@include size(map-get($map, 'size')); | ||
line-height: map-get($map, 'size'); | ||
font-size: map-get($map, 'font-size'); | ||
} | ||
} |
Oops, something went wrong.