feat: add open source link type

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

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

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

Loading…
Cancel
Save