From 3401aa57cd99e22ce19291b3d5072bc1ef822aeb Mon Sep 17 00:00:00 2001 From: Andrei Zhaleznichenka Date: Mon, 6 Jan 2025 18:22:14 +0100 Subject: [PATCH] fix: Fixes borders, dark mode highlight, and actions padding style issues (#57) * fix: Fixes borders, dark mode highlight, and actions padding style issues * removes debugging code * re-add background color to line numbers --- pages/code-view/simple.page.tsx | 13 +++++++++---- src/code-view/internal.tsx | 6 +++--- src/code-view/styles.scss | 33 ++++++++++++++++++--------------- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/pages/code-view/simple.page.tsx b/pages/code-view/simple.page.tsx index 0d3d00e..749b91e 100644 --- a/pages/code-view/simple.page.tsx +++ b/pages/code-view/simple.page.tsx @@ -1,16 +1,21 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +import { SpaceBetween } from "@cloudscape-design/components"; + import { CodeView } from "../../lib/components"; import { ScreenshotArea } from "../screenshot-area"; + export default function CodeViewPage() { return (

Code View

- - + + + +
); } diff --git a/src/code-view/internal.tsx b/src/code-view/internal.tsx index 34507ce..b434c51 100644 --- a/src/code-view/internal.tsx +++ b/src/code-view/internal.tsx @@ -43,8 +43,8 @@ export function InternalCodeView({ ...props }: InternalCodeViewProps) { const baseProps = getBaseProps(props); - const preRef = useRef(null); - const darkMode = useCurrentMode(preRef) === "dark"; + const containerRef = useRef(null); + const darkMode = useCurrentMode(containerRef) === "dark"; const regionProps = ariaLabel || ariaLabelledby ? { role: "region" } : {}; @@ -64,7 +64,7 @@ export function InternalCodeView({ dir="ltr" ref={__internalRootRef} > -
+