71 lines
1.6 KiB
JavaScript
Raw Normal View History

2018-07-06 18:56:28 -04:00
import React from 'react';
import styled from 'react-emotion';
import Icon from './Icon';
2018-07-24 17:13:48 -04:00
import { colors, lengths, buttons } from './styles';
const TopBar = styled.div`
display: flex;
justify-content: space-between;
height: 26px;
border-radius: ${lengths.borderRadius} ${lengths.borderRadius} 0 0;
position: relative;
`
2018-07-06 18:56:28 -04:00
const TopBarButton = styled.button`
2018-07-24 17:13:48 -04:00
${buttons.button};
2018-07-06 18:56:28 -04:00
color: ${colors.controlLabel};
background: transparent;
font-size: 16px;
line-height: 1;
padding: 0;
width: 32px;
text-align: center;
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
`
const TopBarButtonSpan = TopBarButton.withComponent('span');
const DragIcon = styled(TopBarButtonSpan)`
width: 100%;
cursor: move;
`
2018-07-24 17:13:48 -04:00
const ListItemTopBar = ({ className, collapsed, onCollapseToggle, onRemove, dragHandleHOC }) => (
<TopBar className={className}>
2018-07-06 18:56:28 -04:00
{
onCollapseToggle
? <TopBarButton onClick={onCollapseToggle}>
<Icon type="chevron" size="small" direction={collapsed ? 'right' : 'down'}/>
</TopBarButton>
: null
}
{
dragHandleHOC
? <DragIcon>
<Icon type="drag-handle" size="small"/>
</DragIcon>
: null
}
{
onRemove
? <TopBarButton onClick={onRemove}>
<Icon type="close" size="small"/>
</TopBarButton>
: null
}
2018-07-24 17:13:48 -04:00
</TopBar>
2018-07-06 18:56:28 -04:00
);
const StyledListItemTopBar = styled(ListItemTopBar)`
display: flex;
justify-content: space-between;
height: 26px;
border-radius: ${lengths.borderRadius} ${lengths.borderRadius} 0 0;
position: relative;
`
export default StyledListItemTopBar;