Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*feat tooltip secondary color #569

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified packages/ui/.loki/reference/chrome_minimal_App_Header_Default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions packages/ui/__stories__/Tooltip.stories.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.wrapper {
display: flex;
align-items: center;
justify-content: center;
gap: 380px;
height: 340px;
}
45 changes: 29 additions & 16 deletions packages/ui/__stories__/Tooltip.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { Meta, Story } from '@storybook/react'
import { Tooltip, TooltipProps } from '../src/Tooltip'
import { Button } from '../src/Button'

import styles from './Tooltip.stories.module.scss'

export default {
title: 'Components/Tooltip',
component: Tooltip,
Expand All @@ -22,22 +24,33 @@ export default {
} as Meta<TooltipProps>

const Template: Story<TooltipProps> = (args) => (
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 380, height: 320 }}>
<Tooltip {...args}>
{(ref) => (
<Button ref={ref} aria-labelledby={args.id} style={{ height: 80 }}>
This button has a tooltip
</Button>
)}
</Tooltip>
<Tooltip color="dark" {...args}>
{(ref) => (
<Button ref={ref} aria-labelledby={args.id} style={{ height: 80 }}>
This button has a tooltip
</Button>
)}
</Tooltip>
</div>
<>
<div className={styles.wrapper}>
<Tooltip {...args}>
{(ref) => (
<Button ref={ref} aria-labelledby={args.id} style={{ height: 80 }}>
This button has a tooltip
</Button>
)}
</Tooltip>
<Tooltip color="dark" {...args}>
{(ref) => (
<Button ref={ref} aria-labelledby={args.id} style={{ height: 80 }}>
This button has a tooltip
</Button>
)}
</Tooltip>
</div>
<div className={styles.wrapper}>
<Tooltip color="secondary" {...args}>
{(ref) => (
<Button ref={ref} aria-labelledby={args.id} style={{ height: 80 }}>
This button has a tooltip
</Button>
)}
</Tooltip>
</div>
</>
)

export const AutoPlacement = Template.bind({})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ $selectFieldIndicators: ':global .hz-select-field__indicators';
}

#{$selectControl} {
border: none;
background: none;
border-radius: unset;
border-radius: c.$borderRadius;
border: 1px solid c.$colorTextSecondary;

#{$selectInputContainer},
#{$selectValueContainer},
Expand Down
8 changes: 8 additions & 0 deletions packages/ui/src/Tooltip.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,14 @@ $tooltipArrowSize2-3: math.div(c.$tooltipArrowSize, 3) * 2;
left: -99999px !important;
}

&.secondary {
border: none;
color: c.$colorNeutralWhite;
background-color: c.$colorTextSubdued;

@include arrowPlacements(c.$colorTextSubdued, transparent);
}

&.dark {
border: none;
color: c.$brandColorText;
Expand Down
13 changes: 8 additions & 5 deletions packages/ui/src/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export type TooltipProps = {
hideTimeoutDuration?: number
offset?: number
arrow?: boolean
color?: 'dark'
color?: 'dark' | 'secondary'
padding?: number
placement?: Placement
visible?: boolean
Expand Down Expand Up @@ -234,10 +234,13 @@ export const Tooltip: FC<TooltipProps> = ({
<>
<span
ref={setPopperElement}
className={cn(styles.overlay, {
[styles.dark]: color === 'dark',
[styles.hidden]: !isTooltipVisible,
})}
className={cn(
styles.overlay,
{
[styles.hidden]: !isTooltipVisible,
},
color && [styles[color]],
)}
style={{ ...popper.styles.popper, ...{ zIndex: context ? zIndex + 1 : zIndex }, wordBreak }}
data-test="tooltip-overlay"
aria-hidden
Expand Down
Loading