Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions tavern/internal/www/build/asset-manifest.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tavern/internal/www/build/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions tavern/internal/www/build/static/css/main.0a8172a1.css

This file was deleted.

1 change: 0 additions & 1 deletion tavern/internal/www/build/static/css/main.0a8172a1.css.map

This file was deleted.

4 changes: 4 additions & 0 deletions tavern/internal/www/build/static/css/main.7b4d635a.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tavern/internal/www/build/static/css/main.7b4d635a.css.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions tavern/internal/www/src/components/tavern-base-ui/CodeBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ type CodeBlockProps = {
language?: CodeBlockLanguageSupport;
showCopyButton?: boolean;
inlineButton?: boolean;
copyButtonPosition?: "left" | "right";
copyButtonSize?: "xs" | "sm" | "md" | "lg" | "xl";
};

const CodeBlock = ({ code, language = 'markdown', showCopyButton = false, inlineButton= false }: CodeBlockProps) => {
const CodeBlock = ({ code, language = 'markdown', showCopyButton = false, inlineButton = false, copyButtonPosition = 'right', copyButtonSize = 'xs' }: CodeBlockProps) => {
const [copied, setCopied] = useState(false);

const handleCopy = async () => {
Expand All @@ -80,8 +82,8 @@ const CodeBlock = ({ code, language = 'markdown', showCopyButton = false, inline
<Button
onClick={handleCopy}
buttonVariant="ghost"
buttonStyle={{ color: "gray", size: "xs" }}
className="absolute top-2 right-2"
buttonStyle={{ color: "gray", size: copyButtonSize }}
className={`absolute top-2 ${copyButtonPosition === 'left' ? 'left-2' : 'right-2'}`}
aria-label={copied ? "Copied" : "Copy code"}
leftIcon={copied
? <ClipboardDocumentCheckIcon className="w-4 h-4 text-green-600" />
Expand All @@ -97,8 +99,10 @@ const CodeBlock = ({ code, language = 'markdown', showCopyButton = false, inline
...style,
margin: 0,
padding: "0.75rem",
paddingRight: !inlineButton && showCopyButton ? "3rem" : "0.75rem",
marginRight: showCopyButton ? "2rem" : "0rem",
paddingLeft: !inlineButton && showCopyButton && copyButtonPosition === 'left' ? "3rem" : "0.75rem",
paddingRight: !inlineButton && showCopyButton && copyButtonPosition === 'right' ? "3rem" : "0.75rem",
marginLeft: showCopyButton && copyButtonPosition === 'left' ? "2rem" : "0rem",
marginRight: showCopyButton && copyButtonPosition === 'right' ? "2rem" : "0rem",
borderRadius: "0.375rem",
fontSize: "0.8rem",
overflowX: "auto",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ const StepAddDeploymentKey: FC<StepAddDeploymentKeyProps> = ({ setCurrStep, newR
)}
<div className="flex flex-col gap-2">
<Heading size="sm">Copy public key</Heading>
<CodeBlock code={newRepository?.publicKey || ""} showCopyButton />
<CodeBlock
code={newRepository?.publicKey || ""}
showCopyButton
copyButtonPosition="left"
copyButtonSize="sm"
/>
</div>
<div className="flex flex-row gap-2">
<Button
Expand Down
Loading