Skip to content

Commit d07b071

Browse files
author
Kubit
committed
Enhance Tooltip Components: Simple and Complex
1 parent 4305248 commit d07b071

File tree

3 files changed

+42
-3
lines changed

3 files changed

+42
-3
lines changed

src/components/tooltip/stories/tooltip.stories.tsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,44 @@ export const Tooltip: Story = {
4949
},
5050
};
5151

52+
export const TooltipSimple: Story = {
53+
args: {
54+
variant: Object.values(variantsObject[themeSelected].TooltipVariantType || {})[0] as string,
55+
title: { content: 'Tootltip title' },
56+
content: {
57+
content: (
58+
<div style={{ color: '#fff' }}>
59+
<div>content first line</div>
60+
</div>
61+
),
62+
},
63+
children: 'Hover me',
64+
align: TooltipAlignType.TOP,
65+
tooltipAsModal: false,
66+
themeArgs: themesObject[themeSelected][STYLES_NAME.TOOLTIP],
67+
},
68+
};
69+
70+
export const TooltipComplex: Story = {
71+
args: {
72+
variant: Object.values(variantsObject[themeSelected].TooltipVariantType || {})[0] as string,
73+
title: { content: 'Tootltip title' },
74+
content: {
75+
content: (
76+
<div style={{ color: '#fff' }}>
77+
<div>content first line</div>
78+
<div>content second line</div>
79+
</div>
80+
),
81+
},
82+
children: 'Hover me',
83+
align: TooltipAlignType.TOP,
84+
closeIcon: { icon: ICONS.ICON_PLACEHOLDER, altText: 'Close icon' },
85+
tooltipAsModal: true,
86+
themeArgs: themesObject[themeSelected][STYLES_NAME.TOOLTIP],
87+
},
88+
};
89+
5290
export const TooltipWithCtv: Story = {
5391
args: {
5492
variant: Object.values(variantsObject[themeSelected].TooltipVariantType || {})[0] as string,

src/components/tooltip/tooltipStandAlone.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ const TooltipStandAlone = ({
5959
const Tooltip = (
6060
<TooltipExternalContainerStyled
6161
ref={props.tooltipRef}
62-
aria-label={props.tooltipAsModal ? props.tooltipAriaLabel : undefined}
62+
aria-label={props.tooltipAriaLabel}
63+
aria-labelledby={titleId}
6364
as={getHtmlTagForTooltip({
6465
mediaDevice: props.mediaDevice,
6566
tooltipAsModal: props.tooltipAsModal,
@@ -107,7 +108,7 @@ const TooltipStandAlone = ({
107108
styles={props.styles}
108109
>
109110
<Text
110-
component={TextComponentType.SPAN}
111+
component={TextComponentType.H2}
111112
customTypography={props.styles?.title}
112113
dataTestId={`${props.dataTestId}TooltipContentTitle`}
113114
variant={props.styles.title?.font_variant}

src/components/tooltip/tooltipUnControlled.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ const TooltipUnControlledComponent = React.forwardRef(
151151
mediaDevice={mediaDevice}
152152
popoverOpen={open}
153153
styles={styles}
154-
tooltipAriaLabel={tooltipAriaLabel ?? helpAriaLabel}
154+
tooltipAriaLabel={tooltipAriaLabel}
155155
tooltipAsModal={tooltipAsModalValue}
156156
tooltipRef={tooltipRef}
157157
onBlur={handleBlur}

0 commit comments

Comments
 (0)