Tweak create page layout

This commit is contained in:
James Grugett 2022-06-04 21:28:27 -05:00
parent 11974f68fc
commit cfd6af7c72
2 changed files with 92 additions and 109 deletions

View File

@ -20,13 +20,8 @@ export function ChoicesToggleGroup(props: {
children, children,
} = props } = props
return ( return (
<Row className={'mt-2 items-center gap-2'}> <RadioGroup value={currentChoice.toString()} onChange={(str) => null}>
<RadioGroup <Row className={'items-center flex-wrap gap-3'}>
value={currentChoice.toString()}
onChange={(str) => null}
className="mt-2"
>
<div className={`grid grid-cols-12 gap-3`}>
{Object.keys(choicesMap).map((choiceKey) => ( {Object.keys(choicesMap).map((choiceKey) => (
<RadioGroup.Option <RadioGroup.Option
key={choiceKey} key={choiceKey}
@ -49,8 +44,7 @@ export function ChoicesToggleGroup(props: {
</RadioGroup.Option> </RadioGroup.Option>
))} ))}
{children} {children}
</div>
</RadioGroup>
</Row> </Row>
</RadioGroup>
) )
} }

View File

@ -28,7 +28,7 @@ export default function Create() {
return ( return (
<Page> <Page>
<div className="mx-auto w-full max-w-2xl"> <div className="mx-auto w-full max-w-2xl">
<div className="rounded-lg px-6 py-4"> <div className="rounded-lg px-6 py-4 sm:py-0">
<form> <form>
<div className="form-control w-full"> <div className="form-control w-full">
<label className="label"> <label className="label">
@ -47,6 +47,7 @@ export default function Create() {
/> />
</div> </div>
</form> </form>
<Spacer h={6} />
<NewContract question={question} /> <NewContract question={question} />
</div> </div>
</div> </div>
@ -168,8 +169,8 @@ export function NewContract(props: { question: string; tag?: string }) {
return ( return (
<div> <div>
<label className="label mt-1"> <label className="label">
<span className="mt-1">Answer type</span> <span className="mb-1">Answer type</span>
</label> </label>
<ChoicesToggleGroup <ChoicesToggleGroup
currentChoice={outcomeType} currentChoice={outcomeType}
@ -189,11 +190,12 @@ export function NewContract(props: { question: string; tag?: string }) {
className={'col-span-4'} className={'col-span-4'}
/> />
{marketInfoText && ( {marketInfoText && (
<div className="mt-2 ml-1 text-sm text-indigo-700"> <div className="mt-3 ml-1 text-sm text-indigo-700">
{marketInfoText} {marketInfoText}
</div> </div>
)} )}
<Spacer h={4} />
<Spacer h={6} />
{outcomeType === 'BINARY' && ( {outcomeType === 'BINARY' && (
<div className="form-control"> <div className="form-control">
@ -241,6 +243,7 @@ export function NewContract(props: { question: string; tag?: string }) {
{probErrorText && ( {probErrorText && (
<div className="text-error mt-2 ml-1 text-sm">{probErrorText}</div> <div className="text-error mt-2 ml-1 text-sm">{probErrorText}</div>
)} )}
<Spacer h={6} />
</div> </div>
)} )}
@ -278,27 +281,6 @@ export function NewContract(props: { question: string; tag?: string }) {
</div> </div>
)} )}
<Spacer h={4} />
<div className="form-control mb-1 items-start">
<label className="label mb-1 gap-2">
<span className="mb-1">Description</span>
<InfoTooltip text="Optional. Describe how you will resolve this question." />
</label>
<Textarea
className="textarea textarea-bordered w-full resize-none"
rows={3}
maxLength={MAX_DESCRIPTION_LENGTH}
placeholder={descriptionPlaceholder}
value={description}
disabled={isSubmitting}
onClick={(e) => e.stopPropagation()}
onChange={(e) => setDescription(e.target.value || '')}
/>
</div>
<Spacer h={4} />
<div className="form-control max-w-sm items-start"> <div className="form-control max-w-sm items-start">
<label className="label gap-2"> <label className="label gap-2">
<span className="mb-1">Category</span> <span className="mb-1">Category</span>
@ -318,11 +300,11 @@ export function NewContract(props: { question: string; tag?: string }) {
</select> </select>
</div> </div>
<Spacer h={4} /> <Spacer h={6} />
<div className="form-control mb-1 items-start"> <div className="form-control mb-1 items-start">
<label className="label mb-1 gap-2"> <label className="label mb-1 gap-2">
<span>Question closes in:</span> <span>Question closes in</span>
<InfoTooltip text="Betting will be halted after this time (local timezone)." /> <InfoTooltip text="Betting will be halted after this time (local timezone)." />
</label> </label>
<Row className={'w-full items-center gap-2'}> <Row className={'w-full items-center gap-2'}>
@ -365,8 +347,28 @@ export function NewContract(props: { question: string; tag?: string }) {
</Row> </Row>
</div> </div>
<Spacer h={4} /> <Spacer h={6} />
<div className="form-control mb-1 items-start">
<label className="label mb-1 gap-2">
<span className="mb-1">Description</span>
<InfoTooltip text="Optional. Describe how you will resolve this question." />
</label>
<Textarea
className="textarea textarea-bordered w-full resize-none"
rows={3}
maxLength={MAX_DESCRIPTION_LENGTH}
placeholder={descriptionPlaceholder}
value={description}
disabled={isSubmitting}
onClick={(e) => e.stopPropagation()}
onChange={(e) => setDescription(e.target.value || '')}
/>
</div>
<Spacer h={6} />
<Row className="items-end justify-between">
<div className="form-control mb-1 items-start"> <div className="form-control mb-1 items-start">
<label className="label mb-1 gap-2"> <label className="label mb-1 gap-2">
<span>Cost</span> <span>Cost</span>
@ -405,25 +407,12 @@ export function NewContract(props: { question: string; tag?: string }) {
</button> </button>
</div> </div>
)} )}
{/* <BuyAmountInput
amount={ante ?? undefined}
minimumAmount={MINIMUM_ANTE}
onChange={setAnte}
error={anteError}
setError={setAnteError}
disabled={isSubmitting}
contractIdForLoan={undefined}
/> */}
</div> </div>
<Spacer h={4} />
<div className="my-4 flex justify-end">
<button <button
type="submit" type="submit"
className={clsx( className={clsx(
'btn btn-primary capitalize', 'btn btn-primary normal-case',
isSubmitting && 'loading disabled' isSubmitting && 'loading disabled'
)} )}
disabled={isSubmitting || !isValid} disabled={isSubmitting || !isValid}
@ -434,7 +423,7 @@ export function NewContract(props: { question: string; tag?: string }) {
> >
{isSubmitting ? 'Creating...' : 'Create question'} {isSubmitting ? 'Creating...' : 'Create question'}
</button> </button>
</div> </Row>
</div> </div>
) )
} }