Skip to content

Commit df387a7

Browse files
authored
feat: give url docs to snippet payload
feat: give url docs to snippet payload
2 parents 3f4ea44 + c862a27 commit df387a7

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

  • packages/snippets/src/components/snippet-viewer/footer

packages/snippets/src/components/snippet-viewer/footer/index.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,17 @@ const Footer: FC<Props> = (props) => {
2424
<button className="snippet-viewer-footer__btn" onClick={onCopy}>
2525
{isCopied ? 'Copied!' : 'Copy'} <Copy size={14} />
2626
</button>
27-
{snippet.template.config.docs && (
28-
<a type="button" href={snippet.template.config.docs} className="snippet-viewer-footer__btn" onClick={onCopy}>
27+
{(typeof snippet.snippet.payload?.docs === 'string' ||
28+
snippet.template.config.docs) && (
29+
<a
30+
type="button"
31+
href={
32+
(snippet.snippet.payload?.docs as string) ||
33+
snippet.template.config.docs
34+
}
35+
className="snippet-viewer-footer__btn"
36+
onClick={onCopy}
37+
>
2938
Docs <BookOpen size={14} />
3039
</a>
3140
)}

0 commit comments

Comments
 (0)