@coin-voyage/paykit
Version:
Seamless crypto payments. Onboard users from any chain, any coin into your app with one click.
24 lines (23 loc) • 805 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import React from "react";
import useFitText from "../../../hooks/useFitText";
const FitText = ({ children }) => {
const [ready, setReady] = React.useState(false);
const { fontSize, ref: textRef } = useFitText({
maxFontSize: 100,
minFontSize: 70,
onStart: () => setReady(true),
onFinish: () => setReady(true),
});
return (_jsx("div", { ref: textRef, style: {
visibility: ready ? "visible" : "hidden",
fontSize: `${fontSize}%`,
maxHeight: "100%",
maxWidth: "100%",
display: "flex",
justifyContent: "center",
alignItems: "center",
}, children: children }));
};
FitText.displayName = "FitText";
export default FitText;