-
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.
Merge pull request #1 from juadecha/modificacion_e3
Cambios del entregable 3
- Loading branch information
Showing
96 changed files
with
1,712 additions
and
6,213 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 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,18 +1,30 @@ | ||
import React from 'react' | ||
|
||
class Backtotop extends React.Component { | ||
public render () { | ||
|
||
return( | ||
<div className="container-fluid"> | ||
<div className="row-fluid"> | ||
<div id="fav-backtotop" className="span12"> | ||
<a href="localhost:3000" className="backtop" title="BACK TO TOP"><i className="fa fa-angle-up" /> | ||
</a> | ||
</div> | ||
</div> | ||
import React, {useState} from 'react'; | ||
|
||
|
||
const ScrollButton = () =>{ | ||
|
||
//Controlamos con un Hook si debemos mostrar el botón | ||
const [showScroll, setShowScroll] = useState(false) | ||
|
||
const checkScrollTop = () => { | ||
if (!showScroll && window.pageYOffset > 400){ | ||
setShowScroll(true) | ||
} else if (showScroll && window.pageYOffset <= 400){ | ||
setShowScroll(false) | ||
} | ||
}; | ||
|
||
const scrollTop = () =>{ | ||
window.scrollTo({top: 0, behavior: 'smooth'}); | ||
}; | ||
|
||
window.addEventListener('scroll', checkScrollTop) | ||
|
||
return ( | ||
<div> | ||
<i className="fa fa-arrow-circle-up fa-3x scrollTop" onClick={scrollTop} style={{display: showScroll ? 'flex' : 'none'}}/> | ||
</div> | ||
) } | ||
); | ||
} | ||
|
||
export default Backtotop; | ||
export default ScrollButton; |
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
Oops, something went wrong.