Skip to content

Commit

Permalink
fix: package name white space no wrap
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed May 9, 2020
1 parent cfd724b commit 848feb3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ui/blocks/src/ComponentDeps/Dependencies.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable react/display-name */
import React, { FC, useMemo } from 'react';
import { Flex } from 'theme-ui';
import { Flex, Box } from 'theme-ui';
import { ImportName } from '@component-controls/specification';
import { Table, Tag, ExternalLink } from '@component-controls/components';

Expand Down Expand Up @@ -48,15 +48,16 @@ export const Dependencies: FC<DependenciesProps> = ({ dependencies }) => {
original: { name, packageName, version },
},
}: any) => {
const el = <Box css={{ whiteSpace: 'nowrap' }}>{name}</Box>;
if (!packageName) {
return name;
return el;
}
const baseVersion = version.replace(/[\^=~]/, '');
return (
<ExternalLink
href={`https://npmjs.com/package/${packageName}/v/${baseVersion}`}
>
{name}
{el}
</ExternalLink>
);
},
Expand Down

0 comments on commit 848feb3

Please sign in to comment.