@chakra-ui/icons#ExternalLinkIcon TypeScript Examples
The following examples show how to use
@chakra-ui/icons#ExternalLinkIcon.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CourseCard.tsx From fresh-coupons with GNU General Public License v3.0 | 6 votes |
function CourseInstructors({instructors, ...props}: CourseInstructorsProps) {
if (!instructors) {
return <></>
}
return (
<HStack mt="4" spacing={3} {...props}>
{instructors && instructors.map(instructor => (
<HStack spacing={1} key={instructor.url}>
<Icon as={BsPersonSquare} color="gray.400"/>
<Link
href={`https://${instructor.url}`}
isExternal
fontSize="sm"
fontWeight="medium"
_visited={{
color: "cadetblue"
}}
color={useColorModeValue('gray.600', 'gray.300')}
>
{instructor.name}
<ExternalLinkIcon mx="2"/>
</Link>
</HStack>
))}
</HStack>
)
}
Example #2
Source File: CourseCard.tsx From fresh-coupons with GNU General Public License v3.0 | 6 votes |
function CourseTitle({title, url, ...props}: CourseTitleProps) {
return (
<Link
_visited={{
color: "cadetblue"
}}
href={url} target="_blank" isExternal {...props}>
<Text as="h2" fontWeight="bold" fontSize="xl">
{title}
<ExternalLinkIcon mx="2px"/>
</Text>
</Link>
)
}
Example #3
Source File: ErrorPage.tsx From rari-dApp with GNU Affero General Public License v3.0 | 6 votes |
ErrorPage: React.FC<FallbackProps> = ({ error }) => {
const { t } = useTranslation();
return (
<Box color="white">
<Box bg="red.600" width="100%" p={4}>
<Heading>{t("Whoops! Looks like something went wrong!")}</Heading>
<Text>
{t(
"You can either reload the page, or report this error to us on our"
)}{" "}
<Link isExternal href="https://github.com/Rari-Capital/rari-dApp">
<u>GitHub</u>
<ExternalLinkIcon mx="2px" />
</Link>
</Text>
</Box>
<Code colorScheme="red">{error.toString()}</Code>
</Box>
);
}
Example #4
Source File: PoolPortal.tsx From rari-dApp with GNU Affero General Public License v3.0 | 6 votes |
TransactionHistory = () => {
const { t } = useTranslation();
const poolType = usePoolType();
const { rari, address } = useRari();
const poolAddress: string = getSDKPool({ rari, pool: poolType }).contracts //@ts-ignore
.RariFundToken.options.address;
return (
<Link
href={`https://etherscan.io/token/${poolAddress}?a=${address}`}
isExternal
>
<Column
expand
mainAxisAlignment="center"
crossAxisAlignment="center"
textAlign="center"
fontWeight="bold"
fontSize="md"
>
<ExternalLinkIcon boxSize="18px" mb="6px" />
{t("View Transaction History")}
</Column>
</Link>
);
}
Example #5
Source File: _app.tsx From graphql-mesh with MIT License | 6 votes |
LinkNewTabIfExternal = (props: LinkProps & NextLinkProps) => {
return props.href.startsWith('/') ? (
// @ts-expect-error type incompatibility
<Link {...props} color="accentColor" sx={{ '&:hover': { textDecoration: 'none' } }} />
) : (
<>
{/* @ts-expect-error type incompatibility */}
<Link {...props} isExternal={true} color="accentColor" sx={{ '&:hover': { textDecoration: 'none' } }} />{' '}
<ExternalLinkIcon />
</>
);
}
Example #6
Source File: Header.tsx From openchakra with MIT License | 6 votes |
CodeSandboxButton = () => {
const components = useSelector(getComponents)
const [isLoading, setIsLoading] = useState(false)
return (
<Tooltip
zIndex={100}
hasArrow
bg="yellow.100"
aria-label="Builder mode help"
label="Export in CodeSandbox"
>
<Button
onClick={async () => {
setIsLoading(true)
const code = await generateCode(components)
setIsLoading(false)
const parameters = buildParameters(code)
window.open(
`https://codesandbox.io/api/v1/sandboxes/define?parameters=${parameters}`,
'_blank',
)
}}
isLoading={isLoading}
rightIcon={<ExternalLinkIcon path="" />}
variant="ghost"
size="xs"
>
Export code
</Button>
</Tooltip>
)
}
Example #7
Source File: PaymentMethodButtonModal.tsx From coindrop with GNU General Public License v3.0 | 5 votes |
PaymentMethodButtonModal: FunctionComponent<Props> = ({ isOpen, onClose, paymentMethod, paymentMethodDisplayName, paymentMethodValue }) => {
const { onCopy, hasCopied } = useClipboard(paymentMethodValue);
const { piggybankDbData } = useContext(PublicPiggybankDataContext);
const { name } = piggybankDbData;
const Icon = paymentMethodIcons[paymentMethod];
const addressIsUrl = isUrl(paymentMethodValue, {
require_protocol: true,
require_valid_protocol: true,
protocols: ['http', 'https'],
allow_protocol_relative_urls: false,
});
return (
<Modal isOpen={isOpen} onClose={onClose}>
<ModalOverlay />
<ModalContent mx={6}>
<ModalHeader
textAlign="center"
mt={3}
mx="auto"
>
{name}
{"'s "}
{paymentMethodDisplayName}
{' address'}
</ModalHeader>
<ModalCloseButton />
<ModalBody
pt={0}
mb={3}
mx="auto"
>
<Flex justify="center" align="center">
<Icon
mr={2}
boxSize="48px"
/>
<Text
wordBreak="break-all"
textAlign="center"
>
{paymentMethodValue}
</Text>
</Flex>
<Flex
my={2}
align="center"
justify="center"
>
{addressIsUrl ? (
<Link href={paymentMethodValue} isExternal>
<Button
leftIcon={<ExternalLinkIcon />}
href={paymentMethodValue}
mr={2}
>
Open
</Button>
</Link>
) : (
<Button
leftIcon={hasCopied ? <CheckIcon /> : <CopyIcon />}
onClick={onCopy}
>
{hasCopied ? "Copied" : "Copy"}
</Button>
)}
</Flex>
<Text mb={2} textAlign="center">or scan QR Code:</Text>
<Flex justify="center">
<QRCode
id="payment-method-qr-code"
value={paymentMethodValue}
size={225}
/>
</Flex>
</ModalBody>
</ModalContent>
</Modal>
);
}
Example #8
Source File: repositories-list-item.tsx From notebook with MIT License | 4 votes |
RepositoriesListItem: React.SFC<RepositoriesListItemProps> = ({
repo
}) => {
const [repoId, setRepoId] = React.useState<number>(0);
const bg = useColorModeValue("white", "#2f3244");
const textColor = useColorModeValue("gray.600", "#b5b1b1");
const { isOpen, onOpen, onClose } = useDisclosure();
const handleClick = (id: number) => {
setRepoId(id);
onOpen();
};
return (
<>
<Center>
<Box
maxW="sm"
height="fit-content"
borderWidth="1px"
borderRadius="lg"
overflow="hidden"
boxShadow="md"
mx="5px"
mb="10px"
mt="10px"
_hover={{ boxShadow: "lg" }}
>
{/* <Image
height={{ base: "28vh", lg: "32vh" }}
cursor={repo.coverImage ? "pointer" : "auto"}
width={"100%"}
src={repo.coverImage}
objectFit="cover"
alt="cover image"
fallbackSrc="https://via.placeholder.com/320x216/DCDFDF/ffffff/?text=CoverImage"
fallbackSrc={placeholder}
onClick={() => handleClick(repo.coverImage)}
/> */}
<LazyImage
id={repo.id}
src={repo.coverImage}
blurHash={repo.blurHash}
handleClick={handleClick}
/>
<Box p="5" bg={bg}>
<Flex justifyContent="space-between" alignItems="center">
<Box
mt="1"
fontWeight="semibold"
as="h6"
fontSize="md"
lineHeight="tight"
textAlign="left"
isTruncated
>
<Link
href={repo.liveLink || repo.githubLink}
textDecoration={"none !important"}
isExternal
>
{repo.title}
<ExternalLinkIcon mx="3px" />
</Link>
</Box>
<Box mt="1">
{repo.stars ? (
<Link
href={repo.githubLink}
textDecoration={"none !important"}
isExternal
>
<Tooltip hasArrow label="Github stars" placement="top-end">
<Box>
<StarIcon color="teal.300" fontSize="sm" />
<Box as="span" ml="2" color={textColor} fontSize="sm">
{repo.stars}
</Box>
</Box>
</Tooltip>
</Link>
) : (
""
)}
</Box>
</Flex>
<Box textAlign="left">
<HStack spacing="1" mt="2" mb="2">
{repo.technologies.map((tech, index) => (
<Badge
borderRadius="full"
px="1"
colorScheme={tech.color}
textTransform="lowercase"
key={index}
>
{tech.name}
</Badge>
))}
</HStack>
</Box>
<Box color={textColor} fontSize="md" textAlign="left">
{repo.desc}
</Box>
</Box>
</Box>
</Center>
<Carousel
repoId={repoId}
onOpen={onOpen}
onClose={onClose}
isOpen={isOpen}
/>
</>
);
}
Example #9
Source File: AccountModal.tsx From eth-dapps-nextjs-boiletplate with MIT License | 4 votes |
export default function AccountModal({ isOpen, onClose }: Props) {
const { globalState, dispatch } = useContext(globalContext)
const { account, provider } = globalState
const chainIdPaths = {
1: '', // mainnet
42: 'kovan.',
3: 'ropsten.',
4: 'rinkeby.',
5: 'goerli.',
}
const chainPath = provider && chainIdPaths[parseInt(provider.chainId)]
async function handleDeactivateAccount() {
//deactivate();
if (provider && !provider.isMetaMask) { // isWalletConnect then
await provider.disconnect()
}
dispatch({ type: 'CLEAR_STATE'})
onClose();
}
return (
<Modal isOpen={isOpen} onClose={onClose} isCentered size="md">
<ModalOverlay />
<ModalContent
background="gray.900"
border="1px"
borderStyle="solid"
borderColor="gray.700"
borderRadius="3xl"
>
<ModalHeader color="white" px={4} fontSize="lg" fontWeight="medium">
Account
</ModalHeader>
<ModalCloseButton
color="white"
fontSize="sm"
_hover={{
color: "whiteAlpha.700",
}}
/>
<ModalBody pt={0} px={4}>
<Box
borderRadius="3xl"
border="1px"
borderStyle="solid"
borderColor="gray.600"
px={5}
pt={4}
pb={2}
mb={3}
>
<Flex justifyContent="space-between" alignItems="center" mb={3}>
<Text color="gray.400" fontSize="sm">
Connected with {provider?.isMetaMask ? 'MetaMask' : 'WalletConnect'}
</Text>
<Button
variant="outline"
size="sm"
borderColor="blue.800"
borderRadius="3xl"
color="blue.500"
fontSize="13px"
fontWeight="normal"
px={2}
height="26px"
_hover={{
background: "none",
borderColor: "blue.300",
textDecoration: "underline",
}}
onClick={handleDeactivateAccount}
>
Disconnect
</Button>
</Flex>
<Flex alignItems="center" mt={2} mb={4} lineHeight={1}>
<Identicon />
<Text
color="white"
fontSize="xl"
fontWeight="semibold"
ml="2"
lineHeight="1.1"
>
{account &&
`${account.slice(0, 6)}...${account.slice(
account.length - 4,
account.length
)}`}
</Text>
</Flex>
<Flex alignContent="center" m={3}>
<Button
variant="link"
color="gray.400"
fontWeight="normal"
fontSize="sm"
_hover={{
textDecoration: "none",
color: "whiteAlpha.800",
}}
>
<CopyIcon mr={1} />
Copy Address
</Button>
{
chainPath?
<Link
fontSize="sm"
display="flex"
alignItems="center"
href={`https://${chainPath}etherscan.io/address/${account}`}
isExternal
color="gray.400"
ml={6}
_hover={{
color: "whiteAlpha.800",
textDecoration: "underline",
}}
>
<ExternalLinkIcon mr={1} />
View on Explorer
</Link>:''
}
</Flex>
</Box>
</ModalBody>
<ModalFooter
justifyContent="end"
background="gray.700"
borderBottomLeftRadius="3xl"
borderBottomRightRadius="3xl"
p={6}
>
<Text
color="white"
textAlign="left"
fontWeight="medium"
fontSize="md"
>
Your transactions will appear here...
</Text>
</ModalFooter>
</ModalContent>
</Modal>
);
}