Compare commits

...

1 Commits

Author SHA1 Message Date
Saumya Pandey f86f163b81 fix: lazy load tippy 2022-09-04 21:34:20 +05:30
2 changed files with 24 additions and 7 deletions
@@ -1,12 +1,7 @@
import Tippy, { TippyProps } from "@tippy.js/react";
import { TFunctionResult } from "i18next";
import Tippy from "@tippy.js/react";
import * as React from "react";
import styled from "styled-components";
export type Props = Omit<TippyProps, "content" | "theme"> & {
tooltip: React.ReactChild | React.ReactChild[] | TFunctionResult;
shortcut?: React.ReactNode;
};
import { Props } from ".";
function Tooltip({ shortcut, tooltip, delay = 50, ...rest }: Props) {
let content = <>{tooltip}</>;
+22
View File
@@ -0,0 +1,22 @@
import type { TippyProps } from "@tippy.js/react";
import { TFunctionResult } from "i18next";
import React from "react";
export type Props = Omit<TippyProps, "content" | "theme"> & {
tooltip: React.ReactChild | React.ReactChild[] | TFunctionResult;
shortcut?: React.ReactNode;
};
const LazyTooltip = React.lazy(() => {
return import(/* webpackChunkName: "tooltip" */ "./Tooltip");
});
const Tooltip = (props: Props) => {
return (
<React.Suspense fallback={null}>
<LazyTooltip {...props} />
</React.Suspense>
);
};
export default Tooltip;