nextui/apps/docs/components/sandpack/refresh-button.tsx
2023-05-14 00:44:10 -03:00

28 lines
643 B
TypeScript

import * as React from "react";
import {useSandpackNavigation} from "@codesandbox/sandpack-react";
import {clsx} from "@nextui-org/shared-utils";
import {RotateRightLinearIcon} from "@/components/icons";
interface RefreshButtonProps {
clientId?: string;
}
/**
* @category Components
*/
export const RefreshButton = ({clientId}: RefreshButtonProps): JSX.Element => {
const {refresh} = useSandpackNavigation(clientId);
return (
<button
className={clsx("sp-button", "sp-icon-standalone")}
title="Refresh Sandpack"
type="button"
onClick={refresh}
>
<RotateRightLinearIcon />
</button>
);
};