PageSourceSearch

https://www.fassion.co.uk/assets/BlogPost-BB6HHh9f.js

js fassion.co.uk collected 2026-10-09 22:02:36 UTC 8,420 bytes, 6 lines download raw bytes

1import{ag as q,an as C,a as E,b as I,r as n,s as m,j as e,M as F,aX as M,ap as H,B as c,aL as A,aF as g,L as R,n as T}from"./index-FAOCbpaf.js";import{f as z,L as D}from"./fassion-logo-blog-header-ZjTOEpv0.js";import{B as p}from"./badge-c7aAi5-3.js";import{S as O,B as U}from"./BlogEmbeddedProducts-DcWeOdWP.js";import{C as W}from"./calendar-BhiwWs_d.js";import{C as X}from"./clock-DBdLlxbs.js";import{f as Y}from"./format-BEMO4FpZ.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const G=q("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),te=()=>{const{slug:d}=C(),o=E(),{user:x}=I(),[s,f]=n.useState(null),[h,j]=n.useState([]),[u,N]=n.useState([]),[v,b]=n.useState(!0),[w,y]=n.useState(0);n.useEffect(()=>{d&&_()},[d]),n.useEffect(()=>{const t=()=>{const a=window.scrollY,r=document.documentElement.scrollHeight-window.innerHeight,i=a/r*100;y(Math.min(i,100))};return window.addEventListener("scroll",t),()=>window.removeEventListener("scroll",t)},[]);const _=async()=>{const{data:t,error:a}=await m.from("blog_posts").select("*").eq("slug",d).eq("status","published").maybeSingle();if(a||!t){o("/blog");return}f(t);const{data:r}=await m.from("blog_post_products").select("product_id").eq("blog_post_id",t.id).order("position");N((r==null?void 0:r.map(l=>l.product_id))||[]);const{data:i}=await m.from("blog_posts").select("id, title, slug, featured_image, category").eq("status","published").eq("category",t.category).neq("id",t.id).limit(3);j(i||[]),b(!1)},S=t=>{const a=/(\*\*([^*]+)\*\*)|(\*([^*]+)\*)|(\[([^\]]+)\]\(([^)]+)\))/g,r=[];let i=0,l;for(;(l=a.exec(t))!==null;)l.index>
6i&&r.push(t.substring(i,l.index)),l[1]?r.push(e.jsx("strong",{className:"font-bold",children:l[2]},`bold-${l.index}`)):l[3]?r.push(e.jsx("em",{className:"italic",children:l[4]},`italic-${l.index}`)):l[5]&&r.push(e.jsx("a",{href:l[7],target:"_blank",rel:"noopener noreferrer",className:"text-accent hover:underline",children:l[6]},`link-${l.index}`)),i=l.index+l[0].length;return i<t.length&&r.push(t.substring(i)),r.length>0?r:t},L=async()=>{if(navigator.share)try{await navigator.share({title:s==null?void 0:s.title,url:window.location.href})}catch{}else await navigator.clipboard.writeText(window.location.href),T.success("Link copied to clipboard")},P=t=>Array.isArray(t)?t.map((a,r)=>{switch(a.type){case"paragraph":if(!a.content||a.content.trim()==="")return e.jsx("div",{className:"h-6"},r);const i=a.content.split(/\n\n+/);return e.jsx("div",{className:"space-y-6",children:i.map((B,$)=>e.jsx("p",{className:"text-lg leading-relaxed",children:S(B)},$))},r);case"heading":const l=`h${a.level||2}`;return e.jsx(l,{className:`font-bold mt-8 mb-4 ${a.level===2?"text-2xl":"text-xl"}`,children:a.content},r);case"image":return e.jsxs("figure",{className:"my-8",children:[e.jsx("img",{src:a.src,alt:a.alt||"",className:"w-full rounded-xl"}),a.caption&&e.jsx("figcaption",{className:"text-center text-sm text-muted-foreground mt-2",children:a.caption})]},r);case"quote":return e.jsxs("blockquote",{className:"border-l-4 border-accent pl-6 my-8 italic text-xl",children:[e.jsx("p",{className:"mb-2",children:a.content}),a.author&&e.jsxs("cite",{className:"text-sm text-muted-foreground not-italic",children:["— ",a.author]})]},r);default:return null}}):null;if(v)return e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})});if(!s)return null;const k=[{name:"Home",url:"/"},{name:"Blog",url:"/blog"},{name:s.title,url:`/blog/${s.slug}`}];return e.jsxs(e.Fragment,{children:[e.jsx(F,{title:s.seo_title||s.title,description:s.seo_description||s.excerpt||`Read ${s.title} on the Fassion blog.`,image:s.featured_image||void 0,url:`/blog/${s.slug}`,type:"article"}),e.jsx(M,{headline:s.title,description:s.seo_description||s.excerpt||void 0,image:s.featured_image||void 0,author:s.author_name||"Fassion Team",datePublished:s.published_at||new Date().toISOString(),url:`https://fassion.lovable.app/blog/${s.slug}`}),e.jsx(H,{items:k}),e.jsx("div",{className:"fixed top-0 left-0 right-0 h-1 bg-muted z-50",children:e.jsx("div",{className:"h-full bg-accent transition-all duration-150",style:{width:`${w}%`}})}),e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("div",{className:"container mx-auto px-4 py-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(c,{variant:"ghost",onClick:()=>o("/"),className:"gap-2",children:[e.jsx(A,{className:"w-4 h-4"}),"Home"]}),e.jsx(c,{variant:"ghost",onClick:()=>o("/blog"),children:"Back to Blog"})]}),e.jsx("img",{src:z,alt:"Fassion",className:"h-10 cursor-pointer absolute left-1/2 -translate-x-1/2",onClick:()=>o("/")}),e.jsx(c,{variant:"ghost",onClick:()=>o(x?"/profile":"/welcome"),className:"gap-2",children:x?e.jsxs(e.Fragment,{children:[e.jsx(g,{className:"w-4 h-4"}),"My Profile"]}):e.jsxs(e.Fragment,{children:[e.jsx(D,{className:"w-4 h-4"}),"Sign In"]})})]})}),e.jsxs("section",{className:"relative",children:[s.featured_image?e.jsxs("div",{className:"relative h-[50vh] lg:h-[60vh]",children:[e.jsx("img",{src:s.featured_image,alt:s.title,className:"w-full h-full object-cover"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-background via-background/20 to-transparent"})]}):e.jsx("div",{className:"h-32 bg-gradient-to-br from-[hsl(var(--hero-start))] via-[hsl(var(--hero-mid))] to-[hsl(var(--hero-end))]"}),e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"max-w-3xl mx-auto -mt-32 relative z-10",children:[e.jsx(p,{className:"mb-4",children:s.category}),e.jsx("h1",{className:"font-mortend text-3xl md:text-4xl lg:text-5xl font-bold mb-6",children:s.title}),e.jsxs("div",{className:"flex flex-wrap items-center gap-4 md:gap-6 text-muted-foreground",children:[s.author_name&&e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(g,{className:"w-4 h-4"}),s.author_name]}),s.published_at&&e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(W,{className:"w-4 h-4"}),Y(new Date(s.published_at),"MMMM d, yyyy")]}),s.read_time_minutes&&e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(X,{className:"w-4 h-4"}),s.read_time_minutes," min read"]}),e.jsx(c,{variant:"ghost",size:"icon",onClick:L,children:e.jsx(G,{className:"w-4 h-4"})})]})]})})]}),e.jsx("article",{className:"container mx-auto px-4 py-12",children:e.jsxs("div",{className:"max-w-3xl mx-auto",children:[s.excerpt&&e.jsx("p",{className:"text-xl text-muted-foreground mb-8 font-medium",children:s.excerpt}),e.jsx(O,{className:"mb-8"}),e.jsx("div",{className:"prose prose-lg max-w-none",children:P(s.content)}),s.tags&&s.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-12",children:s.tags.map(t=>e.jsx(p,{variant:"outline",children:t},t))})]})}),u.length>0&&e.jsx("section",{className:"bg-muted/50 py-12",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"max-w-5xl mx-auto",children:[e.jsx("h2",{className:"font-mortend text-2xl font-bold mb-6",children:"Shop the Look"}),e.jsx(U,{productIds:u})]})})}),h.length>0&&e.jsx("section",{className:"container mx-auto px-4 py-12",children:e.jsxs("div",{className:"max-w-5xl mx-auto",children:[e.jsxs("h2",{className:"font-mortend text-2xl font-bold mb-6",children:["More in ",s.category]}),e.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-6",children:h.map(t=>e.jsxs(R,{to:`/blog/${t.slug}`,className:"group",children:[e.jsx("div",{className:"aspect-[4/3] rounded-xl overflow-hidden bg-muted mb-3",children:t.featured_image?e.jsx("img",{src:t.featured_image,alt:t.title,className:"w-full h-full object-cover transition-transform duration-500 group-hover:scale-105"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No image"})}),e.jsx("h3",{className:"font-semibold group-hover:text-accent transition-colors line-clamp-2",children:t.title})]},t.id))})]})})]})]})};export{te as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.