feat: add open source link type

feat/open-source
Arik Chakma 5 months ago
parent c894430a86
commit 9bff8fb645
  1. 2
      .astro/settings.json
  2. 20
      src/components/TopicDetail/TopicDetailLink.tsx

@ -3,6 +3,6 @@
"enabled": false
},
"_variables": {
"lastUpdateCheck": 1727095669945
"lastUpdateCheck": 1728161578172
}
}

@ -29,6 +29,17 @@ type TopicDetailLinkProps = {
export function TopicDetailLink(props: TopicDetailLinkProps) {
const { url, onClick, type, title, isPaid = false } = props;
const linkType =
type === 'opensource'
? url.includes('github')
? 'github'
: url.includes('gitlab')
? 'gitlab'
: url.includes('bitbucket')
? 'bitbucket'
: 'Open Source'
: type;
return (
<a
href={url}
@ -42,14 +53,7 @@ export function TopicDetailLink(props: TopicDetailLinkProps) {
(isPaid ? paidLinkTypes[type] : linkTypes[type]) || 'bg-gray-200',
)}
>
{type === 'opensource' ? (
<>
{url.includes('github') && 'GitHub'}
{url.includes('gitlab') && 'GitLab'}
</>
) : (
type
)}
{linkType}
</span>
{title}
</a>

Loading…
Cancel
Save