-
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 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,70 @@ | ||
import * as React from 'react'; | ||
import { Stack, Typography, Container, Divider } from '@mui/material'; | ||
|
||
interface HeroProps { | ||
imageUrl: string; | ||
title: string; | ||
subtitle?: string; | ||
children?: React.ReactNode; | ||
} | ||
|
||
const Hero: React.FC<HeroProps> = ({ imageUrl, title, subtitle, children }) => { | ||
return ( | ||
<Stack | ||
sx={{ | ||
height: '500px', | ||
backgroundImage: `url(${imageUrl})`, | ||
backgroundSize: 'cover', | ||
backgroundPosition: 'center', | ||
position: 'relative', | ||
color: 'white', | ||
}} | ||
// Using Stack properties to control layout | ||
alignItems="center" | ||
justifyContent="center" | ||
> | ||
{/* Overlay */} | ||
<Stack | ||
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> | ||
)} | ||
{children && ( | ||
<Stack | ||
direction="row" | ||
spacing={2} | ||
divider={<Divider orientation="vertical" flexItem />} | ||
mt={3} | ||
justifyContent="center" | ||
> | ||
{children} | ||
</Stack> | ||
)} | ||
</Container> | ||
</Stack> | ||
); | ||
}; | ||
|
||
export default Hero; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,23 @@ | ||
import Image from 'next/image' | ||
import * as React from 'react'; | ||
import Hero from '@/app/components/hero'; | ||
import { Box, Typography, Button } from '@mui/material'; | ||
|
||
export default function Home() { | ||
return ( | ||
<main> | ||
<h1> Home </h1> | ||
<Hero | ||
imageUrl="https://example.com/your-image.jpg" | ||
title="Texas Defense Data" | ||
subtitle="The only site for publicly available indigent defense data" | ||
> | ||
<Box sx={{ padding: 2 }}> | ||
<Typography variant="subtitle1">Label 1</Typography> | ||
</Box> | ||
<Box sx={{ padding: 2 }}> | ||
<Typography variant="subtitle1">Label 2</Typography> | ||
</Box> | ||
<Button variant="contained">Action</Button> | ||
</Hero> | ||
</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.