home: add sticky cart link

This commit is contained in:
andr-ew 2023-07-26 23:15:23 -05:00
parent d5f8c6633e
commit 95f6ef06bb
7 changed files with 66 additions and 3 deletions

View File

@ -1,11 +1,16 @@
import { HomeNav, HomeFooter } from '/components/home'; import { HomeNav, HomeFooter, CartLink } from '/components/home';
import styles from './styles.module.scss'; import styles from './styles.module.scss';
export default function HomeLayout({ children }) { export default function HomeLayout({ children }) {
return ( return (
<> <>
<header> {/* <div className={styles.scrollContainer}> */}
<div className={styles.spacer} />
<div className={styles.scrollContainer}>
<CartLink />
</div>
<header className={styles.header}>
<nav> <nav>
<HomeNav /> <HomeNav />
</nav> </nav>
@ -14,6 +19,7 @@ export default function HomeLayout({ children }) {
<footer> <footer>
<HomeFooter /> <HomeFooter />
</footer> </footer>
{/* </div> */}
</> </>
); );
} }

View File

@ -1,5 +1,24 @@
@use 'styles/_spacing'; @use 'styles/_spacing';
.scrollContainer {
position: absolute;
height: calc(100% - 822px);
right: spacing.$page-margin-x;
// float: right;
}
.spacer {
height: spacing.$home-spacer-y;
}
.header {
overflow: visible;
> nav {
overflow: visible;
}
}
.main { .main {
padding: 0 spacing.$page-margin-x; padding: 0 spacing.$page-margin-x;
} }

View File

@ -2,6 +2,7 @@
.body { .body {
background-color: colors.$grey-tint; background-color: colors.$grey-tint;
// isolation: isolate;
font-family: var(--font-dia); font-family: var(--font-dia);

View File

@ -102,6 +102,14 @@ export async function TypesNav() {
); );
} }
export const CartLink = () => (
/* <div className={styles.cartLink}> */
<Link className={styles.cartLink} href='/cart'>
Cart ( 0 )
</Link>
// </div>
);
export const HomeNav = () => ( export const HomeNav = () => (
<div className={styles.homeNav}> <div className={styles.homeNav}>
<Link href='/information' className='information'> <Link href='/information' className='information'>

View File

@ -9,7 +9,9 @@
} }
.homeNav { .homeNav {
padding: 51px 115px 22px 115px; padding: (51px - spacing.$home-spacer-y) 115px 22px 115px;
overflow: visible;
display: grid; display: grid;
grid-template-columns: 200px 1fr 200px; grid-template-columns: 200px 1fr 200px;
@ -38,6 +40,24 @@
} }
} }
.cartLink {
position: sticky;
overflow: visible;
top: 12px;
@include typography.subheader;
text-align: right;
word-wrap: none;
text-decoration-line: none;
mix-blend-mode: difference;
// mix-blend-mode: exclusion;
z-index: 10;
color: #fff !important;
}
.homeProductsList { .homeProductsList {
@include home-grid; @include home-grid;
@ -140,6 +160,7 @@
> div { > div {
display: flex; display: flex;
align-items: flex-end; align-items: flex-end;
justify-content: flex-end;
} }
button { button {

View File

@ -1 +1,2 @@
$page-margin-x: 60px; $page-margin-x: 60px;
$home-spacer-y: 13px + 12px;

View File

@ -1 +1,8 @@
@use 'scss-reset/reset'; @use 'scss-reset/reset';
html,
body {
// overflow: hidden;
// height: 100%;
}