UNPKG

nextjs-darkmode-lite

Version:

Unleash the Power of React Server Components! Use dark/light mode on your site with confidence, without losing any advantages of React Server Components

2 lines (1 loc) 523 B
import{a as i}from"./chunk-RYSNTC6D.mjs";import{d as s}from"./chunk-24GHFFXD.mjs";var m={switch:"ndm__switch",n:"ndm__n"};import{jsx as u,jsxs as w}from"react/jsx-runtime";var H=({tag:r="button",size:c=24,skipSystem:p,children:e,...t})=>{let[{m:l,s:a},f]=i(),d=s.length-(p?1:0);t.onClick=()=>f({s:a,m:s[(s.indexOf(l)+1)%d]});let o=m.switch,n={"--size":`${c}px`};return e||(t.className+=" "+o,t.style={...t.style,...n}),w(r,{suppressHydrationWarning:!0,...t,children:[e&&u("div",{className:o,style:n}),e]})};export{H as a};