Skip to content

Commit

Permalink
style(3000): Make new style switch more clickable (#18773)
Browse files Browse the repository at this point in the history
* style(3000): Make new style switch more clickable

* Use LemonSwitch in app config
  • Loading branch information
Twixes authored Nov 21, 2023
1 parent c6e0491 commit 9c58a93
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions frontend/src/lib/lemon-ui/LemonSwitch/LemonSwitch.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
}

.posthog-3000 & {
--lemon-switch-width: 1.5rem;
--lemon-switch-height: 0.75rem;
--lemon-switch-height: 1.125rem;
--lemon-switch-width: calc(11 / 6 * var(--lemon-switch-height)); // Same proportion as in IconToggle
}
}

Expand Down Expand Up @@ -117,7 +117,7 @@
justify-content: center;

.posthog-3000 & {
--lemon-switch-handle-ratio: calc(8 / 10);
--lemon-switch-handle-ratio: calc(3 / 4); // Same proportion as in IconToggle
--lemon-switch-handle-gutter: calc(var(--lemon-switch-height) * calc(1 - var(--lemon-switch-handle-ratio)) / 2);
--lemon-switch-handle-width: calc(var(--lemon-switch-height) * var(--lemon-switch-handle-ratio));
--lemon-switch-active-translate: translateX(
Expand Down
12 changes: 6 additions & 6 deletions frontend/src/scenes/plugins/edit/PluginDrawer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react'
import { useActions, useValues } from 'kea'
import { pluginsLogic } from 'scenes/plugins/pluginsLogic'
import { Form, Switch } from 'antd'
import { Form } from 'antd'
import { userLogic } from 'scenes/userLogic'
import { PluginImage } from 'scenes/plugins/plugin/PluginImage'
import { Drawer } from 'lib/components/Drawer'
Expand All @@ -18,7 +18,7 @@ import { MOCK_NODE_PROCESS } from 'lib/constants'
import { LemonMarkdown } from 'lib/lemon-ui/LemonMarkdown'
import { PluginTags } from '../tabs/apps/components'
import { IconLock } from 'lib/lemon-ui/icons'
import { LemonButton, LemonTag, Link } from '@posthog/lemon-ui'
import { LemonButton, LemonSwitch, LemonTag, Link } from '@posthog/lemon-ui'
import { IconCode } from '@posthog/icons'

window.process = MOCK_NODE_PROCESS
Expand All @@ -31,10 +31,10 @@ function EnabledDisabledSwitch({
onChange?: (value: boolean) => void
}): JSX.Element {
return (
<>
<Switch checked={value} onChange={onChange} />
<strong className="pl-2.5">{value ? 'Enabled' : 'Disabled'}</strong>
</>
<div className="flex items-center gap-2">
<LemonSwitch checked={value || false} onChange={onChange} />
<strong>{value ? 'Enabled' : 'Disabled'}</strong>
</div>
)
}

Expand Down

0 comments on commit 9c58a93

Please sign in to comment.