-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #636 from ensdomains/dev
Deploy to live
- Loading branch information
Showing
8 changed files
with
83 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React from 'react' | ||
import styled from '@emotion/styled' | ||
import { ReactComponent as ExternalLinkIcon } from '../Icons/externalLink.svg' | ||
|
||
const LinkContainer = styled('a')` | ||
display: inline-block; | ||
align-items: center; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
overflow: hidden; | ||
svg { | ||
margin-left: 10px; | ||
transition: 0.1s; | ||
opacity: 0; | ||
} | ||
&:hover { | ||
svg { | ||
opacity: 1; | ||
} | ||
} | ||
` | ||
|
||
const TextRecordLink = ({ textKey, value }) => { | ||
let url | ||
switch (textKey) { | ||
case 'url': | ||
url = `${value}` | ||
break | ||
case 'vnd.twitter': | ||
url = `twitter.com/${value}` | ||
break | ||
case 'vnd.github': | ||
url = `github.com/${value}` | ||
break | ||
default: | ||
} | ||
if (url && !url.match(/http[s]?:\/\//)) { | ||
url = 'https://' + url | ||
} | ||
return url ? ( | ||
<LinkContainer target="_blank" href={url}> | ||
{value} | ||
<ExternalLinkIcon /> | ||
</LinkContainer> | ||
) : ( | ||
value | ||
) | ||
} | ||
|
||
export default TextRecordLink |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/components/SingleName/ResolverAndRecords/TextRecord/TextRecord.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
src/components/SingleName/ResolverAndRecords/TextRecord/constants.js
This file was deleted.
Oops, something went wrong.