Skip to content

Commit

Permalink
Added description to UserProfileCard
Browse files Browse the repository at this point in the history
Signed-off-by: Andre Wanlin <awanlin@rapidrtc.com>
  • Loading branch information
Andre Wanlin committed Feb 2, 2022
1 parent 9888ccb commit 64cbca7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/ninety-brooms-lay.md
@@ -0,0 +1,5 @@
---
'@backstage/plugin-org': patch
---

The description from `metadata.description` will now show as the subheader on the UserProfileCard in the same way as the GroupProfileCard
Expand Up @@ -40,6 +40,7 @@ const defaultEntity: UserEntity = {
kind: 'User',
metadata: {
name: 'guest',
description: 'Description for guest',
},
spec: {
profile: {
Expand Down Expand Up @@ -70,6 +71,7 @@ const noImageEntity: UserEntity = {
kind: 'User',
metadata: {
name: 'guest',
description: 'Description for guest',
},
spec: {
profile: {
Expand Down
Expand Up @@ -29,6 +29,7 @@ describe('UserSummary Test', () => {
kind: 'User',
metadata: {
name: 'calum.leavy',
description: 'Super awesome human',
},
spec: {
profile: {
Expand Down Expand Up @@ -73,5 +74,6 @@ describe('UserSummary Test', () => {
'href',
'/catalog/default/group/ExampleGroup',
);
expect(rendered.getByText('Super awesome human')).toBeInTheDocument();
});
});
Expand Up @@ -61,7 +61,7 @@ export const UserProfileCard = ({
}

const {
metadata: { name: metaName },
metadata: { name: metaName, description },
spec: { profile },
} = user;
const displayName = profile?.displayName ?? metaName;
Expand All @@ -71,7 +71,11 @@ export const UserProfileCard = ({
});

return (
<InfoCard title={<CardTitle title={displayName} />} variant={variant}>
<InfoCard
title={<CardTitle title={displayName} />}
subheader={description}
variant={variant}
>
<Grid container spacing={3} alignItems="flex-start">
<Grid item xs={12} sm={2} xl={1}>
<Avatar displayName={displayName} picture={profile?.picture} />
Expand Down

0 comments on commit 64cbca7

Please sign in to comment.