Skip to content
This repository was archived by the owner on Mar 3, 2020. It is now read-only.

Commit 8cd4c2e

Browse files
author
Dylan
committed
Resolves #100
1 parent 2a1ca4f commit 8cd4c2e

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

Diff for: velog-frontend/src/components/user/UserHead/UserHead.js

+15-14
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const UserHead = ({ username, profile, self, following, onToggleFollow, rawTagNa
2727
const { github, twitter, facebook, email, url } = profile.profile_links;
2828
const hasAccount = !!(github || twitter || facebook);
2929
const hasLink = !!(url || email);
30+
const urlRegExr = /(http|https):\/\/([\w+?.\w+])+([a-zA-Z0-9~!@#$%^&*()_\-=+\\/?.:;',]*)?/;
3031

3132
return (
3233
<div className="UserHead">
@@ -38,19 +39,19 @@ const UserHead = ({ username, profile, self, following, onToggleFollow, rawTagNa
3839
<div className="user-info">
3940
<section className="top">
4041
{!self &&
41-
following !== undefined && (
42-
<div className="subscribe-wrapper">
43-
{following ? (
44-
<Button className="subscribe" theme="gray" onClick={onToggleFollow}>
45-
구독중
46-
</Button>
47-
) : (
48-
<Button className="subscribe" onClick={onToggleFollow}>
49-
구독하기
50-
</Button>
51-
)}
52-
</div>
53-
)}
42+
following !== undefined && (
43+
<div className="subscribe-wrapper">
44+
{following ? (
45+
<Button className="subscribe" theme="gray" onClick={onToggleFollow}>
46+
구독중
47+
</Button>
48+
) : (
49+
<Button className="subscribe" onClick={onToggleFollow}>
50+
구독하기
51+
</Button>
52+
)}
53+
</div>
54+
)}
5455
<div className="username">@{username}</div>
5556
</section>
5657
<section className="profile-content">
@@ -87,7 +88,7 @@ const UserHead = ({ username, profile, self, following, onToggleFollow, rawTagNa
8788
{url && (
8889
<div className="link-line">
8990
<LinkIcon />
90-
<a href={url} target="_blank">
91+
<a href={!urlRegExr.exec(url.toLowerCase()) ? `http://${url}` : url} target="_blank">
9192
{url}
9293
</a>
9394
</div>

0 commit comments

Comments
 (0)