-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: swap tooltip component with plane ui package * chore: swap linear progress component with plane ui package * fix: login button fix
- Loading branch information
1 parent
d58d639
commit 67b2821
Showing
78 changed files
with
348 additions
and
392 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from "./radial-progress"; | ||
export * from "./progress-bar"; | ||
export * from "./linear-progress-indicator"; |
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,44 @@ | ||
import React from "react"; | ||
import { Tooltip } from "../tooltip"; | ||
|
||
type Props = { | ||
data: any; | ||
noTooltip?: boolean; | ||
}; | ||
|
||
export const LinearProgressIndicator: React.FC<Props> = ({ | ||
data, | ||
noTooltip = false, | ||
}) => { | ||
const total = data.reduce((acc: any, cur: any) => acc + cur.value, 0); | ||
let progress = 0; | ||
|
||
const bars = data.map((item: any) => { | ||
const width = `${(item.value / total) * 100}%`; | ||
const style = { | ||
width, | ||
backgroundColor: item.color, | ||
}; | ||
progress += item.value; | ||
if (noTooltip) return <div style={style} />; | ||
else | ||
return ( | ||
<Tooltip | ||
key={item.id} | ||
tooltipContent={`${item.name} ${Math.round(item.value)}%`} | ||
> | ||
<div style={style} /> | ||
</Tooltip> | ||
); | ||
}); | ||
|
||
return ( | ||
<div className="flex h-1 w-full items-center justify-between gap-1"> | ||
{total === 0 ? ( | ||
<div className="flex h-full w-full gap-1 bg-neutral-500">{bars}</div> | ||
) : ( | ||
<div className="flex h-full w-full gap-1">{bars}</div> | ||
)} | ||
</div> | ||
); | ||
}; |
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 @@ | ||
export * from "./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,86 @@ | ||
import React from "react"; | ||
|
||
// next-themes | ||
import { useTheme } from "next-themes"; | ||
import { Tooltip2 } from "@blueprintjs/popover2"; | ||
|
||
export type TPosition = | ||
| "top" | ||
| "right" | ||
| "bottom" | ||
| "left" | ||
| "auto" | ||
| "auto-end" | ||
| "auto-start" | ||
| "bottom-left" | ||
| "bottom-right" | ||
| "left-bottom" | ||
| "left-top" | ||
| "right-bottom" | ||
| "right-top" | ||
| "top-left" | ||
| "top-right"; | ||
|
||
interface ITooltipProps { | ||
tooltipHeading?: string; | ||
tooltipContent: string | React.ReactNode; | ||
position?: TPosition; | ||
children: JSX.Element; | ||
disabled?: boolean; | ||
className?: string; | ||
openDelay?: number; | ||
closeDelay?: number; | ||
} | ||
|
||
export const Tooltip: React.FC<ITooltipProps> = ({ | ||
tooltipHeading, | ||
tooltipContent, | ||
position = "top", | ||
children, | ||
disabled = false, | ||
className = "", | ||
openDelay = 200, | ||
closeDelay, | ||
}) => { | ||
const { theme } = useTheme(); | ||
|
||
return ( | ||
<Tooltip2 | ||
disabled={disabled} | ||
hoverOpenDelay={openDelay} | ||
hoverCloseDelay={closeDelay} | ||
content={ | ||
<div | ||
className={`relative z-50 max-w-xs gap-1 rounded-md p-2 text-xs shadow-md ${ | ||
theme === "custom" | ||
? "bg-custom-background-100 text-custom-text-200" | ||
: "bg-black text-gray-400" | ||
} break-words overflow-hidden ${className}`} | ||
> | ||
{tooltipHeading && ( | ||
<h5 | ||
className={`font-medium ${ | ||
theme === "custom" ? "text-custom-text-100" : "text-white" | ||
}`} | ||
> | ||
{tooltipHeading} | ||
</h5> | ||
)} | ||
{tooltipContent} | ||
</div> | ||
} | ||
position={position} | ||
renderTarget={({ | ||
isOpen: isTooltipOpen, | ||
ref: eleReference, | ||
...tooltipProps | ||
}) => | ||
React.cloneElement(children, { | ||
ref: eleReference, | ||
...tooltipProps, | ||
...children.props, | ||
}) | ||
} | ||
/> | ||
); | ||
}; |
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 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
Oops, something went wrong.