Skip to content

Commit

Permalink
Footer component
Browse files Browse the repository at this point in the history
  • Loading branch information
bgonp committed Mar 27, 2021
1 parent 0f3f5a9 commit a4ea2b2
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/components/Footer.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { useContext } from 'react'
import { DrawContext } from 'react-drawarea'

import Button from '@components/Button'
import RestartIcon from '@components/RestartIcon'
import UndoIcon from '@components/UndoIcon'
import styles from '@styles/components/Footer.module.css'

const Footer = ({ solved, handleRestart, handleSolve }) => {
const { undo, reset } = useContext(DrawContext)

const onRestart = () => {
handleRestart()
reset()
}

return (
<div className={styles.footer}>
{
solved
? <Button grow primary onClick={onRestart}><RestartIcon /></Button>
: (
<>
<Button grow secondary onClick={handleSolve}>SOLVE</Button>
<Button primary onClick={undo}><UndoIcon /></Button>
</>
)
}
</div>
)
}

export default Footer
4 changes: 4 additions & 0 deletions src/styles/components/Footer.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.footer {
display: flex;
z-index: 1;
}

0 comments on commit a4ea2b2

Please sign in to comment.