-
Notifications
You must be signed in to change notification settings - Fork 3
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 #183 from poap-xyz/release/v1.11.0
Release v1.11.0
- Loading branch information
Showing
14 changed files
with
215 additions
and
33 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
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,13 @@ | ||
import { OpenNewWindow } from 'iconoir-react' | ||
import '../styles/external-link.css' | ||
|
||
function ExternalLink({ href, children }) { | ||
return ( | ||
<a href={href} target="_blank" rel="noopener noreferrer" className="external-link"> | ||
{children ?? href} | ||
<OpenNewWindow className="external-link-icon" /> | ||
</a> | ||
) | ||
} | ||
|
||
export default ExternalLink |
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
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
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,5 @@ | ||
.external-link-icon { | ||
width: 10px; | ||
height: 10px; | ||
margin-left: 3px; | ||
} |
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,44 @@ | ||
import { POAP_SCAN_URL } from '../models/poap' | ||
|
||
const regexp = | ||
/[(http(s)?)://(www.)?a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/gi; | ||
|
||
export default function linkify(text, Anchor) { | ||
const texts = [] | ||
const urls = [] | ||
|
||
let cursor = 0 | ||
let match | ||
|
||
while ((match = regexp.exec(text))) { | ||
if (!text) { | ||
break | ||
} | ||
const matchedText = match[0] | ||
|
||
texts.push(text.slice(cursor, match.index)) | ||
urls.push(matchedText) | ||
|
||
cursor = match.index + matchedText.length | ||
} | ||
|
||
texts.push(text.slice(cursor, text.length)) | ||
|
||
const results = [] | ||
|
||
for (let i = 0; i < texts.length; i++) { | ||
results.push(texts[i]) | ||
|
||
if (urls[i]) { | ||
const href = /^https?:\/\//i.test(urls[i]) | ||
? urls[i] | ||
: /\.eth$/i.test(urls[i]) | ||
? `${POAP_SCAN_URL}/${urls[i]}` | ||
: `https://${urls[i]}` | ||
|
||
results.push(Anchor({ href, key: `${i}-${href}`, children: urls[i] })); | ||
} | ||
} | ||
|
||
return results.filter((x) => x) | ||
} |