weave
weave copied to clipboard
chore(app): modify switch common component
Make switch common component more in line with design: https://www.figma.com/file/01KWBdMZg5QM9SRS1pQq0z/Design-System----Robot-Styles?type=design&node-id=10-38
- ie. add 2 size differences and dark vs light mode
https://github.com/wandb/weave/assets/8826594/3ddf78d0-d055-438b-b71d-91b5d83bdf07
Also make code cleaner and less confusing so user doesn't have to calc the thumb size and transition length. Old:
<Switch.Root
id="auto-expand-toggle"
className="h-16 w-26"
checked={autoExpandSearchResults}
onCheckedChange={isOn => {
updatePanelBankSettings({
autoExpandSearchResults: isOn,
});
}}>
<Switch.Thumb
className={classNames('h-14 w-14', {
'translate-x-10': autoExpandSearchResults,
})}
checked={autoExpandSearchResults ?? false}
/>
</Switch.Root>
to New:
<Switch
id="auto-expand-toggle"
checked={autoExpandSearchResults}
onCheckedChange={isOn => {
updatePanelBankSettings({
autoExpandSearchResults: isOn,
});
}}/>
Rollout plan
- Deploy "NewSwitch" on weave
- Switch to "NewSwitch" on core. (This is only used in core)
- Delete "OldSwitch" (basically make index.tsx just
export * from './Switch';
)
Preview this PR with FeatureBee: https://beta.wandb.ai/?betaVersion=a0633891f295bd9e15ba95ddcec0cd21b534ce63