Skip to content

Commit

Permalink
feat: add tooltip title
Browse files Browse the repository at this point in the history
  • Loading branch information
Luca Tagliabue committed Aug 27, 2024
1 parent 69f9070 commit afe73ab
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/lib/components/data-table/_styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,6 @@
td {
opacity: .6;
}

&:hover {
td {
opacity: 1;
}
}
}

&--hide {
Expand Down
4 changes: 4 additions & 0 deletions src/lib/components/menu/_styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@

.ant-menu-item {
padding-left: 2rem;

&-disabled {
cursor: default;
}
}

.ant-menu-item,
Expand Down
12 changes: 12 additions & 0 deletions src/lib/components/tooltip/_styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,15 @@
}
}


.c-tooltip-title {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
white-space: nowrap;

&--align-item-custom {
align-items: var(--c-tooltip-title-align-item);
}
}
2 changes: 2 additions & 0 deletions src/lib/components/tooltip/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import AntdTooltip from 'antd/lib/tooltip';
import type { TooltipProps } from 'antd/lib/tooltip';
import TooltipTitle from './tooltip-title';

const Tooltip = ({ children, ...others }: TooltipProps) => (
<AntdTooltip mouseEnterDelay={0.5} {...others}>
Expand All @@ -8,5 +9,6 @@ const Tooltip = ({ children, ...others }: TooltipProps) => (
);

Tooltip.displayName = 'Tooltip';
Tooltip.TooltipTitle = TooltipTitle;

export default Tooltip;
15 changes: 15 additions & 0 deletions src/lib/components/tooltip/tooltip-title.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import classNames from 'classnames';

function TooltipTitle({ alignItem, children }) {
const css = classNames({
'c-tooltip-title--align-item-custom': alignItem,
});

return (
<div className={`c-tooltip-title ${css}`} style={{ '--c-tooltip-title-align-item': alignItem }}>
{children}
</div>
);
}

export default TooltipTitle;

0 comments on commit afe73ab

Please sign in to comment.