Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

29 add toast component that instructs user to allow location services #46

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions front-end/src/components/Toast/Toast.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.toast {
background-color: --info;
padding-top: 5rem;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

padding for TopNav

z-index: 1000;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes it so Toast always shows at the front

}

.toast.show {
transform: translateX(0px);
}
33 changes: 33 additions & 0 deletions front-end/src/components/Toast/Toast.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import './Toast.css'
// import { useState } from 'react'

export default function Toast({
show = true,
toastMessage = 'Verify Location'
}) {
// TODO: make self contained
// Toast component will have to be useState'd in separate file
// const [show, setShow] = useState(false)
// const [toastMessage, setToastMessage] = useState(false)
// useImperativeHandle(ref, () => ({
// showToast(msg = '') {
// setShow(true)
// setToastMessage(msg)
// setTimeout(() => {
// setShow(false)
// }, timeout)
// }
// }))

return show ? (
<div className="toast toast-top toast-end">
<div className="alert alert-info">
<div>
<span>{toastMessage}</span>
</div>
</div>
</div>
) : (
<></>
)
}
5 changes: 5 additions & 0 deletions front-end/src/containers/App/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import FeedPage from '../../routes/feed/FeedPage'
import BottomNav from '../../components/BottomNav/BottomNav'
import UploadPage from '../../routes/upload/UploadPage'
import StoopMapPage from '../../routes/map/[id]/StoopMapPage'
import Toast from '../../components/Toast/Toast'
import { MapProvider } from '../../context/map'

const App = () => {
Expand All @@ -26,6 +27,10 @@ const App = () => {
}}
>
<div className="app">
<Toast
show={error}
toastMessage="Please Allow Location Services"
/>
<main>
<Routes>
<Route
Expand Down