replace raw checkbox w/ Checkbox component
also run prettier
This commit is contained in:
parent
f4b7b9efd0
commit
095af10d4f
|
@ -5,12 +5,13 @@ export function Checkbox(props: {
|
|||
checked: boolean
|
||||
toggle: (checked: boolean) => void
|
||||
className?: string
|
||||
disabled?: boolean
|
||||
}) {
|
||||
const { label, checked, toggle, className } = props
|
||||
const { label, checked, toggle, className, disabled } = props
|
||||
|
||||
return (
|
||||
<div className={clsx(className, 'space-y-5')}>
|
||||
<div className="relative flex items-start">
|
||||
<div className="relative flex items-center">
|
||||
<div className="flex h-6 items-center">
|
||||
<input
|
||||
id={label}
|
||||
|
@ -18,6 +19,7 @@ export function Checkbox(props: {
|
|||
className="h-5 w-5 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"
|
||||
checked={checked}
|
||||
onChange={(e) => toggle(!e.target.checked)}
|
||||
disabled={disabled}
|
||||
/>
|
||||
</div>
|
||||
<div className="ml-3">
|
||||
|
|
|
@ -21,7 +21,7 @@ import { FileUploadButton } from './file-upload-button'
|
|||
import { linkClass } from './site-link'
|
||||
|
||||
const proseClass = clsx(
|
||||
'prose prose-sm prose-p:my-0 prose-li:my-0 prose-blockquote:not-italic max-w-none',
|
||||
'prose prose-sm prose-p:my-0 prose-li:my-0 prose-blockquote:not-italic max-w-none'
|
||||
)
|
||||
|
||||
export function useTextEditor(props: {
|
||||
|
@ -50,7 +50,11 @@ export function useTextEditor(props: {
|
|||
}),
|
||||
CharacterCount.configure({ limit: max }),
|
||||
Image,
|
||||
Link.configure({ HTMLAttributes: { class: clsx('no-underline !text-indigo-700', linkClass)}}),
|
||||
Link.configure({
|
||||
HTMLAttributes: {
|
||||
class: clsx('no-underline !text-indigo-700', linkClass),
|
||||
},
|
||||
}),
|
||||
],
|
||||
content: defaultValue,
|
||||
})
|
||||
|
|
|
@ -27,6 +27,7 @@ import { track } from 'web/lib/service/analytics'
|
|||
import { GroupSelector } from 'web/components/groups/group-selector'
|
||||
import { User } from 'common/user'
|
||||
import { TextEditor, useTextEditor } from 'web/components/editor'
|
||||
import { Checkbox } from 'web/components/checkbox'
|
||||
|
||||
type NewQuestionParams = {
|
||||
groupId?: string
|
||||
|
@ -294,15 +295,13 @@ export function NewContract(props: {
|
|||
</Row>
|
||||
|
||||
{!(min !== undefined && min < 0) && (
|
||||
<Row className="mt-1 ml-2 mb-2 items-center">
|
||||
<span className="mr-2 text-sm">Log scale</span>{' '}
|
||||
<input
|
||||
type="checkbox"
|
||||
<Checkbox
|
||||
className="my-2 text-sm"
|
||||
label="Log scale"
|
||||
checked={isLogScale}
|
||||
onChange={() => setIsLogScale(!isLogScale)}
|
||||
toggle={() => setIsLogScale(!isLogScale)}
|
||||
disabled={isSubmitting}
|
||||
/>
|
||||
</Row>
|
||||
)}
|
||||
|
||||
{min !== undefined && max !== undefined && min >= max && (
|
||||
|
|
Loading…
Reference in New Issue
Block a user