ghost-portal/packages/react-components/src/EditButton.tsx
Jaco Greeff b22f61347e
Remove unused TxModal components (#4250)
* Remove unused TxModal components

* Cleanups
2020-12-20 17:50:06 +01:00

49 lines
1001 B
TypeScript

// Copyright 2017-2020 @polkadot/react-components authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { IconName } from '@fortawesome/fontawesome-svg-core';
import React from 'react';
import styled from 'styled-components';
import { colorLink } from './styles/theme';
import Icon from './Icon';
interface Props {
children?: React.ReactNode;
className?: string;
icon?: IconName;
onClick: () => void;
}
function EditButton ({ children, className, icon = 'edit', onClick }: Props): React.ReactElement<Props> {
return (
<div
className={className}
onClick={onClick}
>
{children}
<span className='editSpan'>
<Icon
className='icon-button'
icon={icon}
/>
</span>
</div>
);
}
export default React.memo(styled(EditButton)`
cursor: pointer;
.ui--Icon.icon-button {
color: ${colorLink};
cursor: pointer;
margin: 0 0 0 0.5rem;
}
.editSpan {
white-space: nowrap;
}
`);