Replace blob with edit in link

This commit is contained in:
Sebastian Qvarfordt
2020-06-05 11:03:30 +02:00
parent 0cb79192e8
commit 2f474224b0
+9 -5
View File
@@ -25,6 +25,8 @@ const DescriptionWrapper = styled('span')({
alignItems: 'center',
});
const createEditLink = (url: string): string => url.replace('blob', 'edit');
export function envelopeToComponent(
envelope: Entity,
location?: Location,
@@ -35,11 +37,13 @@ export function envelopeToComponent(
description: (
<DescriptionWrapper>
{envelope.metadata?.annotations?.description ?? 'placeholder'}
<a href={location?.target}>
<IconButton size="small">
<Edit fontSize="small" />
</IconButton>
</a>
{location?.target ? (
<a href={createEditLink(location?.target)}>
<IconButton size="small">
<Edit fontSize="small" />
</IconButton>
</a>
) : null}
</DescriptionWrapper>
),
location,