Skip to content

Commit 4fdff7d

Browse files
committed
* added lucide-react dependencies to provide a base icon library
* Add icon to links instead of underlined content
1 parent f03e4a1 commit 4fdff7d

File tree

6 files changed

+49
-31
lines changed

6 files changed

+49
-31
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"jsonwebtoken": "^9.0.2",
4848
"ky": "^1.8.1",
4949
"lodash-es": "^4.17.21",
50+
"lucide-react": "^0.511.0",
5051
"next": "15.3.2",
5152
"nodemailer": "^7.0.3",
5253
"pagedjs": "^0.4.3",

src/app/cv/[id]/(lib)/components/highlight.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { PayloadLexicalReactRenderer } from '@/lib/lexical-render/src/payloadLexicalReactRenderer'
22
import { IconHighlight } from '@/app/cv/[id]/(lib)/icon/highlight'
3+
import { ReactNode } from 'react'
34

45
type Props = {
5-
title: string | undefined | null
6-
subtitle: string | undefined | null
6+
title: string | undefined | null | ReactNode
7+
subtitle: string | undefined | null | ReactNode
78
description: any
89
borderLeftColor?: string
910
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { ExternalLink } from 'lucide-react'
2+
3+
type OptionalLinkProps = {
4+
name: string
5+
url: string | undefined | null
6+
}
7+
8+
export const OptionalLink: React.FC<OptionalLinkProps> = ({ name, url }) => {
9+
return url ? <LinkWithIcon url={url} name={name} /> : <>{name}</>
10+
}
11+
12+
type LinkWithIconProps = {
13+
name: string
14+
url: string
15+
}
16+
17+
export const LinkWithIcon: React.FC<LinkWithIconProps> = ({ name, url }) => {
18+
return (
19+
<a href={url} className={'flex'} target="_blank">
20+
{name}
21+
<ExternalLink className={'pl-0.5'} size={16} />
22+
</a>
23+
)
24+
}

src/app/cv/[id]/default_page.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ body {
4242

4343
a {
4444
&:link {
45-
@apply underline;
45+
@apply no-underline;
4646
color: black;
4747
}
4848
&:hover {
49-
@apply no-underline;
49+
@apply underline;
5050
}
5151
&:focus {
5252
}

src/app/cv/[id]/default_page.tsx

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { CvPageProps } from './page'
99
import { filterEmptyLexicalNodes, formatDate, fromToYear, hasLexicalNodes } from './utilities'
1010
import * as process from 'node:process'
1111
import './default_page.scss'
12+
import { LinkWithIcon, OptionalLink } from './(lib)/components/link'
1213

1314
const DefaultPage: React.FC<CvPageProps> = async ({
1415
cv,
@@ -103,9 +104,7 @@ const DefaultPage: React.FC<CvPageProps> = async ({
103104
<h3>{I18nCollection.fieldLabel.links[locale]}</h3>
104105
{cv.links?.map((link) => (
105106
<div key={link.id}>
106-
<a href={link.url} target="_blank">
107-
{capitalize(link.platform)}
108-
</a>
107+
<LinkWithIcon name={capitalize(link.platform)} url={link.url} />
109108
</div>
110109
))}
111110
</div>
@@ -134,12 +133,7 @@ const DefaultPage: React.FC<CvPageProps> = async ({
134133
<tr>
135134
<td className={'no-page-break'}>
136135
<p className={'font-normal'}>
137-
{item.link && (
138-
<a href={item.link} target="_blank">
139-
{item.institution}
140-
</a>
141-
)}
142-
{!item.link && item.institution}
136+
<OptionalLink url={item.link} name={item.institution} />
143137
</p>
144138
<p className={'small'}>
145139
{fromToYear(locale, item.fromYear, item.toYear)}
@@ -164,12 +158,7 @@ const DefaultPage: React.FC<CvPageProps> = async ({
164158
<tr>
165159
<td className={'no-page-break'}>
166160
<p className={'font-normal'}>
167-
{item.link && (
168-
<a href={item.link} target="_blank">
169-
{item.name}
170-
</a>
171-
)}
172-
{!item.link && item.name}
161+
<OptionalLink url={item.link} name={item.name} />
173162
</p>
174163
<p className={'small'}>{fromToYear(locale, item.toYear, item.toYear)}</p>
175164
<div className={'space-y-1'}>
@@ -192,12 +181,7 @@ const DefaultPage: React.FC<CvPageProps> = async ({
192181
<tr>
193182
<td className={'no-page-break'}>
194183
<p className={'font-normal'}>
195-
{item.link && (
196-
<a href={item.link} target="_blank">
197-
{item.name}
198-
</a>
199-
)}
200-
{!item.link && item.name}
184+
<OptionalLink url={item.link} name={item.name} />
201185
</p>
202186
<p className={'small'}>{fromToYear(locale, item.toYear, item.toYear)}</p>
203187
<div className={'space-y-1'}>
@@ -356,12 +340,10 @@ const DefaultPage: React.FC<CvPageProps> = async ({
356340
<tr>
357341
<td className={'no-page-break'}>
358342
<p className={'mb-0.5 font-normal'}>
359-
{(item.project as Project).link && (
360-
<a href={(item.project as Project).link || ''} target="_blank">
361-
{(item.project as Project).name}
362-
</a>
363-
)}
364-
{!(item.project as Project).link && (item.project as Project).name}
343+
<OptionalLink
344+
url={(item.project as Project).link}
345+
name={(item.project as Project).name || ''}
346+
/>
365347
</p>
366348
<p className={'small mb-0.5'}>{(item.company as Company).name}</p>
367349
<p className={'small mb-0.5'}>

yarn.lock

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5308,6 +5308,7 @@ __metadata:
53085308
jsonwebtoken: "npm:^9.0.2"
53095309
ky: "npm:^1.8.1"
53105310
lodash-es: "npm:^4.17.21"
5311+
lucide-react: "npm:^0.511.0"
53115312
next: "npm:15.3.2"
53125313
nodemailer: "npm:^7.0.3"
53135314
pagedjs: "npm:^0.4.3"
@@ -8392,6 +8393,15 @@ __metadata:
83928393
languageName: node
83938394
linkType: hard
83948395

8396+
"lucide-react@npm:^0.511.0":
8397+
version: 0.511.0
8398+
resolution: "lucide-react@npm:0.511.0"
8399+
peerDependencies:
8400+
react: ^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0
8401+
checksum: 10/d712f4215a2e2563e145a6946f0e2be2cf6a081ac52d832e521996ba1c1fda91881445a4e78affa0bde520b3ad9f25ff83b8097f9baf2e192ce8f732d78e1402
8402+
languageName: node
8403+
linkType: hard
8404+
83958405
"make-fetch-happen@npm:^14.0.3":
83968406
version: 14.0.3
83978407
resolution: "make-fetch-happen@npm:14.0.3"

0 commit comments

Comments
 (0)