import {
Box,
Tab,
TabList,
TabPanel,
TabPanels,
Tabs,
Image,
Text,
} from "@chakra-ui/react";
import { FunctionComponent, useEffect, useState } from "react";
import { Link } from "react-router-dom";
import { usePackageState } from "./PackageState";
import { Code } from "../../components/Code";
import { getPackagePath } from "../../util/url";
export const ShareInfo: FunctionComponent = () => {
const [tabIndex, setTabIndex] = useState(0);
const { scope, name } = usePackageState();
const pkgName = scope ? `${scope}/${name}` : name;
const encodedName = encodeURIComponent(pkgName);
useEffect(() => {
setTabIndex(0);
}, []);
const baseUrl = window.location.hostname; // e.g. "constructs.dev"
const packagePath = getPackagePath({ name: pkgName });
const imageUrl = `https://${baseUrl}/badge?package=${encodedName}`;
const linkUrl = `https://${baseUrl}${packagePath}`;
const markdown = `[](${linkUrl})`;
const html = ``;
return (
Use the snippets below in your Git repositories or elsewhere to add a
button that links to this package. The button will automatically update
to light mode or dark mode based on whether the user's client has
requested a light or dark theme.
MarkdownHTML
);
};