Skip to content

Commit 3619c4f

Browse files
committed
add LinkWithLabel component
1 parent 025b5bb commit 3619c4f

File tree

11 files changed

+54
-36
lines changed

11 files changed

+54
-36
lines changed

src/components/Link.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { cva } from 'class-variance-authority';
44
import type { HTMLAttributes } from 'astro/types';
55
import type { VariantProps } from 'class-variance-authority';
66
7-
const linkVariants = cva('link-default', {
7+
const linkVariants = cva('link-default truncate', {
88
variants: {
99
variant: {
1010
link: 'link',

src/components/LinkWithLabel.astro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
import Link from '@/components/Link.astro';
3+
import { cn } from '@/utils/styles';
4+
5+
import type { Props as LinkProps } from '@/components/Link.astro';
6+
7+
export interface Props extends LinkProps {
8+
label: string;
9+
}
10+
11+
const { class: className, label, variant = 'markdown', target = '_blank', ...props } = Astro.props;
12+
---
13+
14+
<p class={cn('my-2 flex flex-col xs:flex-row xs:gap-1', className)}>
15+
<strong>{label}:</strong>
16+
<Link {...props} {variant} {target}>
17+
<slot>
18+
{props.href}
19+
</slot>
20+
</Link>
21+
</p>

src/content/project/2019/09-29-redux-ecommerce/index.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ publishDate: 2019-09-29
88

99
import { Image } from 'astro:assets';
1010
import Link from '../../../../components/Link.astro';
11+
import LinkWithLabel from '../../../../components/LinkWithLabel.astro';
1112
import { IMAGE_SIZES } from '../../../../constants/image';
1213
import ReduxEcommerceImage from '../../../../content/project/2019/09-29-redux-ecommerce/_images/redux-ecommerce.png';
1314

@@ -45,7 +46,8 @@ For more implementation details see the <Link href="https://github.com/nemanjam/
4546

4647
## Links
4748

48-
- **Demo:** <Link href="https://nemanjam.github.io/redux-ecommerce" variant="markdown" target="_blank" title="Redux ecommerce demo" />
49-
- **Repository:** <Link href="https://github.com/nemanjam/redux-ecommerce" variant="markdown" target="_blank" title="Redux ecommerce repository" />
49+
50+
- <LinkWithLabel label="Demo" href="https://nemanjam.github.io/redux-ecommerce" title="Redux ecommerce demo" />
51+
- <LinkWithLabel label="Repository" href="https://github.com/nemanjam/redux-ecommerce" title="Redux ecommerce repository" />
5052

5153

src/content/project/2019/10-23-rn-chat/index.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ publishDate: 2019-10-23
88

99
import { Image } from 'astro:assets';
1010
import Link from '../../../../components/Link.astro';
11+
import LinkWithLabel from '../../../../components/LinkWithLabel.astro';
1112
import { IMAGE_SIZES } from '../../../../constants/image';
1213
import RnChatImage from '../../../../content/project/2019/10-23-rn-chat/_images/rn-chat.png';
1314

@@ -49,6 +50,6 @@ You can find more implementation details in the <Link href="https://github.com/n
4950

5051
## Links
5152

52-
- **Repository:** <Link href="https://github.com/nemanjam/rn-chat" variant="markdown" target="_blank" title="React Native chat app" />
53+
- <LinkWithLabel label="Repository" href="https://github.com/nemanjam/rn-chat" title="React Native chat repository" />
5354

5455

src/content/project/2020/02-16-audio-twitter/index.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ publishDate: 2020-02-16
88

99
import { Image } from 'astro:assets';
1010
import Link from '../../../../components/Link.astro';
11+
import LinkWithLabel from '../../../../components/LinkWithLabel.astro';
1112
import { IMAGE_SIZES } from '../../../../constants/image';
1213
import AudioTwitterImage from '../../../../content/project/2020/02-16-audio-twitter/_images/audio-twitter.png';
1314

@@ -49,6 +50,6 @@ For more implementation details check the <Link href="https://github.com/nemanja
4950

5051
## Links
5152

52-
- **Repository:** <Link href="https://github.com/nemanjam/audio-twitter" variant="markdown" target="_blank" title="Audio Twitter repository" />
53+
- <LinkWithLabel label="Repository" href="https://github.com/nemanjam/audio-twitter" title="Audio Twitter repository" />
5354

5455

src/content/project/2020/04-12-mern-boilerplate/index.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ publishDate: 2020-04-12
88

99
import { Image } from 'astro:assets';
1010
import Link from '../../../../components/Link.astro';
11+
import LinkWithLabel from '../../../../components/LinkWithLabel.astro';
1112
import { IMAGE_SIZES } from '../../../../constants/image';
1213
import MernBoilerplateImage from '../../../../content/project/2020/04-12-mern-boilerplate/_images/mern-boilerplate.png';
1314

@@ -47,7 +48,5 @@ You can find more implementation details in the <Link href="https://github.com/n
4748

4849
## Links
4950

50-
- **Demo:** <Link href="https://mern-boilerplate.arm1.nemanjamitic.com" variant="markdown" target="_blank" title="MERN boilerplate demo" />
51-
- **Repository:** <Link href="https://github.com/nemanjam/mern-boilerplate" variant="markdown" target="_blank" title="MERN boilerplate repository" />
52-
53-
51+
- <LinkWithLabel label="Demo" href="https://mern-boilerplate.arm1.nemanjamitic.com" title="MERN boilerplate demo" />
52+
- <LinkWithLabel label="Repository" href="https://github.com/nemanjam/mern-boilerplate" title="MERN boilerplate repository" />

src/content/project/2022/07-17-nextjs-prisma-boilerplate/index.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ publishDate: 2022-07-17
88

99
import { Image } from 'astro:assets';
1010
import Link from '../../../../components/Link.astro';
11+
import LinkWithLabel from '../../../../components/LinkWithLabel.astro';
1112
import { IMAGE_SIZES } from '../../../../constants/image';
1213
import NextjsPrismaBoilerplateImage from '../../../../content/project/2022/07-17-nextjs-prisma-boilerplate/_images/nextjs-prisma-boilerplate.png';
1314

@@ -55,7 +56,6 @@ You can find more implementation details in the <Link href="https://github.com/n
5556

5657
## Links
5758

58-
- **Demo:** <Link href="https://nextjs-prisma-boilerplate.arm1.nemanjamitic.com" variant="markdown" target="_blank" title="Nextjs Prisma boilerplate demo" />
59-
- **Repository:** <Link href="https://github.com/nemanjam/nextjs-prisma-boilerplate" variant="markdown" target="_blank" title="Nextjs Prisma boilerplate repository" />
60-
6159

60+
- <LinkWithLabel label="Demo" href="https://nextjs-prisma-boilerplate.arm1.nemanjamitic.com" title="Nextjs Prisma boilerplate demo" />
61+
- <LinkWithLabel label="Repository" href="https://github.com/nemanjam/nextjs-prisma-boilerplate" title="Nextjs Prisma boilerplate repository" />

src/content/project/2024/05-06-reddit-unread-comments/index.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ publishDate: 2024-05-06
88

99
import { Image } from 'astro:assets';
1010
import Link from '../../../../components/Link.astro';
11+
import LinkWithLabel from '../../../../components/LinkWithLabel.astro';
1112
import { IMAGE_SIZES } from '../../../../constants/image';
1213
import RedditUnreadCommentsImage from '../../../../content/project/2024/05-06-reddit-unread-comments/_images/reddit-unread-comments.png';
1314

@@ -55,7 +56,8 @@ You can find more implementation details in the <Link href="https://github.com/n
5556

5657
## Links
5758

58-
- **Demo video:** <Link href="https://www.youtube.com/watch?v=dHw0pM3ZzqY" variant="markdown" target="_blank" title="Extension demo video" />
59-
- **Repository:** <Link href="https://github.com/nemanjam/reddit-unread-comments" variant="markdown" target="_blank" title="Extension repository" />
59+
60+
- <LinkWithLabel label="Demo video" href="https://www.youtube.com/watch?v=dHw0pM3ZzqY" title="Extension demo video" />
61+
- <LinkWithLabel label="Repository" href="https://github.com/nemanjam/reddit-unread-comments" title="Extension repository" />
6062

6163

src/content/project/2024/09-30-developer-blog/index.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ publishDate: 2024-09-30
88

99
import { Image } from 'astro:assets';
1010
import Link from '../../../../components/Link.astro';
11+
import LinkWithLabel from '../../../../components/LinkWithLabel.astro';
1112
import { IMAGE_SIZES } from '../../../../constants/image';
1213
import DeveloperBlogImage from '../../../../content/project/2024/09-30-developer-blog/_images/developer-blog.png';
1314

@@ -54,7 +55,8 @@ There is a lot more to be said, such as embeds for code and YouTube, RSS feeds,
5455

5556
## Links
5657

57-
- **Demo:** <Link href="https://nemanjamitic.com" variant="markdown" target="_blank" title="Developer blog demo" />
58-
- **Repository:** <Link href="https://github.com/nemanjam/nemanjam.github.io" variant="markdown" target="_blank" title="Developer blog repository" />
58+
- <LinkWithLabel label="Demo" href="https://nemanjamitic.com" title="Developer blog demo" />
59+
- <LinkWithLabel label="Repository" href="https://github.com/nemanjam/nemanjam.github.io" title="Developer blog repository" />
60+
5961

6062

src/content/project/2024/12-09-hackernews-new-jobs/index.mdx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ publishDate: 2024-12-09
88

99
import { Image } from 'astro:assets';
1010
import Link from '../../../../components/Link.astro';
11+
import LinkWithLabel from '../../../../components/LinkWithLabel.astro';
1112
import { IMAGE_SIZES } from '../../../../constants/image';
1213
import HackerNewsNewJobsImage from '../../../../content/project/2024/12-09-hackernews-new-jobs/_images/hackernews-new-jobs.png';
1314

@@ -56,9 +57,9 @@ You can find more implementation details in the <Link href="https://github.com/n
5657

5758
## Links
5859

60+
- <LinkWithLabel label="HackerNews" href="https://news.ycombinator.com/item?id=42373936" title="HackerNews ShowHN thread" />
61+
- <LinkWithLabel label="Demo" href="https://hackernews-new-jobs.arm1.nemanjamitic.com" title="HackerNews new jobs demo" />
62+
- <LinkWithLabel label="Repository" href="https://github.com/nemanjam/hn-new-jobs" title="HackerNews new jobs repository" />
5963

60-
- **HackerNews:** <Link href="https://news.ycombinator.com/item?id=42373936" variant="markdown" target="_blank" title="HackerNews ShowHN thread" />
61-
- **Demo:** <Link href="https://hackernews-new-jobs.arm1.nemanjamitic.com" variant="markdown" target="_blank" title="HackerNews new jobs demo" />
62-
- **Repository:** <Link href="https://github.com/nemanjam/hn-new-jobs" variant="markdown" target="_blank" title="HackerNews new jobs repository" />
6364

6465

0 commit comments

Comments
 (0)