mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-25 17:19:48 +00:00
27 lines
691 B
JavaScript
27 lines
691 B
JavaScript
import React, { useMemo } from 'react';
|
|
import classNames from 'classnames';
|
|
import { Button, Tooltip, Classes } from '@blueprintjs/core';
|
|
|
|
export default function InputPrependButton({
|
|
buttonProps = {},
|
|
tooltip = false,
|
|
tooltipProps = {},
|
|
}) {
|
|
const appendButton = useMemo(() => (
|
|
<Button
|
|
className={classNames('input-prepend__button', Classes.SMALL)}
|
|
{...buttonProps}
|
|
/>
|
|
), [buttonProps]);
|
|
|
|
const appendButtonWithTooltip = useMemo(
|
|
() => (<Tooltip {...tooltipProps}>{ appendButton }</Tooltip>),
|
|
[tooltipProps, appendButton],
|
|
);
|
|
|
|
return (
|
|
<div class="input-prepend">
|
|
{ tooltip ? appendButtonWithTooltip : appendButton }
|
|
</div>
|
|
);
|
|
} |