-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added redux, copy pass, tidied up css
- Loading branch information
1 parent
79d3750
commit 2202ccc
Showing
28 changed files
with
48,458 additions
and
47,132 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
Binary file not shown.
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
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,25 @@ | ||
import React from 'react'; | ||
import '../css/style.css'; | ||
import NumSelect from './NumSelect'; | ||
import Buttons from './Buttons'; | ||
import {Words} from './Words'; | ||
import WordButtons from './WordButtons'; | ||
import CopyButton from './CopyButton'; | ||
|
||
class App extends React.Component { | ||
|
||
|
||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
number: 8, | ||
textToCopy: "" | ||
}; | ||
} | ||
|
||
handleNumberClick = (e) => { | ||
console.log("clicked: ", e.target.value) | ||
this.setState({ | ||
number: e.target.value | ||
}) | ||
} | ||
|
||
handleNewPass = (words) => { | ||
console.log("words: ", words) | ||
this.setState({ | ||
textToCopy: words | ||
}) | ||
} | ||
|
||
render() { | ||
return ( | ||
<div className="App"> | ||
<NumSelect number={this.state.number} handleNewPass={this.handleNewPass} /> | ||
<Buttons handleNumberClick={this.handleNumberClick} /> | ||
<CopyButton textToCopy={this.state.textToCopy}/> | ||
</div> | ||
); | ||
} | ||
render() { | ||
return ( | ||
<div className="App"> | ||
<div id={"content-wrap"}> | ||
<Words /> | ||
<WordButtons /> | ||
<CopyButton /> | ||
</div> | ||
<div id={"footer"}> | ||
Inspired by <a href={"https://diceware.herokuapp.com/"}>Michael Henriksen</a> | Created by <a href={"https://twitter.com/RMcElhinney"}>Rob McElhinney</a> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default App; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,66 @@ | ||
import React, {useState, useEffect} from 'react'; | ||
import React from 'react'; | ||
import { connect } from "react-redux"; | ||
import '../css/style.css'; | ||
import * as myConstClass from '../constants.js'; | ||
import Tooltip from '@material-ui/core/Tooltip'; | ||
import ClickAwayListener from '@material-ui/core/ClickAwayListener'; | ||
|
||
|
||
const CopyButton = (props) => { | ||
const mapStateToProps = state => { | ||
return { pass: state.pass }; | ||
}; | ||
|
||
|
||
// const copyPass = () => { | ||
// alert("Copied") | ||
// } | ||
const CopyButtonPass = ({pass}) => { | ||
|
||
const [open, setOpen] = React.useState(false); | ||
|
||
return ( | ||
<button className="word-count-button font-bold py-2 px-4 | ||
hover:border-blue-500 rounded my-2 mx-2 .w-2" | ||
onClick={() => {navigator.clipboard.writeText(props.textToCopy)}}> | ||
Copy Password | ||
</button> | ||
); | ||
} | ||
const handleTooltipClose = () => { | ||
setOpen(false); | ||
}; | ||
|
||
const handleTooltipOpen = () => { | ||
setOpen(true); | ||
}; | ||
|
||
const copyPass = () => { | ||
navigator.clipboard.writeText(pass) | ||
handleTooltipOpen() | ||
} | ||
|
||
if(navigator.clipboard === undefined) { | ||
return (null) | ||
} | ||
else{ | ||
return ( | ||
<ClickAwayListener onClickAway={handleTooltipClose}> | ||
<div> | ||
<Tooltip | ||
PopperProps={{ | ||
disablePortal: true, | ||
}} | ||
onClose={handleTooltipClose} | ||
open={open} | ||
disableFocusListener | ||
disableHoverListener | ||
disableTouchListener | ||
title="Copied" | ||
arrow | ||
> | ||
<button className="word-count-button font-bold py-2 px-4 | ||
hover:text-purple-500 hover:border-purple-500 rounded | ||
my-2 mx-2 .w-2 text-sm border" | ||
onClick={() => {copyPass()}} | ||
> | ||
Copy Passphrase | ||
</button> | ||
</Tooltip> | ||
</div> | ||
</ClickAwayListener> | ||
); | ||
} | ||
} | ||
|
||
const CopyButton = connect(mapStateToProps)(CopyButtonPass); | ||
|
||
export default CopyButton; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.