Skip to content

Commit

Permalink
Merge pull request #7560 from sobitneupane/sn_bug-reimburse-tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
thienlnam authored Feb 7, 2022
2 parents 442b9fc + 017684c commit 6976b4a
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/components/CopyTextToClipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@ import Text from './Text';
import * as Expensicons from './Icon/Expensicons';
import Clipboard from '../libs/Clipboard';
import Icon from './Icon';
import Tooltip from './Tooltip';
import styles from '../styles/styles';
import themeColors from '../styles/themes/default';
import variables from '../styles/variables';
import withLocalize, {withLocalizePropTypes} from './withLocalize';

const propTypes = {
/** The text to display and copy to the clipboard */
text: PropTypes.string.isRequired,

/** Styles to apply to the text */
textStyles: PropTypes.arrayOf(PropTypes.object),

...withLocalizePropTypes,
};

const defaultProps = {
Expand Down Expand Up @@ -53,13 +57,15 @@ class CopyTextToClipboard extends React.Component {
style={[styles.flexRow, styles.cursorPointer]}
>
<Text style={this.props.textStyles}>{this.props.text}</Text>
<Icon
src={this.state.showCheckmark ? Expensicons.Checkmark : Expensicons.Clipboard}
fill={this.state.showCheckmark ? themeColors.iconSuccessFill : themeColors.icon}
width={variables.iconSizeSmall}
height={variables.iconSizeSmall}
inline
/>
<Tooltip text={this.props.translate('reportActionContextMenu.copyToClipboard')}>
<Icon
src={this.state.showCheckmark ? Expensicons.Checkmark : Expensicons.Clipboard}
fill={this.state.showCheckmark ? themeColors.iconSuccessFill : themeColors.icon}
width={variables.iconSizeSmall}
height={variables.iconSizeSmall}
inline
/>
</Tooltip>
</Text>
);
}
Expand All @@ -68,4 +74,4 @@ class CopyTextToClipboard extends React.Component {
CopyTextToClipboard.propTypes = propTypes;
CopyTextToClipboard.defaultProps = defaultProps;

export default CopyTextToClipboard;
export default withLocalize(CopyTextToClipboard);

0 comments on commit 6976b4a

Please sign in to comment.