-
Notifications
You must be signed in to change notification settings - Fork 827
Expand file tree
/
Copy pathUnmaintainedLabel.tsx
More file actions
53 lines (49 loc) · 2.02 KB
/
UnmaintainedLabel.tsx
File metadata and controls
53 lines (49 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { Fragment } from 'react';
import { View } from 'react-native';
import { A, Label, useLayout } from '~/common/styleguide';
import { Warning } from '~/components/Icons';
import { type LibraryDataEntryType } from '~/types';
import { strippedBackground } from '~/util/style';
import tw from '~/util/tailwind';
type Props = {
alternatives?: LibraryDataEntryType['alternatives'];
block?: boolean;
};
export default function UnmaintainedLabel({ alternatives, block }: Props) {
const { isSmallScreen } = useLayout();
return (
<View style={tw`flex-shrink flex-row gap-1.5`}>
<View
style={[
tw`-ml-5 -mt-1.5 mb-1.5 mr-8 flex-shrink flex-row flex-wrap items-start gap-1 rounded-r border border-l-0 border-palette-gray3 bg-palette-gray1 py-1.5 pl-5 pr-3 dark:border-default dark:bg-dark`,
block && tw`ml-0 mr-0 rounded-lg rounded-r-lg border-l py-2 pl-3`,
isSmallScreen && tw`flex-col`,
strippedBackground(tw.prefixMatch('dark') ? 'var(--background)' : 'var(--gray-2)'),
]}>
<View style={tw`flex-shrink flex-row gap-1.5`}>
<Warning style={tw`size-4 text-warning-dark dark:text-warning`} />
<Label style={tw`text-warning-dark dark:text-warning`}>
This library is not actively maintained.
</Label>
</View>
{alternatives && alternatives.length > 0 && (
<Label style={tw`text-warning-dark dark:text-warning`}>
You can use{' '}
{alternatives.map((alternative, index) => (
<Fragment key={alternative}>
<A
href={`/package/${alternative}`}
hoverStyle={tw`decoration-warning-dark dark:decoration-warning`}>
{alternative}
</A>
{index < alternatives.length - 1 && alternatives.length > 2 ? ', ' : ' '}
{index === alternatives.length - 2 && 'or '}
</Fragment>
))}{' '}
instead.
</Label>
)}
</View>
</View>
);
}