Scroll to top button

This commit is contained in:
2022-11-12 12:50:49 +02:00
parent a0658cd508
commit 3fc9245053
5 changed files with 40 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
import React from 'react';
import Image from 'next/image';
import styles from '../styles/ScrollToTop.module.scss';
export const ScrollToTop = () => {
return (
<a className={styles.scrollToTopButton} href='#top'>
<Image
src='/angle-top.png'
alt='scroll to top button'
width={15}
height={9}
loading='lazy'
/>
</a>
);
};

View File

@@ -1,6 +1,7 @@
import styles from '../styles/Index.module.scss'; import styles from '../styles/Index.module.scss';
import Image from 'next/image'; import Image from 'next/image';
import { OpenHours } from '../components/OpenHours'; import { OpenHours } from '../components/OpenHours';
import { ScrollToTop } from '../components/ScrollToTop';
export default function Index() { export default function Index() {
return ( return (
@@ -16,6 +17,7 @@ export default function Index() {
alt='main' alt='main'
width={528} width={528}
height={237} height={237}
loading='lazy'
/> />
<h1 className={styles.title}>Kauppa&Ravintola&Kahvila&Baari</h1> <h1 className={styles.title}>Kauppa&Ravintola&Kahvila&Baari</h1>
</header> </header>
@@ -29,6 +31,7 @@ export default function Index() {
alt='shop keepers' alt='shop keepers'
width={251} width={251}
height={251} height={251}
loading='lazy'
/> />
<span className={styles.emailAddress}> <span className={styles.emailAddress}>
info@livonsaarenosuuskauppa.fi info@livonsaarenosuuskauppa.fi
@@ -43,6 +46,7 @@ export default function Index() {
alt='facebook' alt='facebook'
width={300} width={300}
height={300} height={300}
loading='lazy'
/> />
</a> </a>
<a href='https://www.instagram.com/livonsaaren_osuuskauppa/'> <a href='https://www.instagram.com/livonsaaren_osuuskauppa/'>
@@ -53,6 +57,7 @@ export default function Index() {
alt='facebook' alt='facebook'
width={300} width={300}
height={300} height={300}
loading='lazy'
/> />
</a> </a>
</div> </div>
@@ -86,6 +91,7 @@ export default function Index() {
alt='restaurant' alt='restaurant'
width={506} width={506}
height={89} height={89}
loading='lazy'
/> />
<h1 className={styles.title}>Alla kesäkauden tarjoilut</h1> <h1 className={styles.title}>Alla kesäkauden tarjoilut</h1>
<div className={styles.menuContainer}> <div className={styles.menuContainer}>
@@ -122,6 +128,7 @@ export default function Index() {
alt='yhteystyö' alt='yhteystyö'
width={496} width={496}
height={326} height={326}
loading='lazy'
/> />
</section> </section>
@@ -139,6 +146,8 @@ export default function Index() {
</section> </section>
<span className={styles.separator} /> <span className={styles.separator} />
<ScrollToTop />
</div> </div>
</div> </div>
); );

BIN
public/angle-top.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@@ -0,0 +1,13 @@
.scrollToTopButton {
padding: 1.5rem 3rem;
border-radius: 0.5rem;
transition: all 0.3s;
margin: 1rem;
}
.scrollToTopButton:hover {
opacity: 0.5;
}
.scrollToTopImage {
}

View File

@@ -4,6 +4,7 @@ body {
margin: 0; margin: 0;
font-family: 'Quicksand'; font-family: 'Quicksand';
letter-spacing: 0.8px; letter-spacing: 0.8px;
scroll-behavior: smooth;
} }
@font-face { @font-face {