1- import { ChevronDown , ChevronRight } from 'lucide-react' ;
1+ import { ChevronDown , ChevronLeft , ChevronRight } from 'lucide-react' ;
22import { ReactNode , memo , useState } from 'react' ;
33import { Flexbox } from 'react-layout-kit' ;
44
55import ActionIcon from '@/ActionIcon' ;
66import CopyButton from '@/CopyButton' ;
7+ import { useDirection } from '@/hooks/useDirection' ;
78
89import { useStyles } from './style' ;
910import { MermaidProps } from './type' ;
@@ -13,6 +14,7 @@ export const MermaidFullFeatured = memo<
1314> ( ( { showLanguage, content, children, className, copyable, actionsRender, style, ...rest } ) => {
1415 const [ expand , setExpand ] = useState ( true ) ;
1516 const { styles, cx } = useStyles ( 'block' ) ;
17+ const direction = useDirection ( ) ;
1618 const container = cx ( styles . container , className ) ;
1719
1820 const size = { blockSize : 24 , fontSize : 14 , strokeWidth : 2 } ;
@@ -27,7 +29,7 @@ export const MermaidFullFeatured = memo<
2729 < div className = { container } data-code-type = "mermaid" style = { style } { ...rest } >
2830 < Flexbox align = { 'center' } className = { styles . header } horizontal justify = { 'space-between' } >
2931 < ActionIcon
30- icon = { expand ? ChevronDown : ChevronRight }
32+ icon = { expand ? ChevronDown : direction === 'rtl' ? ChevronLeft : ChevronRight }
3133 onClick = { ( ) => setExpand ( ! expand ) }
3234 size = { { blockSize : 24 , fontSize : 14 , strokeWidth : 3 } }
3335 />
0 commit comments