N00nDay / stwui

Opinionated yet customizable Svelte-TailwindCSS component library
stwui.vercel.app
MIT License
447 stars 21 forks source link

fix(Toggle): if content on one side only then clicking toggles #205

Closed jerefrer closed 9 months ago

jerefrer commented 9 months ago

Currently:

  1. if a left content is specified then clicking on it will switch the Toggle off.
  2. if a right content is specified then clicking on it will switch the Toggle on.
  3. if both side contents are specified then clicking left will switch off and clicking right will switch on.

I believe cases 1 and 2 are counter-intuitive. If there is content defined on one side only I would expect that it's just the name for this variable and that clicking the label would have the same effect as clicking on the Toggle itself.

If there are contents on both sides then I would expect that they are "on/off" labels, therefore case 3 is fine with me.

So I updated the code so that:

  1. if a left content only is specified then clicking on it will switch the Toggle on and off.
  2. if a right content only is specified then clicking on it will switch the Toggle on and off.
  3. if both side contents are specified then clicking left will switch off and clicking right will switch on.
vercel[bot] commented 9 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
stwui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 26, 2023 10:58am