Skip to content

Commit

Permalink
Merge pull request #1045 from bcgov/feature/ns-to-gw-new-provider
Browse files Browse the repository at this point in the history
NS to GW: No gateways page for new API provider
  • Loading branch information
ikethecoder committed Jun 13, 2024
2 parents 7612f5e + 4092080 commit 899ca04
Show file tree
Hide file tree
Showing 12 changed files with 522 additions and 17 deletions.
70 changes: 70 additions & 0 deletions src/nextapp/components/cli-command/cli-command.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import * as React from 'react';
import {
Box,
Heading,
IconButton,
Text,
Tooltip,
useToast,
} from '@chakra-ui/react';
import { IoCopy } from 'react-icons/io5';

interface CliCommandProps {
id?: string;
title: string;
description: React.ReactNode;
command: string;
}

const CliCommand: React.FC<CliCommandProps> = ({ id, title, description, command }) => {
const toast = useToast();
const handleClipboard = React.useCallback(
(text: string) => async () => {
await navigator.clipboard.writeText(text);
toast({
title: 'Copied to clipboard!',
status: 'success',
});
},
[toast]
);

return (
<Box id={id}
border="1px solid"
borderColor="bc-outline"
p={10}
borderRadius={6}
w="100%"
mb={4}
>
<Heading size="sm">{title}</Heading>
<Text pb={4}>{description}</Text>
<Box
border="1px solid"
borderColor="bc-outline"
backgroundColor="#FAFAFA"
p={10}
borderRadius={6}
w="100%"
mb={4}
display="flex"
alignItems="center"
justifyContent="space-between"
>
<Text fontFamily="mono" fontSize="sm">$ {command}</Text>
<Tooltip label="Copy to clipboard" aria-label="Copy to clipboard tooltip">
<IconButton
aria-label="Copy to clipboard"
variant="ghost"
icon={<IoCopy />}
fontSize='20px'
onClick={handleClipboard(command)}
/>
</Tooltip>
</Box>
</Box>
);
};

export default CliCommand;
1 change: 1 addition & 0 deletions src/nextapp/components/cli-command/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './cli-command';
Loading

0 comments on commit 899ca04

Please sign in to comment.