-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: empty scene div causing dom flow to change if neither conditions are met #29109
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,64 @@ | ||||||||
import { LemonCheckbox, LemonSwitch } from '@posthog/lemon-ui' | ||||||||
import { Meta } from '@storybook/react' | ||||||||
import { LemonInput } from 'lib/lemon-ui/LemonInput/LemonInput' | ||||||||
import { LemonRadio } from 'lib/lemon-ui/LemonRadio/LemonRadio' | ||||||||
import { LemonSlider } from 'lib/lemon-ui/LemonSlider/LemonSlider' | ||||||||
import { useState } from 'react' | ||||||||
|
||||||||
const meta: Meta = { | ||||||||
title: 'Design System/Inputs', | ||||||||
tags: ['autodocs'], | ||||||||
} | ||||||||
export default meta | ||||||||
|
||||||||
function GetAllInputs(): JSX.Element { | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Function name 'GetAllInputs' does not follow camelCase convention used elsewhere in codebase |
||||||||
const [checked, setChecked] = useState(false) | ||||||||
const [radioValue, setRadioValue] = useState('this') | ||||||||
|
||||||||
return ( | ||||||||
<div className="flex flex-col gap-2"> | ||||||||
<LemonInput /> | ||||||||
<LemonInput placeholder="Placeholder" /> | ||||||||
<LemonInput disabled /> | ||||||||
<LemonInput disabled /> | ||||||||
Comment on lines
+22
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: Duplicate disabled LemonInput component with identical props
Suggested change
|
||||||||
<LemonInput value={"I'm pre-filled"} /> | ||||||||
<LemonSlider max={100} min={0} value={50} /> | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: LemonSlider lacks onChange handler, making it non-interactive in Storybook |
||||||||
<LemonCheckbox label="Checkbox" /> | ||||||||
<LemonCheckbox label="Checkbox" disabledReason="This is not the way to Amarillo" /> | ||||||||
<LemonCheckbox label="Checkbox" checked /> | ||||||||
<LemonRadio | ||||||||
value={radioValue} | ||||||||
options={[ | ||||||||
{ label: 'This', value: 'this' }, | ||||||||
{ label: 'That', value: 'that' }, | ||||||||
]} | ||||||||
onChange={setRadioValue} | ||||||||
/> | ||||||||
<LemonRadio | ||||||||
value={radioValue} | ||||||||
options={[ | ||||||||
{ label: 'This', value: 'this', disabledReason: 'This is not the way to Amarillo' }, | ||||||||
{ label: 'That', value: 'that' }, | ||||||||
]} | ||||||||
onChange={setRadioValue} | ||||||||
/> | ||||||||
<LemonSwitch checked={checked} onChange={() => setChecked(!checked)} /> | ||||||||
<LemonSwitch checked={checked} bordered onChange={() => setChecked(!checked)} /> | ||||||||
<LemonSwitch checked={true} disabledReason="This is not the way to Amarillo" /> | ||||||||
<LemonSwitch checked={false} /> | ||||||||
<LemonSwitch checked={false} bordered /> | ||||||||
<LemonSwitch checked={false} disabledReason="This is not the way to Amarillo" /> | ||||||||
</div> | ||||||||
) | ||||||||
} | ||||||||
|
||||||||
export const AllInputs = (): JSX.Element => { | ||||||||
return ( | ||||||||
<div className="space-y-2"> | ||||||||
<div className="bg-primary p-4">{GetAllInputs()}</div> | ||||||||
<div className="bg-surface-primary p-4">{GetAllInputs()}</div> | ||||||||
<div className="bg-surface-secondary p-4">{GetAllInputs()}</div> | ||||||||
<div className="bg-surface-tertiary p-4">{GetAllInputs()}</div> | ||||||||
</div> | ||||||||
) | ||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider using Tailwind's conditional classes with clsx here instead of ternary operator for consistency with other className assignments in the file