In 2023 and with NextJS 13, the Image
-API has changed. Working with the new app directory and new naming-convention of NextJS 13, this is what I did to accomplish requested behavior:
// page.jsx
import styles from './page.module.css';
import logo from '../public/logo.png';
export default function Home() {
return (
<div className={styles.logoContainer}>
<Image src={logo} alt='Argo Logo' fill />
</div>
);
}
/* page.module.css */
.logoContainer {
position: relative;
overflow: hidden;
width: 158.57px;
height: 30.93px;
}
@media (max-width: 500px) and (orientation: portrait) {
.logoContainer {
width: 79.285px;
height: 15.465px;
}
}