-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(tsx): Tooltips - TypeScript, function based & split
- Loading branch information
1 parent
06c773d
commit 21901cb
Showing
13 changed files
with
85 additions
and
60 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
teamized/app/src/components/common/tooltips/iconTooltip.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react'; | ||
import { Tooltip } from './tooltip'; | ||
|
||
interface Props { | ||
title: string; | ||
icon: string; | ||
className: string; | ||
} | ||
|
||
export function IconTooltip({ | ||
title, | ||
icon = 'fas fa-info-circle', | ||
className = '', | ||
}: Partial<Props>) { | ||
return ( | ||
<Tooltip className={className} title={title}> | ||
<i className={'fa-fw ' + icon}></i> | ||
</Tooltip> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React, { useEffect, useRef } from 'react'; | ||
import { Tooltip as BSTooltip } from 'bootstrap'; | ||
|
||
interface Props { | ||
title: string; | ||
className: string; | ||
children: React.ReactNode; | ||
} | ||
|
||
export function Tooltip({ title, className = '', children }: Partial<Props>) { | ||
const tooltipRef = useRef<HTMLElement>(null); | ||
|
||
useEffect(() => { | ||
const tooltip = new BSTooltip(tooltipRef.current as HTMLElement); | ||
|
||
return () => tooltip.dispose(); | ||
}, []); | ||
|
||
return ( | ||
<abbr | ||
className={className} | ||
title={title} | ||
data-bs-toggle="tooltip" | ||
ref={tooltipRef} | ||
> | ||
{children} | ||
</abbr> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.