-
Notifications
You must be signed in to change notification settings - Fork 25
Chore: Tailwind Refactoring #152
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| module.exports = { | ||
| plugins: [ | ||
| require('tailwindcss'), | ||
| require('autoprefixer') | ||
| ], | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| import './Celebration.css'; | ||
| import React, { useRef } from 'react'; | ||
| import ShareButton from './../sharebutton/ShareButton'; | ||
| import PropTypes from 'prop-types'; | ||
|
|
@@ -9,22 +8,111 @@ export default function Celebration({ | |
| handleRestartGame, | ||
| }) { | ||
| const highScoreRef = useRef(null); | ||
|
|
||
| return ( | ||
| <div className='celebration-container'> | ||
| <div className='celebration-notification'> | ||
| <p ref={highScoreRef}> | ||
| Highscore achieved: <span>{highScore}</span> | ||
| <br /> | ||
| </p> | ||
| { | ||
| <p> | ||
| <span>{elapsedTime}s</span> | ||
| </p> | ||
| <div | ||
| style={{ | ||
| position: 'fixed', | ||
| top: '50%', | ||
| left: '50%', | ||
| transform: 'translate(-50%, -50%)', | ||
| zIndex: 9999, | ||
| width: '90%', | ||
| maxWidth: '500px', | ||
| backgroundColor: 'rgba(0, 0, 0, 0.9)', | ||
| backdropFilter: 'blur(10px)', | ||
| borderRadius: '12px', | ||
| padding: '40px 30px', | ||
| textAlign: 'center', | ||
| boxShadow: '0 8px 32px rgba(0, 0, 0, 0.5)', | ||
| animation: 'fadeIn 0.5s ease-in-out', | ||
| }} | ||
| > | ||
|
Comment on lines
+15
to
+30
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are here so many inline Styles?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually I first tried tailwind implementation, but it was not that effective. That's why I switched to inline for more prioritized CSS. |
||
| <style>{` | ||
| @keyframes fadeIn { | ||
| from { opacity: 0; } | ||
| to { opacity: 1; } | ||
| } | ||
| <div className='button'> | ||
| <ShareButton highScore={highScore} highScoreRef={highScoreRef} /> | ||
| </div> | ||
| <button onClick={handleRestartGame} className='restart-btn'> | ||
| `}</style> | ||
|
|
||
| <p | ||
| ref={highScoreRef} | ||
| style={{ | ||
| margin: 0, | ||
| padding: 0, | ||
| fontSize: '24px', | ||
| fontWeight: '600', | ||
| color: '#06b6d4', | ||
| marginBottom: '20px', | ||
| }} | ||
| > | ||
| Highscore achieved:{' '} | ||
| <span | ||
| style={{ | ||
| color: '#84cc16', | ||
| fontSize: '32px', | ||
| fontWeight: 'bold', | ||
| display: 'inline-block', | ||
| marginLeft: '10px', | ||
| }} | ||
| > | ||
| {highScore} | ||
| </span> | ||
| </p> | ||
|
|
||
| <p | ||
| style={{ | ||
| margin: 0, | ||
| padding: 0, | ||
| fontSize: '18px', | ||
| color: '#06b6d4', | ||
| marginBottom: '30px', | ||
| }} | ||
| > | ||
| Time:{' '} | ||
| <span | ||
| style={{ | ||
| color: '#84cc16', | ||
| fontWeight: 'bold', | ||
| }} | ||
| > | ||
| {elapsedTime}s | ||
| </span> | ||
| </p> | ||
|
|
||
| <div | ||
| style={{ | ||
| display: 'flex', | ||
| flexDirection: 'column', | ||
| gap: '15px', | ||
| alignItems: 'center', | ||
| }} | ||
| > | ||
| <ShareButton highScore={highScore} highScoreRef={highScoreRef} /> | ||
| <button | ||
| onClick={handleRestartGame} | ||
| style={{ | ||
| padding: '12px 24px', | ||
| border: '2px solid #06b6d4', | ||
| backgroundColor: 'transparent', | ||
| color: '#06b6d4', | ||
| fontWeight: '600', | ||
| fontSize: '16px', | ||
| borderRadius: '6px', | ||
| cursor: 'pointer', | ||
| width: '100%', | ||
| transition: 'all 0.3s ease', | ||
| boxSizing: 'border-box', | ||
| }} | ||
| onMouseEnter={e => { | ||
| e.target.style.backgroundColor = 'rgba(6, 182, 212, 0.1)'; | ||
| e.target.style.transform = 'scale(1.02)'; | ||
| }} | ||
| onMouseLeave={e => { | ||
| e.target.style.backgroundColor = 'transparent'; | ||
| e.target.style.transform = 'scale(1)'; | ||
| }} | ||
| > | ||
| Restart Game | ||
| </button> | ||
| </div> | ||
|
|
||
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.
maybe use tailwind 4
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.
Tailwind v3 is more stable than v4, that's why i used it.