Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(avatar): fix style error caused by #617 #631

Merged
merged 1 commit into from
Dec 18, 2020
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/components/src/components/avatar/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const Avatar = React.forwardRef<HTMLSpanElement, AvatarProps>((props: AvatarProp
if (userName !== undefined && typeof userName === 'string') {
const prefixUserName = omit && typeof userName === 'string' ? userName.trim()[0].toUpperCase() : userName.trim();
return (
<span ref={childrenRef} style={childrenStyle}>
<span ref={childrenRef} style={childrenStyle} className={`${prefixCls}-string`}>
{prefixUserName}
</span>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ exports[`Testing Avatar should be stable 1`] = `
className="gio-avatar gio-avatar-df"
>
<span
className="gio-avatar-string"
style={
Object {
"transform": "scale(1) translateX(-50%)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ exports[`Testing AvatarGroup should be stable 1`] = `
onMouseLeave={[Function]}
>
<span
className="gio-avatar-string"
style={
Object {
"transform": "scale(1) translateX(-50%)",
Expand Down Expand Up @@ -51,6 +52,7 @@ exports[`Testing AvatarGroup should be stable 1`] = `
onMouseLeave={[Function]}
>
<span
className="gio-avatar-string"
style={
Object {
"transform": "scale(1) translateX(-50%)",
Expand All @@ -64,6 +66,7 @@ exports[`Testing AvatarGroup should be stable 1`] = `
className="gio-avatar-rest gio-avatar gio-avatar-df"
>
<span
className="gio-avatar-string"
style={
Object {
"transform": "scale(1) translateX(-50%)",
Expand Down
15 changes: 6 additions & 9 deletions packages/components/src/components/avatar/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@
opacity: 1;
user-select: none;

&:hover {
.@{avatar-prefix-cls}-droppable {
background-color: @color-background-avatar-hover-dropdown;

svg {
transform: scale(1);
}
&:hover &-droppable {
background-color: @color-background-avatar-hover-dropdown;
span {
transform: scale(1);
}
}

Expand All @@ -35,14 +32,14 @@
cursor: pointer;
transition: all 0.3s;

svg {
span {
vertical-align: middle;
transform: scale(0);
transition: all 0.3s;
}
}

span {
&-string {
position: absolute;
left: 50%;
transform-origin: 0 center;
Expand Down