by default show undo and check original button

This commit is contained in:
Sanster 2022-02-05 21:50:01 +08:00
parent 8eeb350f49
commit 8013fc554f

View File

@ -418,53 +418,53 @@ export default function Editor(props: EditorProps) {
value={brushSize} value={brushSize}
onChange={setBrushSize} onChange={setBrushSize}
/> />
{renders.length ? ( <div>
<> <Button
<Button className="mr-2"
icon={ icon={
<svg <svg
width="19" width="19"
height="9" height="9"
viewBox="0 0 19 9" viewBox="0 0 19 9"
fill="none" fill="none"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
className="w-6 h-6" className="w-6 h-6"
> >
<path <path
d="M2 1C2 0.447715 1.55228 0 1 0C0.447715 0 0 0.447715 0 1H2ZM1 8H0V9H1V8ZM8 9C8.55228 9 9 8.55229 9 8C9 7.44771 8.55228 7 8 7V9ZM16.5963 7.42809C16.8327 7.92721 17.429 8.14016 17.9281 7.90374C18.4272 7.66731 18.6402 7.07103 18.4037 6.57191L16.5963 7.42809ZM16.9468 5.83205L17.8505 5.40396L16.9468 5.83205ZM0 1V8H2V1H0ZM1 9H8V7H1V9ZM1.66896 8.74329L6.66896 4.24329L5.33104 2.75671L0.331035 7.25671L1.66896 8.74329ZM16.043 6.26014L16.5963 7.42809L18.4037 6.57191L17.8505 5.40396L16.043 6.26014ZM6.65079 4.25926C9.67554 1.66661 14.3376 2.65979 16.043 6.26014L17.8505 5.40396C15.5805 0.61182 9.37523 -0.710131 5.34921 2.74074L6.65079 4.25926Z" d="M2 1C2 0.447715 1.55228 0 1 0C0.447715 0 0 0.447715 0 1H2ZM1 8H0V9H1V8ZM8 9C8.55228 9 9 8.55229 9 8C9 7.44771 8.55228 7 8 7V9ZM16.5963 7.42809C16.8327 7.92721 17.429 8.14016 17.9281 7.90374C18.4272 7.66731 18.6402 7.07103 18.4037 6.57191L16.5963 7.42809ZM16.9468 5.83205L17.8505 5.40396L16.9468 5.83205ZM0 1V8H2V1H0ZM1 9H8V7H1V9ZM1.66896 8.74329L6.66896 4.24329L5.33104 2.75671L0.331035 7.25671L1.66896 8.74329ZM16.043 6.26014L16.5963 7.42809L18.4037 6.57191L17.8505 5.40396L16.043 6.26014ZM6.65079 4.25926C9.67554 1.66661 14.3376 2.65979 16.043 6.26014L17.8505 5.40396C15.5805 0.61182 9.37523 -0.710131 5.34921 2.74074L6.65079 4.25926Z"
fill="currentColor" fill="currentColor"
/> />
</svg> </svg>
} }
onClick={undo} onClick={undo}
/> disabled={renders.length === 0}
<Button />
icon={<EyeIcon className="w-6 h-6" />} <Button
onDown={ev => { className="mr-2"
ev.preventDefault() icon={<EyeIcon className="w-6 h-6" />}
setShowSeparator(true) onDown={ev => {
setShowOriginal(true) ev.preventDefault()
}} setShowSeparator(true)
onUp={() => { setShowOriginal(true)
setShowOriginal(false) }}
setTimeout(() => setShowSeparator(false), 300) onUp={() => {
}} setShowOriginal(false)
> setTimeout(() => setShowSeparator(false), 300)
{windowSize.width > 640 ? 'Original' : undefined} }}
</Button> disabled={renders.length === 0}
</> >
) : ( {undefined}
<></> </Button>
)}
<Button <Button
primary primary
icon={<DownloadIcon className="w-6 h-6" />} icon={<DownloadIcon className="w-6 h-6" />}
disabled={!renders.length} disabled={!renders.length}
onClick={download} onClick={download}
> >
{windowSize.width > 640 ? 'Download' : undefined} {undefined}
</Button> </Button>
</div>
</div> </div>
</div> </div>
) )