mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* first version of the pack * single entry point * add custom components to the package * move form components to toolkit * add more utils and hooks to the package * minor fixes * add CI workflow * update readme and package.json * fix ts * fix build of env-validator * fix docker build * fix icons size * test fixes * more test fixes
37 lines
961 B
TypeScript
37 lines
961 B
TypeScript
import { Icon } from '@chakra-ui/react';
|
|
import React from 'react';
|
|
|
|
import ArrowIcon from 'icons/arrows/east.svg';
|
|
|
|
import type { IconButtonProps } from '../../chakra/icon-button';
|
|
import { IconButton } from '../../chakra/icon-button';
|
|
import { Link } from '../../chakra/link';
|
|
import { Tooltip } from '../../chakra/tooltip';
|
|
|
|
export interface BackToButtonProps extends IconButtonProps {
|
|
href?: string;
|
|
hint?: string;
|
|
}
|
|
|
|
export const BackToButton = ({ href, hint, boxSize = 6, ...rest }: BackToButtonProps) => {
|
|
|
|
const button = (
|
|
<IconButton { ...rest } boxSize={ boxSize }>
|
|
<Icon
|
|
transform="rotate(180deg)"
|
|
color="icon.backTo"
|
|
_hover={{ color: 'link.primary.hover' }}
|
|
boxSize={ boxSize }
|
|
>
|
|
<ArrowIcon/>
|
|
</Icon>
|
|
</IconButton>
|
|
);
|
|
|
|
return (
|
|
<Tooltip content={ hint } disabled={ !hint }>
|
|
{ href ? <Link href={ href } asChild>{ button }</Link> : button }
|
|
</Tooltip>
|
|
);
|
|
};
|