Files
Shifted/.next/static/chunks/7-9f7e29ad73c893ae.js
2026-02-10 01:14:19 +00:00

1 line
8.5 KiB
JavaScript

"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7],{155:function(e,a,s){s.d(a,{default:function(){return t}});var r=s(7437),n=s(7648),l=s(2265),c=s(1276),o=s(605);let i=["/icons/merchicon1.png","/icons/merchicon2.png","/icons/merchicon3.png","/icons/merchicon4.png"];function t(e){let{forceScrolled:a=!1}=e,[s,t,d,h,u,m,_,p]=c.a,[f,x]=(0,l.useState)(0),[g,v]=(0,l.useState)(a),{data:j,status:N}=(0,o.useSession)();return"authenticated"===N&&(j.user.name||j.user.email),(0,l.useEffect)(()=>{let e=setInterval(()=>x(e=>(e+1)%i.length),3e3);return()=>clearInterval(e)},[]),(0,l.useEffect)(()=>{if(a){v(!0);return}let e=()=>{if(window.innerWidth<981){v(!1);return}let e=window.scrollY;v(a=>a?e>80:e>140)};return e(),window.addEventListener("scroll",e,{passive:!0}),()=>window.removeEventListener("scroll",e)},[a]),(0,l.useEffect)(()=>{if(window.innerWidth>=981)return document.body.classList.toggle("so-header-scrolled",g),()=>document.body.classList.remove("so-header-scrolled")},[g]),(0,r.jsx)("header",{className:"so-header".concat(g?" so-header--scrolled":""),children:(0,r.jsxs)("div",{className:"container",children:[(0,r.jsxs)("div",{className:"so-header__top",children:[(0,r.jsxs)("div",{className:"so-header__left",children:[(0,r.jsx)(n.default,{href:"/",className:"so-home","aria-label":"Home",children:(0,r.jsx)("span",{className:"so-home__icon"})}),(0,r.jsx)(n.default,{href:"/merch",className:"so-merch","aria-label":"Merch",children:i.map((e,a)=>(0,r.jsx)("img",{src:e,className:"so-merch__icon"+(a===f?" so-merch__icon--active":""),alt:""},e))})]}),(0,r.jsx)(n.default,{href:"/",className:"so-header__logo-wrap",children:(0,r.jsx)("img",{src:"/icons/logo.png",className:"so-header__logo",alt:"Shifted Offroad"})}),(0,r.jsxs)("div",{className:"so-header__right",children:[(0,r.jsx)(n.default,{href:"/rewards",className:"so-rewards",children:(0,r.jsx)("span",{className:"so-rewards__icon"})}),(0,r.jsx)(n.default,{href:"/cart",className:"so-cart",children:(0,r.jsx)("span",{className:"so-cart__icon"})})]})]}),(0,r.jsxs)("div",{className:"so-header__categories",children:[(0,r.jsx)("nav",{className:"so-header__nav so-header__nav--left",children:[s,u,t,p].map(e=>(0,r.jsx)(n.default,{href:"/category/".concat((0,c.F)(e)),className:"so-navitem",children:e},e))}),(0,r.jsx)("nav",{className:"so-header__nav so-header__nav--right",children:[d,m,h,_].map(e=>(0,r.jsx)(n.default,{href:"/category/".concat((0,c.F)(e)),className:"so-navitem",children:e},e))})]})]})})}},7427:function(e,a,s){s.d(a,{default:function(){return c}});var r=s(7437),n=s(2265);let l={priceMin:"",priceMax:"",brand:"",stockOnly:!1,sort:"popular"};function c(e){let{title:a="Filter",onApply:s}=e,[c,o]=(0,n.useState)(l),[i,t]=(0,n.useState)(null),d=(0,n.useMemo)(()=>{if(!i)return"No filters applied.";let e=[];return i.priceMin&&e.push("Min $".concat(i.priceMin)),i.priceMax&&e.push("Max $".concat(i.priceMax)),i.brand&&e.push(i.brand),i.stockOnly&&e.push("In stock"),i.sort&&e.push("Sort: ".concat(i.sort)),e.length?e.join(" • "):"No filters applied."},[i]);return(0,r.jsxs)("div",{className:"card filter-card",children:[(0,r.jsx)("div",{className:"filter-card__title",children:a}),(0,r.jsxs)("div",{className:"filter-card__group",children:[(0,r.jsx)("label",{className:"filter-card__label",children:"Price"}),(0,r.jsxs)("div",{className:"filter-card__row",children:[(0,r.jsx)("input",{className:"filter-card__input",placeholder:"Min",value:c.priceMin,onChange:e=>o({...c,priceMin:e.target.value}),inputMode:"numeric"}),(0,r.jsx)("input",{className:"filter-card__input",placeholder:"Max",value:c.priceMax,onChange:e=>o({...c,priceMax:e.target.value}),inputMode:"numeric"})]})]}),(0,r.jsxs)("div",{className:"filter-card__group",children:[(0,r.jsx)("label",{className:"filter-card__label",children:"Brand"}),(0,r.jsxs)("select",{className:"filter-card__select",value:c.brand,onChange:e=>o({...c,brand:e.target.value}),children:[(0,r.jsx)("option",{value:"",children:"All brands"}),(0,r.jsx)("option",{value:"TrailForge",children:"TrailForge"}),(0,r.jsx)("option",{value:"RidgeLine",children:"RidgeLine"}),(0,r.jsx)("option",{value:"SummitWorks",children:"SummitWorks"}),(0,r.jsx)("option",{value:"IronPeak",children:"IronPeak"})]})]}),(0,r.jsxs)("div",{className:"filter-card__group",children:[(0,r.jsx)("label",{className:"filter-card__label",children:"Sort"}),(0,r.jsxs)("select",{className:"filter-card__select",value:c.sort,onChange:e=>o({...c,sort:e.target.value}),children:[(0,r.jsx)("option",{value:"popular",children:"Most popular"}),(0,r.jsx)("option",{value:"new",children:"Newest"}),(0,r.jsx)("option",{value:"priceLow",children:"Price: Low to High"}),(0,r.jsx)("option",{value:"priceHigh",children:"Price: High to Low"})]})]}),(0,r.jsxs)("div",{className:"filter-card__toggle",children:[(0,r.jsx)("input",{id:"stockOnly",type:"checkbox",checked:c.stockOnly,onChange:e=>o({...c,stockOnly:e.target.checked})}),(0,r.jsx)("label",{htmlFor:"stockOnly",children:"In-stock only"})]}),(0,r.jsxs)("div",{className:"filter-card__actions",children:[(0,r.jsx)("button",{className:"btn",type:"button",onClick:function(){t(c),null==s||s(c)},children:"Apply"}),(0,r.jsx)("button",{className:"btn btn--ghost",type:"button",onClick:function(){o(l),t(null),null==s||s(l)},children:"Reset"})]}),(0,r.jsx)("div",{className:"filter-card__summary",children:d})]})}},9215:function(e,a,s){s.d(a,{default:function(){return i}});var r=s(7437),n=s(7648),l=s(2265),c=s(1276),o=s(605);function i(e){let{forceScrolled:a=!1}=e,[s,i]=(0,l.useState)(a),[t,d]=(0,l.useState)(!1),[h,u]=(0,l.useState)(null);(0,o.useSession)();let m={Interior:"/categories/cat-interior.png",Tools:"/categories/cat-tools.png",Exterior:"/categories/cat-exterior.png",Drivetrain:"/categories/cat-drivetrain.png",Lighting:"/categories/cat-lighting.png",Suspension:"/categories/cat-suspension.png",Audio:"/categories/cat-audio.png",Performance:"/categories/cat-performance.png"};(0,l.useEffect)(()=>{if(a){i(!0),d(!1);return}let e=()=>{let e=window.scrollY;i(a=>a?e>80:e>140),d(a=>e>140&&a)};return e(),window.addEventListener("scroll",e,{passive:!0}),()=>window.removeEventListener("scroll",e)},[a]);let _=e=>{var a,s;u(null!==(s=null===(a=e.touches[0])||void 0===a?void 0:a.clientY)&&void 0!==s?s:null)},p=e=>{var a,r;if(null===h)return;let n=(null!==(r=null===(a=e.changedTouches[0])||void 0===a?void 0:a.clientY)&&void 0!==r?r:h)-h;s&&!t&&n<-40?d(!0):t&&n>40&&d(!1),u(null)};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("header",{className:"so-header so-header--mobile".concat(s?" so-header--shrunk":"").concat(t?" so-header--hidden":""),onTouchStart:_,onTouchEnd:p,children:(0,r.jsxs)("div",{className:"container so-header__mobile",children:[(0,r.jsx)("div",{className:"so-header__top",children:(0,r.jsx)(n.default,{href:"/",className:"so-header__logo-wrap",children:(0,r.jsx)("img",{src:"/icons/logo.png",className:"so-header__logo",alt:"Shifted Offroad"})})}),(0,r.jsxs)("div",{className:"so-header__categories",children:[(0,r.jsx)("nav",{className:"so-header__nav so-header__nav--mobile",children:c.a.map(e=>(0,r.jsx)(n.default,{href:"/category/".concat((0,c.F)(e)),className:"so-navitem",style:{backgroundImage:"url(".concat(m[e]||"",")")},children:(0,r.jsx)("span",{className:"so-navitem__label",children:e})},e))}),(0,r.jsx)(n.default,{href:"/cart",className:"so-mobile-corner so-mobile-corner--home","aria-label":"Cart",children:(0,r.jsx)("span",{className:"so-mobile-corner__icon so-mobile-corner__icon--cart","aria-hidden":"true"})}),(0,r.jsx)(n.default,{href:"/",className:"so-mobile-corner so-mobile-corner--cart","aria-label":"Home",children:(0,r.jsx)("span",{className:"so-mobile-corner__icon so-mobile-corner__icon--home","aria-hidden":"true"})}),(0,r.jsxs)("div",{className:"so-header__mobile-tools",children:[(0,r.jsx)("input",{className:"so-header__search",type:"search",placeholder:"Search","aria-label":"Search"}),(0,r.jsx)(n.default,{href:"/login",className:"so-auth-icon","aria-label":"Sign in",children:(0,r.jsx)("span",{className:"so-auth-icon__glyph","aria-hidden":"true"})})]})]})]})}),(0,r.jsx)("button",{type:"button",className:"so-header__pulltab so-header__pulltab--visible".concat(t?" so-header__pulltab--hidden":"").concat(s?" so-header__pulltab--shrunk":""),onClick:()=>d(!1),onTouchStart:_,onTouchEnd:p,"aria-label":t?"Show header":"Hide header",children:(0,r.jsx)("span",{className:"so-header__pulltab-grip"})})]})}},1276:function(e,a,s){s.d(a,{F:function(){return n},a:function(){return r}});let r=["Interior","Exterior","Lighting","Audio","Tools","Suspension","Performance","Drivetrain"];function n(e){return e.toLowerCase()}},7648:function(e,a,s){s.d(a,{default:function(){return n.a}});var r=s(2972),n=s.n(r)}}]);