mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
24 lines
653 B
TypeScript
24 lines
653 B
TypeScript
import { Icon } from 'components/Icon'
|
|
import * as React from 'react'
|
|
import { cx } from 'utils/cx'
|
|
|
|
type Props = {
|
|
error?: string
|
|
shouldShow: boolean
|
|
toggleShowSideBar: React.MouseEventHandler
|
|
}
|
|
|
|
export function ToggleShowButton({ error, shouldShow, toggleShowSideBar }: Props) {
|
|
return (
|
|
<div
|
|
className={cx('gitako-toggle-show-button-wrapper', {
|
|
collapsed: !shouldShow || error,
|
|
error,
|
|
})}
|
|
onClick={error ? undefined : toggleShowSideBar}
|
|
>
|
|
<Icon className={'action-icon'} type={shouldShow ? 'x' : 'octoface'} />
|
|
{error && <span className={'error-message'}>{error}</span>}
|
|
</div>
|
|
)
|
|
}
|