2 lines
1.6 KiB
JavaScript
2 lines
1.6 KiB
JavaScript
import{d as h,k as i,al as k,y as n,z as c,a7 as d,A as s,H as l,am as S,a4 as u,d5 as w}from"./UdOyBpMP.js";import{i as p}from"./CRaI34-P.js";const C=["id","value"],_=["for"],x=h({__name:"StoriesComponent",props:{story:{},selectedStory:{}},emits:["update:selectedStory"],setup(y,{emit:m}){const t=y,v=m,a=i(()=>t.selectedStory?.includes(t.story?.id)),r=i({get(){return t.selectedStory},set(e){v("update:selectedStory",e)}});function b(){const e=r.value?.findIndex(o=>o===t.story.id);e===-1?r.value?.push(t.story.id):r.value?.splice(e,1)}return(e,o)=>{const f=k("lazy");return c(),n("div",{class:"w-full h-full aspect-[2/3] relative",onClick:b},[d(s("img",{class:u(["w-full h-full object-cover aspect-[2/3]",a.value&&"bg-gray-500 opacity-50"])},null,2),[[f,{src:l(S)(e.story?.media_url),loading:l(p),error:l(p)}]]),d(s("input",{type:"checkbox",id:`story-${e.story.id}`,value:e.story,"onUpdate:modelValue":o[0]||(o[0]=g=>r.value=g),class:"absolute opacity-0 w-full h-full peer"},null,8,C),[[w,r.value]]),s("label",{for:`story-${e.story.id}`,class:"absolute bottom-2 right-2 w-5 h-5 rounded border-1 border-black cursor-pointer transition-all group-hover:ring-2 group-hover:ring-blue-400 peer-checked:bg-black peer-checked:border-black"},[(c(),n("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",class:u(["w-18px h-18px text-white bg-black transition-opacity",a.value?"peer-checked:opacity-100":"opacity-0"])},o[1]||(o[1]=[s("path",{d:"M5 12l5 5L20 7"},null,-1)]),2))],8,_)])}}}),j=Object.assign(x,{__name:"StoriesComponent"});export{j as S};
|