-
Notifications
You must be signed in to change notification settings - Fork 828
Expand file tree
/
Copy pathLibraryDescription.tsx
More file actions
32 lines (29 loc) · 1.02 KB
/
LibraryDescription.tsx
File metadata and controls
32 lines (29 loc) · 1.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
import * as emoji from 'node-emoji';
import { Linkify } from 'react-easy-linkify';
import { type StyleProp } from 'react-native';
import { type Style } from 'twrnc';
import { A, Caption, Headline } from '~/common/styleguide';
import { type LibraryType } from '~/types';
import tw from '~/util/tailwind';
type Props = {
github: LibraryType['github'];
maxLines?: number;
style?: StyleProp<Style>;
};
export default function LibraryDescription({ github, maxLines, style }: Props) {
return github.description && github.description.length > 0 ? (
<Headline numberOfLines={maxLines} style={[tw`text-base font-light leading-snug`, style]}>
<Linkify
options={{
linkWrapper: ({ children, ...rest }) => <A {...rest}>{children}</A>,
}}>
{emoji.emojify(github.description)}
</Linkify>
</Headline>
) : (
<Caption
style={[tw`text-base font-light leading-snug text-palette-gray4 dark:text-secondary`, style]}>
The package does not have a description defined.
</Caption>
);
}