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

Commit 7b2d888

Browse files
author
Dylan
committed
Resolves #100
1 parent 2a1ca4f commit 7b2d888

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

velog-frontend/src/components/user/UserHead/UserHead.js

Lines changed: 18 additions & 15 deletions
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">
@@ -37,20 +38,19 @@ const UserHead = ({ username, profile, self, following, onToggleFollow, rawTagNa
3738
<img src={resizeImage(profile.thumbnail || defaultThumbnail, 256)} alt="thumbnail" />
3839
<div className="user-info">
3940
<section className="top">
40-
{!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-
)}
41+
{!self && 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+
)}
5454
<div className="username">@{username}</div>
5555
</section>
5656
<section className="profile-content">
@@ -87,7 +87,10 @@ const UserHead = ({ username, profile, self, following, onToggleFollow, rawTagNa
8787
{url && (
8888
<div className="link-line">
8989
<LinkIcon />
90-
<a href={url} target="_blank">
90+
<a
91+
href={!urlRegExr.exec(url.toLowerCase()) ? `http://${url}` : url}
92+
target="_blank"
93+
>
9194
{url}
9295
</a>
9396
</div>

0 commit comments

Comments
 (0)