Skip to content

Commit 2c79fa2

Browse files
authored
de-emphasize version range separators (#2288)
1 parent 3522abb commit 2c79fa2

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

components/Package/DependencyRow.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type ReactNode } from 'react';
1+
import { Fragment, type ReactNode } from 'react';
22
import { View } from 'react-native';
33
import semverClean from 'semver/functions/clean';
44
import semverDiff from 'semver/functions/diff';
@@ -23,7 +23,7 @@ export default function DependencyRow({ name, data, packageVersion }: Props) {
2323
isDataString ? data : data.version,
2424
typeof packageVersion === 'string' ? packageVersion : undefined
2525
);
26-
const hasLongVersion = typeof versionLabel === 'string' && versionLabel.length > 18;
26+
const hasLongVersion = typeof versionLabel !== 'string' || versionLabel.length > 18;
2727

2828
return (
2929
<View
@@ -78,7 +78,7 @@ export default function DependencyRow({ name, data, packageVersion }: Props) {
7878
</span>
7979
<Label
8080
style={[
81-
tw`font-mono flex-shrink-0 text-right text-xs leading-[14px] text-secondary`,
81+
tw`font-mono max-w-[93%] flex-shrink-0 text-right text-xs leading-[14px] text-secondary`,
8282
hasLongVersion && tw`ml-auto flex-shrink`,
8383
]}>
8484
{versionLabel}
@@ -100,6 +100,14 @@ function getVersionLabel(version: string, latestVersion?: string): ReactNode {
100100
return `${patchedVersion} (patched)`;
101101
}
102102
return 'patched';
103+
} else if (version.includes('||')) {
104+
const versionChunks = version.split(' || ');
105+
return versionChunks.map((v, index) => (
106+
<Fragment key={`v-${v}`}>
107+
{v}
108+
{index !== versionChunks.length - 1 && <span style={tw`text-tertiary`}>{` || `}</span>}
109+
</Fragment>
110+
));
103111
}
104112

105113
if (latestVersion) {

styles/styles.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
--dark-bright: #1c1c21;
9191

9292
--secondary: #a2a7ab;
93+
--tertiary: #555a67;
9394
--accented: #2a2e36;
9495
--icon: var(--pewter);
9596
--hover: var(--gray-3);

0 commit comments

Comments
 (0)