-
Notifications
You must be signed in to change notification settings - Fork 0
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
Navbar #7
base: main
Are you sure you want to change the base?
Navbar #7
Changes from 3 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,58 @@ | ||
// components/Hero.tsx | ||
import React from 'react' | ||
import { Box, Typography, Container } from '@mui/material' | ||
|
||
interface HeroProps { | ||
imageUrl: string | ||
title: string | ||
subtitle?: string | ||
} | ||
|
||
const Hero: React.FC<HeroProps> = ({ imageUrl, title, subtitle }) => { | ||
return ( | ||
<Box | ||
sx={{ | ||
height: '500px', | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
backgroundImage: `url(${imageUrl})`, | ||
backgroundSize: 'cover', | ||
backgroundPosition: 'center', | ||
position: 'relative', | ||
color: 'white', | ||
}} | ||
> | ||
DevTrav marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{/* Overlay */} | ||
<Box | ||
sx={{ | ||
position: 'absolute', | ||
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. 🤔 seems a little bit odd... I'm not sure why the absolute positioning is being used here. Are you just wanting to center this element? 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. Also seems odd to have a |
||
top: 0, | ||
left: 0, | ||
width: '100%', | ||
height: '100%', | ||
backgroundColor: 'rgba(0, 0, 0, 0.5)', | ||
zIndex: 1, | ||
}} | ||
/> | ||
<Container | ||
DevTrav marked this conversation as resolved.
Show resolved
Hide resolved
|
||
sx={{ | ||
position: 'relative', | ||
zIndex: 2, | ||
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. 🤔 can we accomplish this without 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. In the Hero component example, the zIndex is used to control the layering of the overlay, background image, and text. It appears to be semantically aligned with MUI's best practices. 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. You should be able to just rely on the default stacking order for these elements. |
||
textAlign: 'center', | ||
}} | ||
> | ||
<Typography variant="h2" component="h1" fontWeight="bold"> | ||
DevTrav marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{title} | ||
</Typography> | ||
{subtitle && ( | ||
<Typography variant="h5" component="p" mt={2}> | ||
{subtitle} | ||
</Typography> | ||
)} | ||
</Container> | ||
</Box> | ||
) | ||
} | ||
|
||
export default Hero |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,97 @@ | ||
import Image from 'next/image' | ||
import * as React from 'react' | ||
import Paper from '@mui/material/Paper' | ||
import Stack from '@mui/material/Stack' | ||
import { Button, Divider } from '@mui/material' | ||
|
||
// const Item = styled(Paper)(({ theme }) => ({ | ||
// backgroundColor: '#fff', | ||
DevTrav marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// ...theme.typography.body2, | ||
// padding: theme.spacing(1), | ||
// textAlign: 'center', | ||
// color: theme.palette.text.secondary, | ||
// ...theme.applyStyles('dark', { | ||
// backgroundColor: '#1A2027', | ||
// }), | ||
// })) | ||
// app/page.tsx | ||
import { Box, Typography, Container } from '@mui/material' | ||
|
||
interface HeroProps { | ||
imageUrl: string | ||
title: string | ||
subtitle?: string | ||
} | ||
|
||
const Hero: React.FC<HeroProps> = ({ imageUrl, title, subtitle }) => { | ||
return ( | ||
DevTrav marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<Box | ||
sx={{ | ||
height: '500px', | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
backgroundImage: `url(${imageUrl})`, | ||
backgroundSize: 'cover', | ||
backgroundPosition: 'center', | ||
position: 'relative', | ||
color: 'white', | ||
}} | ||
> | ||
{/* Overlay */} | ||
<Box | ||
sx={{ | ||
position: 'absolute', | ||
top: 0, | ||
left: 0, | ||
width: '100%', | ||
height: '100%', | ||
backgroundColor: 'rgba(0, 0, 0, 0.5)', | ||
zIndex: 1, | ||
}} | ||
/> | ||
<Container | ||
sx={{ | ||
position: 'relative', | ||
zIndex: 2, | ||
textAlign: 'center', | ||
}} | ||
> | ||
<Typography variant="h2" component="h1" fontWeight="bold"> | ||
{title} | ||
</Typography> | ||
{subtitle && ( | ||
<Typography variant="h5" component="p" mt={2}> | ||
{subtitle} | ||
</Typography> | ||
)} | ||
</Container> | ||
</Box> | ||
) | ||
} | ||
|
||
export default function Home() { | ||
return ( | ||
<main> | ||
<h1> Home </h1> | ||
<h1> Texas Defense Data </h1> | ||
<p> The only site for publicly available indigent defense data</p> | ||
<div> | ||
<Hero | ||
imageUrl="https://example.com/your-image.jpg" | ||
title="Welcome to Our Website" | ||
subtitle="Explore the best content here" | ||
/> | ||
</div> | ||
<div> | ||
<Stack | ||
direction="row" | ||
spacing={2} | ||
divider={<Divider orientation="vertical" flexItem />} | ||
> | ||
<Paper>Paper 1</Paper> | ||
<Paper>Paper 2</Paper> | ||
<Button>Paper 3</Button> | ||
</Stack> | ||
</div> | ||
</main> | ||
) | ||
} |
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.
Is the color here for the inner text elements? If so I would add color attributes to the specific element and not this parent.