Skip to content

Commit 4d27626

Browse files
authored
Merge pull request #546 from velopert/fix/handle-socialid
fix: add suffix to handle social id
2 parents ee40617 + e29685f commit 4d27626

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/components/common/UserProfile.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ const UserProfile: React.FC<UserProfileProps> = ({
176176

177177
const velogUrl = `/@${username}/posts`;
178178

179+
const getSocialId = (link: string) => link.split('/').reverse()[0];
180+
179181
return (
180182
<UserProfileBlock className={className} style={style}>
181183
<Section>
@@ -201,7 +203,7 @@ const UserProfile: React.FC<UserProfileProps> = ({
201203
<ProfileIcons>
202204
{github && (
203205
<a
204-
href={`https://github.com/${github}`}
206+
href={`https://github.com/${getSocialId(github)}`}
205207
target="_blank"
206208
rel="noopener noreferrer"
207209
data-testid="github"
@@ -211,7 +213,7 @@ const UserProfile: React.FC<UserProfileProps> = ({
211213
)}
212214
{twitter && (
213215
<a
214-
href={`https://twitter.com/${twitter}`}
216+
href={`https://twitter.com/${getSocialId(twitter)}`}
215217
target="_blank"
216218
rel="noopener noreferrer"
217219
data-testid="twitter"
@@ -221,7 +223,7 @@ const UserProfile: React.FC<UserProfileProps> = ({
221223
)}
222224
{facebook && (
223225
<a
224-
href={`https://facebook.com/${facebook}`}
226+
href={`https://facebook.com/${getSocialId(facebook)}`}
225227
target="_blank"
226228
rel="noopener noreferrer"
227229
data-testid="facebook"

0 commit comments

Comments
 (0)