From 3d58627f303784e0bf6a2e507dbd1c89c39bb0d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aneta=20Jastrz=C4=99bska?= <1544710+anetaj@users.noreply.github.com> Date: Sat, 21 Sep 2024 15:39:06 +0200 Subject: [PATCH] style included code tag + toolbar --- .../src/sidebar/MarkdownRender/BlockCode.tsx | 53 +++++++++++-------- extensions/void/src/sidebar/Sidebar.tsx | 34 +++++++----- .../void/src/sidebar/components/Files.tsx | 2 +- 3 files changed, 55 insertions(+), 34 deletions(-) diff --git a/extensions/void/src/sidebar/MarkdownRender/BlockCode.tsx b/extensions/void/src/sidebar/MarkdownRender/BlockCode.tsx index 37d5b5bd..1ce07d80 100644 --- a/extensions/void/src/sidebar/MarkdownRender/BlockCode.tsx +++ b/extensions/void/src/sidebar/MarkdownRender/BlockCode.tsx @@ -1,5 +1,6 @@ -import React, { useCallback, useEffect, useState } from "react" +import React, { ReactNode, useCallback, useEffect, useState } from "react" import { getVSCodeAPI } from "../getVscodeApi" +import { classNames } from "../utils" enum CopyButtonState { Copy = "Copy", @@ -12,10 +13,14 @@ const COPY_FEEDBACK_TIMEOUT = 1000 // code block with Apply button at top const BlockCode = ({ text, + toolbar, hideToolbar = false, + className, }: { text: string + toolbar?: ReactNode hideToolbar?: boolean + className?: string }) => { const [copyButtonState, setCopyButtonState] = useState(CopyButtonState.Copy) @@ -38,34 +43,40 @@ const BlockCode = ({ ) }, [text]) + const defaultToolbar = ( + <> + + + + ) + return (
{!hideToolbar && (
-
- - -
+
{toolbar || defaultToolbar}
)}
-
{text}
+
{text}
) diff --git a/extensions/void/src/sidebar/Sidebar.tsx b/extensions/void/src/sidebar/Sidebar.tsx index 1aefaf47..3af8540a 100644 --- a/extensions/void/src/sidebar/Sidebar.tsx +++ b/extensions/void/src/sidebar/Sidebar.tsx @@ -220,23 +220,33 @@ const Sidebar = () => {
{/* selection */} -
+ {(files.length || selection?.selectionStr) &&
{/* selected files */} {/* selected code */} - {!selection?.selectionStr ? null - : ( -
- - -
+ + + + + )} /> )} -
+
}
+
{files.map((filename, i) => (