-
Notifications
You must be signed in to change notification settings - Fork 8
Fix: FreeCodeCamp-Chengdu/HOP#32 #35
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: main
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import React from 'react'; | ||
| import { Container, Row, Col, Button } from 'react-bootstrap'; | ||
| import { useRouter } from 'next/router'; | ||
|
|
||
| const HomePage: React.FC = () => { | ||
| const router = useRouter(); | ||
|
|
||
| const handleGetStarted = () => { | ||
| router.push('/get-started'); | ||
| }; | ||
|
|
||
| return ( | ||
| <Container fluid className="hero-section"> | ||
| <Row className="justify-content-center"> | ||
| <Col md={8} className="text-center"> | ||
| <h1>Welcome to Hackathon Open Platform</h1> | ||
| <p>Your gateway to a world of coding challenges and collaboration!</p> | ||
| <Button variant="primary" size="lg" onClick={handleGetStarted}>Get Started</Button> | ||
| </Col> | ||
| </Row> | ||
| </Container> | ||
| ); | ||
| }; | ||
|
|
||
| export default HomePage; | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,24 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .hero-section { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| height: 100vh; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| display: flex; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| justify-content: center; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| align-items: center; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| background: linear-gradient(to right, #007bff, #00c6ff); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| color: white; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| h1 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| font-size: 3rem; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| font-weight: bold; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| p { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| font-size: 1.2rem; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| margin: 20px 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| button { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| font-size: 1.2rem; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| padding: 10px 20px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| border-radius: 5px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+10
to
+24
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. 🛠️ Refactor suggestion | 🟠 Major Element selectors leak globally and break CSS module scoping. The ♻️ Proposed fix using nested selectors under .hero-section .hero-section {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background: linear-gradient(to right, `#007bff`, `#00c6ff`);
color: white;
}
-h1 {
+.hero-section h1 {
font-size: 3rem;
font-weight: bold;
}
-p {
+.hero-section p {
font-size: 1.2rem;
margin: 20px 0;
}
-button {
+.hero-section button {
font-size: 1.2rem;
padding: 10px 20px;
border-radius: 5px;
}Alternatively, define explicit class names (e.g., 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
CSS module is not imported—styles will not be applied.
The
className="hero-section"on Line 13 references the CSS module class, but the module itself is never imported. The hero section will render without any styling.🐛 Proposed fix to import and use the CSS module
import React from 'react'; import { Container, Row, Col, Button } from 'react-bootstrap'; import { useRouter } from 'next/router'; +import styles from '../../styles/homepage.module.css'; const HomePage: React.FC = () => { const router = useRouter(); const handleGetStarted = () => { router.push('/get-started'); }; return ( - <Container fluid className="hero-section"> + <Container fluid className={styles['hero-section']}> <Row className="justify-content-center">📝 Committable suggestion
🤖 Prompt for AI Agents