Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added Esc functionality and improve styling of cancel button in ToolingDetail modal #1328

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions pages/tools/components/ToolingDetailModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ export default function ToolingDetailModal({
};
}, []);

useEffect(() => {
const clickEsc = (event: KeyboardEvent) => {
if (event.key === 'Escape') {
onClose();
}
};
document.addEventListener('keydown', clickEsc);
return () => {
document.removeEventListener('keydown', clickEsc);
};
}, [onClose]);

return (
<div className='fixed inset-0 flex items-center justify-center z-50 overflow-x-hidden'>
<div
Expand All @@ -36,9 +48,9 @@ export default function ToolingDetailModal({
<div className='flex justify-end absolute top-0 right-0 mt-6 mr-6'>
<button
onClick={onClose}
className='text-gray-500 hover:text-gray-700'
className='text-gray-500 hover:text-gray-300'
>
<CancelIcon className='fill-current stroke-current w-3 h-3' />
<CancelIcon className='fill-current stroke-current w-4 h-4' />
</button>
</div>
<div className='mt-4 flex flex-row items-center justify-start gap-2'>
Expand Down