mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-15 09:04:04 +02:00
25 lines
679 B
TypeScript
25 lines
679 B
TypeScript
|
import * as React from 'react';
|
||
|
import { MouseEventHandler } from 'react';
|
||
|
import ExpandIcon from './ExpandIcon';
|
||
|
import EmptyExpandLink from './EmptyExpandLink';
|
||
|
|
||
|
interface ExpandLinkProps {
|
||
|
folderId: string;
|
||
|
folderTitle: string;
|
||
|
hasChildren: boolean;
|
||
|
isExpanded: boolean;
|
||
|
onClick: MouseEventHandler<HTMLElement>;
|
||
|
}
|
||
|
|
||
|
const ExpandLink: React.FC<ExpandLinkProps> = props => {
|
||
|
return props.hasChildren ? (
|
||
|
<a className='sidebar-expand-link' href="#" data-folder-id={props.folderId} onClick={props.onClick}>
|
||
|
<ExpandIcon isVisible={true} isExpanded={props.isExpanded} targetTitle={props.folderTitle}/>
|
||
|
</a>
|
||
|
) : (
|
||
|
<EmptyExpandLink/>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export default ExpandLink;
|