Skip to content

Commit

Permalink
Resolves velopert#100
Browse files Browse the repository at this point in the history
  • Loading branch information
Dylan committed Dec 18, 2019
1 parent 2a1ca4f commit 7b2d888
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions velog-frontend/src/components/user/UserHead/UserHead.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const UserHead = ({ username, profile, self, following, onToggleFollow, rawTagNa
const { github, twitter, facebook, email, url } = profile.profile_links;
const hasAccount = !!(github || twitter || facebook);
const hasLink = !!(url || email);
const urlRegExr = /(http|https):\/\/([\w+?\.\w+])+([a-zA-Z0-9\~\!\@\#\$\%\^\&\*\(\)_\-\=\+\\\/\?\.\:\;\'\,]*)?/;

return (
<div className="UserHead">
Expand All @@ -37,20 +38,19 @@ const UserHead = ({ username, profile, self, following, onToggleFollow, rawTagNa
<img src={resizeImage(profile.thumbnail || defaultThumbnail, 256)} alt="thumbnail" />
<div className="user-info">
<section className="top">
{!self &&
following !== undefined && (
<div className="subscribe-wrapper">
{following ? (
<Button className="subscribe" theme="gray" onClick={onToggleFollow}>
구독중
</Button>
) : (
<Button className="subscribe" onClick={onToggleFollow}>
구독하기
</Button>
)}
</div>
)}
{!self && following !== undefined && (
<div className="subscribe-wrapper">
{following ? (
<Button className="subscribe" theme="gray" onClick={onToggleFollow}>
구독중
</Button>
) : (
<Button className="subscribe" onClick={onToggleFollow}>
구독하기
</Button>
)}
</div>
)}
<div className="username">@{username}</div>
</section>
<section className="profile-content">
Expand Down Expand Up @@ -87,7 +87,10 @@ const UserHead = ({ username, profile, self, following, onToggleFollow, rawTagNa
{url && (
<div className="link-line">
<LinkIcon />
<a href={url} target="_blank">
<a
href={!urlRegExr.exec(url.toLowerCase()) ? `http://${url}` : url}
target="_blank"
>
{url}
</a>
</div>
Expand Down

0 comments on commit 7b2d888

Please sign in to comment.