Skip to content

Commit 7b87e14

Browse files
committed
feat(DocLink): add DocLink component with conditional rendering based on dev mode
1 parent 142a096 commit 7b87e14

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/components/DocLink.tsx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import React from 'react';
2+
import { BookOpen } from 'react-feather';
3+
import { useDevModeStore } from '@/stores/useDevMode.store.ts';
4+
import { cn } from '../utils/style.utils.ts';
5+
6+
export function DocLink({
7+
children,
8+
className,
9+
forceActive = false,
10+
}: {
11+
children: React.ReactNode;
12+
className?: string;
13+
forceActive?: boolean;
14+
}) {
15+
const { isDevMode } = useDevModeStore();
16+
17+
return (
18+
<div
19+
className={
20+
isDevMode || forceActive
21+
? cn(
22+
'bg-grey-700 text-grey-100 border-grey-600 visible flex items-start overflow-x-auto rounded-lg border px-4 py-3 font-mono text-sm font-normal tracking-tighter',
23+
className
24+
)
25+
: 'invisible h-0 overflow-hidden'
26+
}
27+
>
28+
<BookOpen size="20" className="mt-px hidden md:inline-block" />
29+
<div className="md:ml-3">{children}</div>
30+
</div>
31+
);
32+
}

0 commit comments

Comments
 (0)