ghost-portal/packages/react-components/src/EditButton.tsx
Jaco Greeff a0b82d88a4
Use import type { ... } (#4052)
* Use import type { ... }

* value imports

* TypeDefInfo

* Apply suggestions from code review

* fixes... am going blind.
2020-11-19 16:20:14 +01:00

50 lines
1.0 KiB
TypeScript

// Copyright 2017-2020 @polkadot/react-components authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { IconName } from '@fortawesome/fontawesome-svg-core';
import type { VoidFn } from './types';
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: VoidFn;
}
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;
}
`);