Logic improvements, move stat blocks to right side

This commit is contained in:
DaneEveritt 2022-06-27 19:56:26 -04:00
parent ad6e9f076b
commit bf287c45d6
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
5 changed files with 27 additions and 32 deletions

View file

@ -4,7 +4,7 @@ import Portal from '@/components/elements/Portal';
import copy from 'copy-to-clipboard';
import classNames from 'classnames';
const CopyOnClick: React.FC<{ text: any; disabled?: boolean }> = ({ text, disabled, children }) => {
const CopyOnClick: React.FC<{ text: string | number | null | undefined }> = ({ text, children }) => {
const [copied, setCopied] = useState(false);
useEffect(() => {
@ -23,12 +23,12 @@ const CopyOnClick: React.FC<{ text: any; disabled?: boolean }> = ({ text, disabl
throw new Error('Component passed to <CopyOnClick/> must be a valid React element.');
}
const child = disabled
const child = !text
? React.Children.only(children)
: React.cloneElement(React.Children.only(children), {
className: classNames(children.props.className || '', 'cursor-pointer'),
onClick: (e: React.MouseEvent<HTMLElement>) => {
copy(text);
copy(String(text));
setCopied(true);
if (typeof children.props.onClick === 'function') {
children.props.onClick(e);