diff --git a/app/assets/css/app.css b/app/assets/css/app.css index 7f348fd09..95cdaeb73 100644 --- a/app/assets/css/app.css +++ b/app/assets/css/app.css @@ -129,25 +129,6 @@ a[ng-click] { background-color: var(--bg-service-datatable-tbody); } -.tooltip.portainer-tooltip .tooltip-inner { - font-family: Montserrat; - background-color: var(--bg-tooltip-color); - padding: 0.833em 1em; - color: var(--text-tooltip-color); - border: 1px solid var(--border-tooltip-color); - border-radius: 0.14285714rem; - box-shadow: 0 2px 4px 0 rgba(34, 36, 38, 0.12), 0 2px 10px 0 rgba(34, 36, 38, 0.15); -} - -.tooltip.portainer-tooltip .tooltip-arrow { - display: none; -} - -.fa.tooltip-icon { - margin-left: 5px; - font-size: 1.3em; -} - .fa.green-icon { color: #23ae89; } diff --git a/app/portainer/components/Tooltip/Tooltip.css b/app/portainer/components/Tooltip/Tooltip.css new file mode 100644 index 000000000..9c31167e7 --- /dev/null +++ b/app/portainer/components/Tooltip/Tooltip.css @@ -0,0 +1,18 @@ +.tooltip.portainer-tooltip .tooltip-inner { + font-family: Montserrat; + background-color: var(--bg-tooltip-color); + padding: 0.833em 1em; + color: var(--text-tooltip-color); + border: 1px solid var(--border-tooltip-color); + border-radius: 0.14285714rem; + box-shadow: 0 2px 4px 0 rgba(34, 36, 38, 0.12), 0 2px 10px 0 rgba(34, 36, 38, 0.15); +} + +.tooltip.portainer-tooltip .tooltip-arrow { + display: none; +} + +.fa.tooltip-icon { + margin-left: 5px; + font-size: 1.3em; +} diff --git a/app/portainer/components/Tooltip/Tooltip.module.css b/app/portainer/components/Tooltip/Tooltip.module.css new file mode 100644 index 000000000..b4185ec4d --- /dev/null +++ b/app/portainer/components/Tooltip/Tooltip.module.css @@ -0,0 +1,19 @@ +.tooltip-wrapper { + display: inline-block; + position: relative; +} + +.tooltip { + font-family: Montserrat !important; + background-color: var(--bg-tooltip-color) !important; + padding: 0.833em 1em !important; + color: var(--text-tooltip-color) !important; + border: 1px solid var(--border-tooltip-color) !important; + border-radius: 0.14285714rem !important; + box-shadow: 0 2px 4px 0 rgba(34, 36, 38, 0.12), 0 2px 10px 0 rgba(34, 36, 38, 0.15) !important; +} + +.icon { + margin-left: 5px; + font-size: 1.3em; +} diff --git a/app/portainer/components/Tooltip/Tooltip.stories.tsx b/app/portainer/components/Tooltip/Tooltip.stories.tsx new file mode 100644 index 000000000..9c52e6f68 --- /dev/null +++ b/app/portainer/components/Tooltip/Tooltip.stories.tsx @@ -0,0 +1,23 @@ +import { Meta, Story } from '@storybook/react'; + +import { Tooltip, Props } from './Tooltip'; + +export default { + component: Tooltip, + title: 'Components/Tooltip', +} as Meta; + +function Template({ message, position }: JSX.IntrinsicAttributes & Props) { + return ( +
+ Example tooltip + +
+ ); +} + +export const Primary: Story = Template.bind({}); +Primary.args = { + message: 'Tooltip example', + position: 'bottom', +}; diff --git a/app/portainer/components/Tooltip/Tooltip.tsx b/app/portainer/components/Tooltip/Tooltip.tsx new file mode 100644 index 000000000..f10cf83bd --- /dev/null +++ b/app/portainer/components/Tooltip/Tooltip.tsx @@ -0,0 +1,31 @@ +import ReactTooltip from 'react-tooltip'; +import clsx from 'clsx'; + +import styles from './Tooltip.module.css'; + +type Place = 'top' | 'right' | 'bottom' | 'left'; + +export interface Props { + position?: Place; + message: string; +} + +export function Tooltip({ message, position = 'bottom' }: Props) { + return ( + +