openreplay/frontend/app/components/Session/EventsToggleButton/EventsToggleButton.tsx
Shekar Siri 2ed5cac986
Webpack upgrade and dependency cleanup (#523)
* change(ui) - webpack update
* change(ui) - api optimize and other fixes
2022-06-03 16:47:38 +02:00

35 lines
866 B
TypeScript

import React from 'react'
import { Icon, Popup } from 'UI'
import { connectPlayer, toggleEvents, scale } from 'Player';
import cn from 'classnames'
import stl from './EventsToggleButton.module.css'
function EventsToggleButton({ showEvents, toggleEvents }: any) {
const toggle = () => {
toggleEvents()
scale()
}
return (
<Popup
content={ showEvents ? 'Hide Events' : 'Show Events' }
size="tiny"
inverted
position="bottom right"
>
<button
className={cn("absolute right-0 z-50", stl.wrapper)}
onClick={toggle}
>
<Icon
name={ showEvents ? 'chevron-double-right' : 'chevron-double-left' }
size="12"
/>
</button>
</Popup>
)
}
export default connectPlayer(state => ({
showEvents: !state.showEvents
}), { toggleEvents })(EventsToggleButton)