From a49fc395ad693c5b5edc3f935f4df8a4a5528086 Mon Sep 17 00:00:00 2001 From: Harjot Singh Date: Tue, 12 Nov 2024 10:06:09 +0000 Subject: [PATCH] feat(frontend): improve layout of copy ip address buttons in About --- .../settings/-components/CopyButton/index.tsx | 24 ++++++++++++------- .../src/app/settings/server/about/index.css | 4 ++++ .../src/app/settings/server/about/index.tsx | 16 ++++++++++--- 3 files changed, 32 insertions(+), 12 deletions(-) create mode 100644 apps/frontend/src/app/settings/server/about/index.css diff --git a/apps/frontend/src/app/settings/-components/CopyButton/index.tsx b/apps/frontend/src/app/settings/-components/CopyButton/index.tsx index e80c480c..d789569e 100644 --- a/apps/frontend/src/app/settings/-components/CopyButton/index.tsx +++ b/apps/frontend/src/app/settings/-components/CopyButton/index.tsx @@ -1,29 +1,35 @@ import './index.css' import { Button, Tooltip } from '@mui/material' +import classNames from 'classnames' +import { noop } from 'radashi' +import { ReactNode } from 'react' import { useCopyToClipboard } from '~/hooks' type CopyButtonProps = { + className?: string, copyText: string, - onClick?: () => Record, - children: React.ReactNode, - style?: Record, + onClick?: () => void, + children: ReactNode, } -const CopyButton = ( - { copyText, onClick: originalOnClick = () => ( {} ), ...props }: CopyButtonProps -) => { +const CopyButton = ( { + className, + copyText, + onClick = noop, + ...props +}: CopyButtonProps ) => { const copyToClipboard = useCopyToClipboard() - const onClick = () => { - originalOnClick() + const handleClick = () => { + onClick() copyToClipboard( copyText ) } return ( -