Skip to content
Merged
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
1 change: 0 additions & 1 deletion frontend/src/components/ToolUI.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export function ToolControls({ children, style = {} }) {
return (
<div className="controls" style={{
display: 'flex',
alignItems: 'flex-end',
gap: '1rem',
flexWrap: 'wrap',
marginBottom: '1rem',
Expand Down
27 changes: 13 additions & 14 deletions frontend/src/components/layout/ToolLayoutToggle.jsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import React from 'react';
import { IconButton } from '@carbon/react';
import { Button } from '@carbon/react';
import { SplitScreen, VerticalView } from '@carbon/icons-react';
import { TOGGLE_POSITIONS } from './constants';

/**
* Layout toggle button for switching between horizontal and vertical layouts
*
*
* @param {Object} props
* @param {'horizontal'|'vertical'} props.direction - Current layout direction
* @param {Function} props.onToggle - Callback when toggle is clicked
* @param {string} [props.position='top-right'] - Position styling
* @param {boolean} [props.disabled=false] - Whether toggle is disabled
* @param {Object} [props.style={}] - Additional styles
*/
export default function ToolLayoutToggle({
direction,
onToggle,
export default function ToolLayoutToggle({
direction,
onToggle,
position = 'top-right',
disabled = false,
style = {}
}) {
const isHorizontal = direction === 'horizontal';

// Position styling based on position prop
const positionStyles = {
'top-right': {
Expand All @@ -43,25 +43,24 @@ export default function ToolLayoutToggle({
boxShadow: '0 2px 4px rgba(0, 0, 0, 0.1)'
}
};

const containerStyle = {
...positionStyles[position] || positionStyles['top-right'],
...style
};

return (
<div style={containerStyle}>
<IconButton
<Button
kind="ghost"
size="sm"
label={isHorizontal ? "Switch to vertical layout" : "Switch to horizontal layout"}
renderIcon={isHorizontal ? VerticalView : SplitScreen}
iconDescription={isHorizontal ? "Vertical layout" : "Horizontal layout"}
align="bottom"
hasIconOnly
disabled={disabled}
onClick={onToggle}
>
{isHorizontal ? <VerticalView size={16} /> : <SplitScreen size={16} />}
</IconButton>
title={isHorizontal ? "Switch to vertical layout" : "Switch to horizontal layout"}
/>
</div>
);
}
Loading
Loading