-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
added the button only using tailwind #142
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
69cebfd
Added Button. Issue: #66
maitri-vv 2f92d19
Merge branch 'main' of https://github.com/RamakrushnaBiswal/PlayCafe
maitri-vv 33972d7
Updated the CSS for button
maitri-vv 5b59584
removed it
maitri-vv e857ce6
Merge branch 'main' of https://github.com/maitri-vv/PlayCafe
maitri-vv 8b68c29
Done changes
maitri-vv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,51 @@ | ||
// src/App.js | ||
|
||
import "./App.css"; | ||
import Navbar from "../src/components/Shared/Navbar"; | ||
import './App.css'; | ||
import Navbar from '../src/components/Shared/Navbar'; | ||
import Footer from "../src/components/Shared/Footer"; | ||
import { Outlet } from "react-router-dom"; | ||
import { AuthProvider } from './components/Shared/AuthContext'; | ||
import { Outlet } from 'react-router-dom'; | ||
import React, { useState, useEffect } from 'react'; | ||
import { KindeProvider } from "@kinde-oss/kinde-auth-react"; | ||
|
||
function App() { | ||
const [showButton, setShowButton] = useState(false); | ||
|
||
// Show the "Back to Top" button when the user scrolls down | ||
useEffect(() => { | ||
const handleScroll = () => { | ||
const isBottom = window.innerHeight + window.scrollY >= document.body.offsetHeight - 100; | ||
setShowButton(isBottom); | ||
}; | ||
|
||
window.addEventListener("scroll", handleScroll); | ||
|
||
return () => window.removeEventListener("scroll", handleScroll); | ||
}, []); | ||
|
||
const scrollToTop = () => { | ||
window.scrollTo({ top: 0, behavior: 'smooth' }); | ||
}; | ||
|
||
return ( | ||
<AuthProvider> | ||
<KindeProvider | ||
clientId={import.meta.env.VITE_KINDE_CLIENT_ID} | ||
domain={import.meta.env.VITE_KINDE_DOMAIN} | ||
redirectUri={import.meta.env.VITE_KINDE_REDIRECT_URI} | ||
logoutUri={import.meta.env.VITE_KINDE_LOGOUT_REDIRECT_URI} | ||
> | ||
<Navbar /> | ||
<Outlet /> | ||
<Footer /> | ||
</KindeProvider> | ||
</AuthProvider> | ||
clientId={import.meta.env.VITE_KINDE_CLIENT_ID} | ||
domain={import.meta.env.VITE_KINDE_DOMAIN} | ||
redirectUri={import.meta.env.VITE_KINDE_REDIRECT_URI} | ||
logoutUri={import.meta.env.VITE_KINDE_LOGOUT_REDIRECT_URI} | ||
> | ||
<Navbar /> | ||
<Outlet /> | ||
<Footer /> | ||
|
||
{showButton && ( | ||
<button | ||
onClick={scrollToTop} | ||
className="fixed bottom-8 right-8 bg-[#E0F0B1] hover:bg-amber-300 text-white font-bold py-2 px-4 rounded-full shadow-lg transition-transform duration-300 transform hover:scale-110" > | ||
↑ | ||
</button> | ||
)} | ||
</KindeProvider> | ||
); | ||
} | ||
|
||
export default App; | ||
export default App; |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider using Tailwind's animation utilities instead of custom CSS keyframes.
While the added
bounce
animation doesn't contradict the PR objectives, Tailwind CSS provides built-in animation utilities that could be used instead. This would align better with the goal of using "only Tailwind" for styling.Instead of defining a custom keyframe animation, you can use Tailwind's
animate-bounce
class directly in your JSX. For example:If you need to customize the animation, you can extend Tailwind's animation configuration in the
tailwind.config.js
file:Then use it in your JSX:
This approach maintains the use of Tailwind for all styling, including animations.