diff --git a/packages/react/src/modules/guide/components/Toolbar/V2/V2.tsx b/packages/react/src/modules/guide/components/Toolbar/V2/V2.tsx
index 096daaeab..2f97e0844 100644
--- a/packages/react/src/modules/guide/components/Toolbar/V2/V2.tsx
+++ b/packages/react/src/modules/guide/components/Toolbar/V2/V2.tsx
@@ -32,6 +32,22 @@ import {
const TOOLBAR_WIDTH = "540px";
+const Kbd = ({ children }: { children: React.ReactNode }) => {
+ return (
+
+ {children}
+
+ );
+};
+
type DisplayOption = "all-guides" | "only-eligible" | "only-displayable";
const GuidesList = ({
@@ -105,6 +121,33 @@ export const V2 = () => {
};
}, [runConfig, client, setDisplayOption]);
+ // Toggle collapsed state when Ctrl is pressed and released alone
+ // (without combining with another key), similar to Vercel's toolbar.
+ React.useEffect(() => {
+ let ctrlUsedInCombo = false;
+
+ const handleKeyDown = (e: KeyboardEvent) => {
+ if (e.key === "Control") {
+ ctrlUsedInCombo = false;
+ } else if (e.ctrlKey) {
+ ctrlUsedInCombo = true;
+ }
+ };
+
+ const handleKeyUp = (e: KeyboardEvent) => {
+ if (e.key === "Control" && !ctrlUsedInCombo) {
+ setIsCollapsed((prev) => !prev);
+ }
+ };
+
+ window.addEventListener("keydown", handleKeyDown);
+ window.addEventListener("keyup", handleKeyUp);
+ return () => {
+ window.removeEventListener("keydown", handleKeyDown);
+ window.removeEventListener("keyup", handleKeyUp);
+ };
+ }, []);
+
const containerRef = React.useRef(null);
const { position, isDragging, handlePointerDown, hasDraggedRef } =
useDraggable({
@@ -129,37 +172,48 @@ export const V2 = () => {
}}
>
{isCollapsed ? (
-
+ Guide Toolbar ctrl
+
+ }
>
-
- {
- if (!hasDraggedRef.current) {
- setIsCollapsed(false);
- }
+
-
-
+ >
+ {
+ if (!hasDraggedRef.current) {
+ setIsCollapsed(false);
+ }
+ }}
+ positioned={false}
+ />
+
+
+
) : (
{
style={{
width: TOOLBAR_WIDTH,
boxShadow: "0 8px 32px var(--tgph-gray-5)",
+ animation: "toolbar-expand-fade-in 150ms ease-out",
}}
>
{/* Header — also acts as drag handle area */}
diff --git a/packages/react/src/modules/guide/components/Toolbar/styles.css b/packages/react/src/modules/guide/components/Toolbar/styles.css
index 504afefe7..de3d2c23d 100644
--- a/packages/react/src/modules/guide/components/Toolbar/styles.css
+++ b/packages/react/src/modules/guide/components/Toolbar/styles.css
@@ -1,2 +1,24 @@
@telegraph tokens;
@telegraph components;
+
+/* Animation effect for toolbar V2 when expanding and collapsing. */
+@keyframes toolbar-collapse-fade-in {
+ from {
+ opacity: 0;
+ transform: scale(0.8);
+ }
+ to {
+ opacity: 1;
+ transform: scale(1);
+ }
+}
+@keyframes toolbar-expand-fade-in {
+ from {
+ opacity: 0;
+ transform: scale(0.95);
+ }
+ to {
+ opacity: 1;
+ transform: scale(1);
+ }
+}