Integrate preview into the same card

This commit is contained in:
Austin Chen 2021-12-20 13:18:37 -08:00
parent 67b4eeb572
commit b8ffaf0145

View File

@ -47,13 +47,11 @@ function PredictionRow(props: { prediction: Prediction }) {
function PredictionList(props: { predictions: Prediction[] }) { function PredictionList(props: { predictions: Prediction[] }) {
const { predictions } = props const { predictions } = props
return ( return (
<div className="w-full bg-gray-100 rounded-lg shadow-xl px-6 py-4">
<Col className="divide-gray-300 divide-y border-gray-300 border rounded-md"> <Col className="divide-gray-300 divide-y border-gray-300 border rounded-md">
{predictions.map((prediction) => ( {predictions.map((prediction) => (
<PredictionRow key={prediction.question} prediction={prediction} /> <PredictionRow key={prediction.question} prediction={prediction} />
))} ))}
</Col> </Col>
</div>
) )
} }
@ -147,12 +145,13 @@ ${TEST_VALUE}
onChange={(e) => setDescription(e.target.value || '')} onChange={(e) => setDescription(e.target.value || '')}
/> />
</div> </div>
</div>
{predictions.length > 0 && ( {predictions.length > 0 && (
<div> <div>
<Spacer h={16} /> <Spacer h={4} />
<Title text="Preview" /> <label className="label">
<span className="label-text">Preview</span>
</label>
<PredictionList predictions={predictions} /> <PredictionList predictions={predictions} />
</div> </div>
)} )}
@ -163,7 +162,7 @@ ${TEST_VALUE}
<button <button
type="submit" type="submit"
className="btn btn-primary" className="btn btn-primary"
// disabled={isSubmitting || !question} disabled={predictions.length === 0}
onClick={(e) => { onClick={(e) => {
e.preventDefault() e.preventDefault()
createContracts() createContracts()
@ -172,6 +171,7 @@ ${TEST_VALUE}
Create all Create all
</button> </button>
</div> </div>
</div>
</Page> </Page>
) )
} }