refactor(PaintingsList): Reposition new painting button

Move the NewPaintingButton component to be rendered before the DragableList and remove unnecessary margin-top styling
This commit is contained in:
ousugo 2025-03-12 14:26:52 +08:00 committed by 亢奋猫
parent 9d627e660f
commit 7122d44b13

View File

@ -31,6 +31,11 @@ const PaintingsList: FC<PaintingsListProps> = ({
return ( return (
<Container style={{ paddingBottom: dragging ? 80 : 10 }}> <Container style={{ paddingBottom: dragging ? 80 : 10 }}>
{!dragging && (
<NewPaintingButton onClick={onNewPainting}>
<PlusOutlined />
</NewPaintingButton>
)}
<DragableList <DragableList
list={paintings} list={paintings}
onUpdate={updatePaintings} onUpdate={updatePaintings}
@ -55,11 +60,6 @@ const PaintingsList: FC<PaintingsListProps> = ({
</CanvasWrapper> </CanvasWrapper>
)} )}
</DragableList> </DragableList>
{!dragging && (
<NewPaintingButton onClick={onNewPainting}>
<PlusOutlined />
</NewPaintingButton>
)}
</Container> </Container>
) )
} }
@ -134,7 +134,6 @@ const NewPaintingButton = styled.div`
width: 80px; width: 80px;
height: 80px; height: 80px;
min-height: 80px; min-height: 80px;
margin-top: -10px;
background-color: var(--color-background-soft); background-color: var(--color-background-soft);
cursor: pointer; cursor: pointer;
transition: background-color 0.2s ease; transition: background-color 0.2s ease;