Skip to content

Commit dfd5b4e

Browse files
authored
fix(embed): show team name instead of author name (#8368)
1 parent b5fa4dc commit dfd5b4e

File tree

3 files changed

+52
-7
lines changed

3 files changed

+52
-7
lines changed

packages/app/src/embed/components/Sidebar/AvatarBlock/elements.js

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,46 @@ export const Container = styled.div(
66
display: 'flex',
77
alignItems: 'center',
88
marginBottom: 4,
9+
marginTop: 2,
910
})
1011
);
1112

1213
export const Avatar = styled.img(
1314
css({
1415
size: '24px',
15-
borderRadius: '2px',
16+
borderRadius: '50%',
1617
border: '1px solid',
1718
borderColor: 'grays.400',
1819
})
1920
);
2021

21-
export const Name = styled.span(
22+
export const AvatarPlaceholder = styled.div(
23+
css({
24+
width: 24,
25+
height: 24,
26+
display: 'flex',
27+
alignItems: 'center',
28+
justifyContent: 'center',
29+
fontWeight: 'medium',
30+
borderRadius: '50%',
31+
backgroundColor: 'grays.600',
32+
})
33+
);
34+
35+
export const PrimaryName = styled.span(
36+
css({
37+
display: 'inline-block',
38+
fontSize: 3,
39+
marginLeft: 2,
40+
marginBottom: '1px',
41+
})
42+
);
43+
44+
export const AuthorName = styled.span(
2245
css({
2346
display: 'inline-block',
2447
fontSize: 2,
2548
marginLeft: 2,
49+
color: 'grays.400',
2650
})
2751
);

packages/app/src/embed/components/Sidebar/AvatarBlock/index.js

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
11
import React from 'react';
2-
import { Container, Avatar, Name } from './elements';
2+
import {
3+
Container,
4+
Avatar,
5+
PrimaryName,
6+
AuthorName,
7+
AvatarPlaceholder,
8+
} from './elements';
39

4-
const AvatarBlock = ({ url, name }) => (
10+
const AvatarBlock = ({ url, name, teamName }) => (
511
<Container>
6-
<Avatar src={url} />
7-
<Name>{name}</Name>
12+
{url ? (
13+
<Avatar src={url} />
14+
) : (
15+
<AvatarPlaceholder>{teamName.charAt(0).toUpperCase()}</AvatarPlaceholder>
16+
)}
17+
<div style={{ display: 'flex', flexDirection: 'column' }}>
18+
{teamName && teamName !== name ? (
19+
<>
20+
<PrimaryName>{teamName}</PrimaryName>
21+
<AuthorName>{name}</AuthorName>
22+
</>
23+
) : (
24+
<PrimaryName>{name}</PrimaryName>
25+
)}
26+
</div>
827
</Container>
928
);
1029

packages/app/src/embed/components/Sidebar/SandboxInfo/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ export const SandboxInfo: FunctionComponent<Props> = ({ sandbox }) => {
1717
<Container>
1818
<Title title={title}>{title}</Title>
1919
{sandbox.description && <Description>{sandbox.description}</Description>}
20+
2021
{sandbox.author && (
2122
<AvatarBlock
22-
url={sandbox.author.avatarUrl}
23+
teamName={sandbox.team?.name}
24+
url={sandbox.team?.avatarUrl}
2325
name={sandbox.author.username}
2426
/>
2527
)}

0 commit comments

Comments
 (0)