Skip to content

Commit 76eb7d3

Browse files
committed
feat(showcase): add links for primitives
1 parent daf2fdb commit 76eb7d3

File tree

4 files changed

+23
-12
lines changed

4 files changed

+23
-12
lines changed

apps/showcase/app/(tabs)/components/primitives.tsx

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { useScrollToTop } from '@react-navigation/native';
22
import { FlashList } from '@shopify/flash-list';
3+
import { Link } from 'expo-router';
34
import * as React from 'react';
45
import { View } from 'react-native';
56
import { Button } from '~/components/ui/button';
67
import { Input } from '~/components/ui/input';
78
import { Text } from '~/components/ui/text';
89
import { PRIMITIVES } from '~/lib/constants';
10+
import { ExternalLink } from '~/lib/icons/ExternalLink';
911
import { cn } from '~/lib/utils';
1012

1113
export default function PrimitivesScreen() {
@@ -33,18 +35,20 @@ export default function PrimitivesScreen() {
3335
estimatedItemSize={49}
3436
showsVerticalScrollIndicator={false}
3537
renderItem={({ item, index }) => (
36-
<Button
37-
disabled
38-
variant='secondary'
39-
size='lg'
40-
className={cn(
41-
'opacity-100 bg-secondary/40 pl-4 pr-1.5 border-x border-t border-foreground/5 rounded-none flex-row justify-center',
42-
index === 0 && 'rounded-t-lg',
43-
index === data.length - 1 && 'border-b rounded-b-lg'
44-
)}
45-
>
46-
<Text className='text-xl'>{toOptions(item)}</Text>
47-
</Button>
38+
<Link href={`https://rnprimitives.com/${item}`} asChild>
39+
<Button
40+
variant='secondary'
41+
size='lg'
42+
className={cn(
43+
'bg-secondary/40 px-4 border-x border-t border-foreground/5 rounded-none flex-row justify-between',
44+
index === 0 && 'rounded-t-lg',
45+
index === data.length - 1 && 'border-b rounded-b-lg'
46+
)}
47+
>
48+
<Text className='text-xl'>@rn-primitives/{item}</Text>
49+
<ExternalLink size={16} className='text-foreground/50' />
50+
</Button>
51+
</Link>
4852
)}
4953
ListFooterComponent={<View className='py-4' />}
5054
/>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import { Lib } from '@rnr/reusables';
2+
export const { ExternalLink } = Lib.Icons;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { ExternalLink } from 'lucide-react-native';
2+
import { iconWithClassName } from './iconWithClassName';
3+
iconWithClassName(ExternalLink);
4+
export { ExternalLink };

packages/reusables/src/lib/icons/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export { Code } from './Code';
2828
export { Copy } from './Copy';
2929
export { Database } from './Database';
3030
export { Ear } from './Ear';
31+
export { ExternalLink } from './ExternalLink';
3132
export { Fan } from './Fan';
3233
export { GalleryHorizontal } from './GalleryHorizontal';
3334
export { Github } from './Github';

0 commit comments

Comments
 (0)