Skip to content

Commit

Permalink
feat: add signature to mobile landing
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronchan32 committed Jun 2, 2024
1 parent bf01516 commit d3f1d2a
Show file tree
Hide file tree
Showing 13 changed files with 71 additions and 62 deletions.
7 changes: 7 additions & 0 deletions src/app/assets/icons/cart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions src/app/components/Fruits/Fruits.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
svg {
display: none;
}
.fruit-container {
svg {
display: none;
}
width: calc(80dvw - 190px);
height: 60dvh;
height: min(60dvh, 350px);
width: calc(100% - 2 * $main-padding-mobile-inline - 20vw);
margin-inline: auto;
// border: 2px solid red;
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/Fruits/Fruits.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ export default function Fruits() {
Matter.Events.on(engine, 'beforeUpdate', limitMaxSpeed);

let barriers = [ground, leftWall, rightWall];
Events.on(mouseConstraint, 'startdrag', event => {
Events.on(mouseConstraint, 'startdrag', (event: any) => {
const body = event.body;

// Store the original inertia of the body
Expand All @@ -615,7 +615,7 @@ export default function Fruits() {
}
});

Events.on(mouseConstraint, 'enddrag', event => {
Events.on(mouseConstraint, 'enddrag', (event: any) => {
const body = event.body;

// Reset the inertia back to its original value
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/Navbar/Navbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ nav {
margin-bottom: clamp(15px, calc(10px + 1.2vw), 40px);
}

&:hover {
&:is(:hover, :focus-visible) {
background-color: #fcfcfc;
color: #212121;
}
Expand Down
37 changes: 3 additions & 34 deletions src/app/components/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import FocusTrap from 'focus-trap-react';
import { useHandleHamburger } from './hooks/useHandleHamburger';
import { useHandleScroll } from './hooks/useHandleScroll';
import Signature from '../Signature/Signature';
import CartIcon from '@/assets/icons/cart.svg';

type NavbarProps = {
pageRefs: {
Expand Down Expand Up @@ -108,6 +109,7 @@ export default function Navbar({ pageRefs }: NavbarProps) {
{/* <ApplyNow navContainerRef={navContainerRef} /> */}
{/* <FutureUpgrader/> */}
<Signature
hideMobile={true}
navContainerRef={navContainerRef}
hoveringCart={hoveringCart}
/>
Expand All @@ -120,40 +122,7 @@ export default function Navbar({ pageRefs }: NavbarProps) {
setHoveringCart(false);
}}
>
<svg
className="svg-cart"
xmlns="http://www.w3.org/2000/svg"
width="44"
height="25"
viewBox="0 0 44 25"
fill="none"
>
<path
d="M1.5 1.57288H42L37.4949 23.3151H6.08701L1.5 1.57288Z"
stroke="currentColor"
strokeWidth="2"
/>
<path
d="M4.5 15.5729L39.5 15.5729"
stroke="currentColor"
strokeWidth="2"
/>
<path
d="M3.5 8.57288H40.5"
stroke="currentColor"
strokeWidth="2"
/>
<path
d="M28.5 1.57288L27.5 23.0729"
stroke="currentColor"
strokeWidth="2"
/>
<path
d="M15.5 1.57288L16.5 23.0729"
stroke="currentColor"
strokeWidth="2"
/>
</svg>
<CartIcon className="svg-cart" />
<p>ADD ME TO CART</p>
</a>

Expand Down
9 changes: 0 additions & 9 deletions src/app/components/Navbar/hooks/useHandleScroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ export const useHandleScroll = ({
const themesElement = themesRef.current;
const faqElement = faqRef.current;
const applyElement = applyRef.current;
console.log(
mainElement,
landingElement,
overviewElement,
themesElement,
faqElement,
applyElement
);

/**
* Sets the current page
Expand All @@ -59,7 +51,6 @@ export const useHandleScroll = ({
applyElement
];
const handleScroll = () => {
console.log('test');
const scrollPosition = mainElement.scrollTop || 0;

pagesList.forEach((page, index) => {
Expand Down
10 changes: 6 additions & 4 deletions src/app/components/Signature/Signature.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
.signature {
display: none;
display: flex;
.hide-mobile {
display: none;

@media (min-width: $mobile-breakpoint) {
display: flex;
@media (min-width: $mobile-breakpoint) {
isplay: flex;
}
}

position: relative;
Expand All @@ -28,7 +31,6 @@
width: 100%;
height: 1px;
background-color: #bababa;
z-index: -1;
}
}
}
6 changes: 4 additions & 2 deletions src/app/components/Signature/Signature.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { handleHandwritingAnimation } from './util/handleHandwritingAnimation';
type SignatureProps = {
hoveringCart: boolean;
navContainerRef: RefObject<HTMLDivElement>;
hideMobile: boolean;
};

const APPLY_CONFIG = {
Expand All @@ -27,7 +28,8 @@ const FUTURE_CONFIG = {

export default function Signature({
hoveringCart,
navContainerRef
navContainerRef,
hideMobile
}: SignatureProps) {
const xElementRef = useRef<HTMLSpanElement>(null);
const applySVGRef = useRef<SVGSVGElement>(null);
Expand All @@ -52,7 +54,7 @@ export default function Signature({
}, [hoveringCart, navContainerRef]);

return (
<div className="signature">
<div className={`signature ${hideMobile ? 'hide-mobile' : ''}`}>
<div className="signature-container">
<span ref={xElementRef}>X</span>
<div className="line" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export const handleHandwritingAnimation = ({
const applyContainer = svgRef.current;
const navContainer = navContainerRef.current;
const xElement = xElementRef.current;
console.log('WEEEE');
console.log(applyContainer, navContainer, xElement);
if (!applyContainer || !navContainer || !xElement) return;
const navFullWidth = parseFloat(window.getComputedStyle(navContainer).width);
const navPadding = parseFloat(
Expand Down
Binary file modified src/app/opengraph-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 21 additions & 1 deletion src/app/pages/Landing/Landing.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#landing {
height: 100dvh;
h1,
h3 {
text-transform: uppercase;
Expand All @@ -23,6 +24,20 @@
display: none;
}

.landing-signature-container {
height: 80px;
margin-block: 1rem;
margin-inline: auto;
width: 80%;
display: flex;
justify-content: center;
flex-direction: column;

@media (min-width: $mobile-breakpoint) {
display: none;
}
}

.add-me-to-cart {
margin-inline: auto;
width: 80%;
Expand All @@ -38,7 +53,12 @@
flex-direction: row;
justify-content: center;
align-items: center;
gap: clamp(12px, 1vw, 22px);
gap: clamp(16px, 1vw, 22px);

&:is(:hover, :focus-visible) {
background-color: #fcfcfc;
color: #212121;
}
}

@media (min-width: $tablet-breakpoint) {
Expand Down
25 changes: 21 additions & 4 deletions src/app/pages/Landing/Landing.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
'use client';
import Sticker from '@/components/Sticker/Sticker';
import './Landing.scss';
import Fruits from '@/components/Fruits/Fruits';
import { PageRef } from '@/page';
import DcoSticker from '@/assets/stickers/dco-sticker.svg';
import Impact from '@/assets/stickers/impact.svg';
import CartIcon from '@/assets/icons/cart.svg';
import Signature from '@/components/Signature/Signature';
import { useRef } from 'react';

type LandingProps = {
landingRef: PageRef;
};

export default function Landing({ landingRef }: LandingProps) {
const signatureContainerRef = useRef<HTMLDivElement>(null);
return (
<section ref={landingRef} id="landing">
<Sticker
Expand All @@ -24,13 +29,25 @@ export default function Landing({ landingRef }: LandingProps) {
style={{ left: '10px', top: '55%' }}
hideMobile
/>
<div className="mobile-header">
<h1>up-grade 2024</h1>
<p>UCSD Design Co</p>
<p>San Diego, CA</p>
<h3>July 1st to September 6th</h3>
</div>
<p className="breadcrumb">.01 / Home</p>

<Fruits />
{/* <Signature
navContainerRef={navContainerRef}
hoveringCart={hoveringCart}
/> */}

<div ref={signatureContainerRef} className="landing-signature-container">
<Signature
hideMobile={false}
navContainerRef={signatureContainerRef}
hoveringCart={false}
/>
</div>
<a className="add-me-to-cart">
<CartIcon className="svg-cart" />
<p>ADD ME TO CART</p>
</a>
</section>
Expand Down
1 change: 0 additions & 1 deletion src/app/pages/Overview/Overview.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#overview {
margin-top: 120px;
overflow: hidden;
// Account for additional padding for theme page to allow squash to be visible
padding-bottom: calc(2 * $main-padding-mobile-block);
Expand Down

0 comments on commit d3f1d2a

Please sign in to comment.