add Header component

This commit is contained in:
oscar 2023-03-18 11:01:39 +13:00
parent 2c22f8223e
commit 7f49cd68e2
3 changed files with 49 additions and 0 deletions

BIN
src/assets/meals.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 407 KiB

View File

@ -0,0 +1,20 @@
import React from 'react';
import mealsImage from '../../assets/meals.jpg';
import classes from './Header.module.css';
const Header = () => {
return <>
<header className={classes.header}>
<h1>ReactMeals</h1>
<button>Cart</button>
</header>
<div className={classes['main-image']}>
<img src={mealsImage} alt="A table full of delicious food!" />
</div>
</>
};
export default Header;

View File

@ -0,0 +1,29 @@
.header {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 5rem;
background-color: #8a2b06;
color: white;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 10%;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
z-index: 10;
}
.main-image {
width: 100%;
height: 25rem;
z-index: 0;
overflow: hidden;
}
.main-image img {
width: 110%;
height: 100%;
object-fit: cover;
transform: rotateZ(-5deg) translateY(-4rem) translateX(-1rem);
}