import React from "react";
import { Button, Heading, Image, Stack, useColorMode } from "@chakra-ui/core";
import { Textfit } from "react-textfit";
import { motion, AnimatePresence } from "framer-motion";
import useConfig from "~/components/HyperglassProvider";
import useMedia from "~/components/MediaProvider";
const subtitleAnimation = {
transition: { duration: 0.2, type: "tween" },
initial: { opacity: 1, scale: 1 },
animate: { opacity: 1, scale: 1 },
exit: { opacity: 0, scale: 0.3 }
};
const titleSize = { true: "2xl", false: "lg" };
const titleMargin = { true: 2, false: 0 };
const TitleOnly = ({ text, showSubtitle }) => (
{text}
);
const SubtitleOnly = React.forwardRef(({ text, size = "md", ...props }, ref) => (
{text}
));
const AnimatedSubtitle = motion.custom(SubtitleOnly);
const textAlignment = { false: ["right", "center"], true: ["left", "center"] };
const TextOnly = ({ text, mediaSize, showSubtitle, ...props }) => (
{showSubtitle && }
);
const Logo = ({ text, logo }) => {
const { colorMode } = useColorMode();
const logoColor = { light: logo.dark, dark: logo.light };
const logoPath = logoColor[colorMode];
return ;
};
const LogoTitle = ({ text, logo, showSubtitle }) => (
<>
{showSubtitle && (
)}
>
);
const All = ({ text, logo, mediaSize, showSubtitle }) => (
<>
>
);
const modeMap = { text_only: TextOnly, logo_only: Logo, logo_title: LogoTitle, all: All };
const btnJustify = {
true: ["flex-end", "center"],
false: ["flex-start", "center"]
};
export default React.forwardRef(({ onClick, isSubmitting, ...props }, ref) => {
const { web } = useConfig();
const { mediaSize } = useMedia();
const titleMode = web.text.title_mode;
const MatchedMode = modeMap[titleMode];
return (
);
});