Skip to content

Commit

Permalink
fix: adjust button position in vote confirmation
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick-1979 committed Oct 15, 2024
1 parent f3a4734 commit 7d35cc2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2019-2024 @polkadot/extension-polkagate authors & contributors
// SPDX-License-Identifier: Apache-2.0

// @ts-nocheck
/* eslint-disable react/jsx-max-props-per-line */

import { Box, Modal, useTheme } from '@mui/material';
Expand All @@ -28,37 +27,40 @@ export function DraggableModal ({ children, maxHeight = 740, minHeight = 615, on
const [modalPosition, setModalPosition] = useState({ x: initialX, y: initialY });
const [dragStartPosition, setDragStartPosition] = useState({ x: 0, y: 0 });

const handleMouseDown = (e) => {
const handleMouseDown = useCallback((e: { clientX: number; clientY: number; }) => {
setIsDragging(true);
setDragStartPosition({ x: e.clientX, y: e.clientY });
};
}, []);

const _onClose = useCallback((event, reason) => {
const _onClose = useCallback((_event: unknown, reason: string) => {
if (reason && reason === 'backdropClick') {
return;
}

onClose();
}, [onClose]);

const handleMouseMove = useCallback((e) => {
const handleMouseMove = useCallback((e: { clientX: number; clientY: number; }) => {
if (isDragging) {
const dx = e.clientX - dragStartPosition.x;
const dy = e.clientY - dragStartPosition.y;

setModalPosition((prevPosition) => ({
x: prevPosition.x + dx,
y: prevPosition.y + dy,
y: prevPosition.y + dy
}));
setDragStartPosition({ x: e.clientX, y: e.clientY });
}
}, [dragStartPosition, isDragging]);

const handleMouseUp = () => {
const handleMouseUp = useCallback(() => {
setIsDragging(false);
};
}, []);

const style = {
'&:focus': {
outline: 'none' // Remove outline when Box is focused
},
bgcolor: 'background.default',
border: isDarkMode ? '0.5px solid' : 'none',
borderColor: 'secondary.light',
Expand All @@ -73,10 +75,7 @@ export function DraggableModal ({ children, maxHeight = 740, minHeight = 615, on
pt: 2,
px: 4,
top: modalPosition.y,
width: `${width}px`,
'&:focus': {
outline: 'none' // Remove outline when Box is focused
}
width: `${width}px`
};

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ export default function Confirmation ({ address, alterType, handleClose, txInfo,
}
<PButton
_ml={0}
_mt='15px'
_onClick={handleClose}
_width={90}
_width={100}
left='5%'
text={txInfo.success ? t('Done') : t('Close')}
/>
Expand Down

0 comments on commit 7d35cc2

Please sign in to comment.