Skip to content

Commit

Permalink
improve tooltip (#397)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thykof authored Feb 6, 2024
1 parent 97e7381 commit 7ea8677
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/components/Token/Token.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function Token(props: TokenProps) {
<p className="mas-menu-active">{`${name} (${symbol})`} </p>
<span className="flex items-center gap-2">
<p className="mas-menu">{formattedBalance}</p>
<Tooltip content={rawBalance} />
<Tooltip body={rawBalance} />
</span>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Tooltip/Tooltip.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ export default { title: 'Components/Tooltip', component: Tooltip };
export const _Tooltip = {
render: () => (
<>
<Tooltip content={'Hello I am tooltip content'} />
<Tooltip body={'Hello I am tooltip content'} />
</>
),
};

export const _TooltipCustomIcon = {
render: () => (
<>
<Tooltip content={'Hello I am tooltip content'}>
<Tooltip body={<p>Hello I am tooltip content</p>}>
<FiAirplay size={48} className="text-s-warning" />
</Tooltip>
</>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Tooltip/Tooltip.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Tooltip } from '.';

describe('Components | Toggle', () => {
test('it should render', () => {
render(<Tooltip content={'Hello I am tooltip content'} />);
render(<Tooltip body={'Hello I am tooltip content'} />);

let tooltip = screen.getByTestId('Tooltip');

Expand Down
6 changes: 3 additions & 3 deletions src/components/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import { ComponentPropsWithoutRef, useState } from 'react';
import { FiHelpCircle } from 'react-icons/fi';

export interface TooltipProps extends ComponentPropsWithoutRef<'div'> {
children?: ReactNode;
customClass?: string;
body: ReactNode | string;
}

export function Tooltip(props: TooltipProps) {
const { content, children, customClass = '', ...rest } = props;
const { body, children, customClass = '', ...rest } = props;

const [showTooltip, setShowTooltip] = useState(false);

Expand All @@ -29,7 +29,7 @@ export function Tooltip(props: TooltipProps) {
<div
className={`w-fit z-10 absolute bg-tertiary p-3 rounded-lg text-neutral ml-2 ${customClass}`}
>
{content}
{body}
</div>
)}
</div>
Expand Down

0 comments on commit 7ea8677

Please sign in to comment.