Skip to content

Commit

Permalink
1506: Adds clickabe icon padding
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben van Leeuwen authored and DutchBen committed Nov 12, 2024
1 parent 87de232 commit 6e44247
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,20 @@ export const WfoValueCell: FC<WfoValueCellProps> = ({
const {
clipboardIconSize,
clipboardIconStyle,
clickable,
clickableStyle,
getBackgroundColorStyleForRow,
valueColumnStyle,
valueCellStyle,
} = useWithOrchestratorTheme(getStyles);

const shouldRenderCopyColumn = enableCopyIcon && textToCopy;

const valueToRender = React.isValidElement(value)
? value
: JSON.stringify(value);
const valueToRender =
typeof value === 'string' ||
typeof value === 'number' ||
React.isValidElement(value)
? value
: JSON.stringify(value);

const copyText =
typeof textToCopy === 'object'
Expand All @@ -48,7 +51,7 @@ export const WfoValueCell: FC<WfoValueCellProps> = ({
{shouldRenderCopyColumn && (
<EuiCopy textToCopy={copyText || ''}>
{(copy) => (
<div onClick={copy} css={clickable}>
<div onClick={copy} css={clickableStyle}>
<WfoClipboardCopy
width={clipboardIconSize}
height={clipboardIconSize}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ export const getStyles = ({ theme }: WfoTheme) => {
paddingBottom: 0,
});

const clickable = css({
const clickableStyle = css({
marginLeft: clipboardIconMargin,
cursor: 'pointer',
paddingRight: theme.size.s,
});

return {
Expand All @@ -87,7 +88,7 @@ export const getStyles = ({ theme }: WfoTheme) => {
keyCellStyle,
valueCellStyle,
clipboardIconStyle,
clickable,
clickableStyle,
lightBackground,
darkBackground,
getBackgroundColorStyleForRow,
Expand Down

0 comments on commit 6e44247

Please sign in to comment.