11import React from 'react' ;
2- import { IconButton } from '@carbon/react' ;
2+ import { Button } from '@carbon/react' ;
33import { SplitScreen , VerticalView } from '@carbon/icons-react' ;
44import { TOGGLE_POSITIONS } from './constants' ;
55
66/**
77 * Layout toggle button for switching between horizontal and vertical layouts
8- *
8+ *
99 * @param {Object } props
1010 * @param {'horizontal'|'vertical' } props.direction - Current layout direction
1111 * @param {Function } props.onToggle - Callback when toggle is clicked
1212 * @param {string } [props.position='top-right'] - Position styling
1313 * @param {boolean } [props.disabled=false] - Whether toggle is disabled
1414 * @param {Object } [props.style={}] - Additional styles
1515 */
16- export default function ToolLayoutToggle ( {
17- direction,
18- onToggle,
16+ export default function ToolLayoutToggle ( {
17+ direction,
18+ onToggle,
1919 position = 'top-right' ,
2020 disabled = false ,
2121 style = { }
2222} ) {
2323 const isHorizontal = direction === 'horizontal' ;
24-
24+
2525 // Position styling based on position prop
2626 const positionStyles = {
2727 'top-right' : {
@@ -43,25 +43,24 @@ export default function ToolLayoutToggle({
4343 boxShadow : '0 2px 4px rgba(0, 0, 0, 0.1)'
4444 }
4545 } ;
46-
46+
4747 const containerStyle = {
4848 ...positionStyles [ position ] || positionStyles [ 'top-right' ] ,
4949 ...style
5050 } ;
51-
51+
5252 return (
5353 < div style = { containerStyle } >
54- < IconButton
54+ < Button
5555 kind = "ghost"
5656 size = "sm"
57- label = { isHorizontal ? "Switch to vertical layout" : "Switch to horizontal layout" }
57+ renderIcon = { isHorizontal ? VerticalView : SplitScreen }
5858 iconDescription = { isHorizontal ? "Vertical layout" : "Horizontal layout" }
59- align = "bottom"
59+ hasIconOnly
6060 disabled = { disabled }
6161 onClick = { onToggle }
62- >
63- { isHorizontal ? < VerticalView size = { 16 } /> : < SplitScreen size = { 16 } /> }
64- </ IconButton >
62+ title = { isHorizontal ? "Switch to vertical layout" : "Switch to horizontal layout" }
63+ />
6564 </ div >
6665 ) ;
6766}
0 commit comments