-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: "about:" page(s) redirection issue on firefox
- Loading branch information
Showing
11 changed files
with
168 additions
and
27 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 was deleted.
Oops, something went wrong.
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,57 @@ | ||
import React, { Component } from 'react'; | ||
import { Pane, Paragraph, toaster, DuplicateIcon } from 'evergreen-ui'; | ||
import { translate } from 'helpers/i18n'; | ||
import { debug, isDevEnv } from 'helpers/debug'; | ||
import { isUrl, getValidUrl } from 'helpers/url'; | ||
import queryString from 'query-string'; | ||
import copy from 'copy-to-clipboard'; | ||
import './styles.scss'; | ||
|
||
export class PasteBin extends Component { | ||
constructor(props) { | ||
super(props); | ||
this.url = props.location ? queryString.parse(props.location.search).url : null; | ||
if (this.url && isUrl(this.url)) { | ||
this.url = decodeURIComponent(this.url); | ||
this.url = getValidUrl(this.url); | ||
} | ||
if (isDevEnv && !this.url) { | ||
this.url = 'https://www.example.com'; | ||
} | ||
debug.log({ url: this.url, props }); | ||
} | ||
|
||
copyUrl = () => { | ||
if (copy(this.url)) { | ||
toaster.success(translate('copiedToClipboard'), { | ||
id: 'pastebin-toaster', | ||
}); | ||
} | ||
}; | ||
|
||
render() { | ||
return ( | ||
<Pane | ||
display="flex" | ||
flex={1} | ||
width="100%" | ||
height="100%" | ||
alignItems="center" | ||
justifyContent="center" | ||
backgroundColor="rgba(0, 0, 0, 0.9)" | ||
> | ||
<Pane display="flex" flexDirection="column" width="50%" maxWidth={800}> | ||
<span className="bin"> | ||
<input type="text" value={this.url || ''} readOnly /> | ||
<button className="copy" title={translate('copy')} onClick={this.copyUrl}> | ||
<DuplicateIcon /> | ||
</button> | ||
</span> | ||
<Paragraph size={300} color="muted" marginTop={16}> | ||
{translate('pasteBinTip', [60, translate('seconds')])} | ||
</Paragraph> | ||
</Pane> | ||
</Pane> | ||
); | ||
} | ||
} |
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,43 @@ | ||
.bin { | ||
position: relative; | ||
display: flex; | ||
align-items: center; | ||
width: 100%; | ||
|
||
> input { | ||
font-size: 14px; | ||
color: #d0d0d0; | ||
background-color: transparent; | ||
border: 2px solid #db9d61; | ||
border-radius: 4px; | ||
padding: 10px 48px 10px 16px; | ||
width: 100%; | ||
&:hover, | ||
&:active, | ||
&:focus { | ||
outline: none; | ||
} | ||
} | ||
|
||
> button.copy { | ||
position: absolute; | ||
// top: 10px; | ||
right: 10px; | ||
border: none; | ||
outline: none; | ||
background-color: transparent; | ||
display: flex; | ||
cursor: pointer; | ||
opacity: 0.5; | ||
&:hover { | ||
opacity: 1; | ||
} | ||
svg { | ||
path { | ||
fill: #d0d0d0; | ||
} | ||
width: 16px; | ||
height: 16px; | ||
} | ||
} | ||
} |
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