react-tech-slider
Version:
Reusable React component slider for showcasing brands
2 lines (1 loc) • 899 B
JavaScript
import e from"react";const t=({brandsList:t,borderWidth:r=1,borderColor:d="#7c05d8",backgroundColor:i="#00000033",iconWidth:o})=>e.createElement("div",{className:"wrapper",style:{"--amount-brands":t.length,borderTop:`${r}px solid ${d}`,borderBottom:`${r}px solid ${d}`,backgroundColor:`${i}`}},t.map((({id:t,name:r,img:d,width:i,height:s,style:l,className:a},c)=>e.createElement("div",{key:t,className:`item item${t}`,style:{"--item":c+1}},e.createElement("img",{src:d,alt:`${r}-icon`,className:`brand-slider ${a??""}`,style:{...i||o?{width:`${i??o}rem`}:{},...s?{height:`${s}rem`}:{},...l},loading:"lazy"})))));if("undefined"!=typeof document){if(!document.querySelector('link[href*="react-tech-slider/dist/index.css"]')){const e=document.createElement("link");e.rel="stylesheet",e.href="https://unpkg.com/react-tech-slider@latest/dist/index.css",document.head.appendChild(e)}}export{t as Slider};