Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
fix(lsg): correct use of onDragStart event
Browse files Browse the repository at this point in the history
  • Loading branch information
Lasse Küchler committed Dec 14, 2017
1 parent 526318c commit eeb88ca
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
3 changes: 2 additions & 1 deletion src/component/container/pattern_list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class PatternList extends React.Component<PatternListProps> {
return (
<div>
<Space sizeBottom={Size.L}>
<Input handleChange={this.handleSearchInputChange} placeholder="Search"/>
<Input handleChange={this.handleSearchInputChange} placeholder="Search" />
</Space>
<Space sizeBottom={Size.L}>
<List>{list}</List>
Expand Down Expand Up @@ -122,6 +122,7 @@ export class PatternList extends React.Component<PatternListProps> {
}
@action
protected handleDragStart(e: React.DragEvent<HTMLElement>, pattern: Pattern): void {
console.log('asdf');
const data = pattern.getRelativePath();
e.dataTransfer.setData('patternPath', data);
}
Expand Down
24 changes: 13 additions & 11 deletions src/lsg/patterns/pattern-list-item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,18 @@ const StyledIcon = styled(Icon)`
margin-right: ${getSpace(Size.L)}px;
`;

const PatternListItem: React.StatelessComponent<PatternListItemProps> = props => (
<StyledPatternListItem {...props}>
{props.icon
? <StyledSVG>
{props.icon}
</StyledSVG>
: <StyledIcon name={IconName.Robo} size={IconSize.XS} color={colors.grey70} />
}
{props.children}
</StyledPatternListItem>
);
const PatternListItem: React.StatelessComponent<PatternListItemProps> = props => {
const { handleDragStart, ...other } = props;
return (
<StyledPatternListItem {...other} onDragStart={handleDragStart}>
{props.icon ? (
<StyledSVG>{props.icon}</StyledSVG>
) : (
<StyledIcon name={IconName.Robo} size={IconSize.XS} color={colors.grey70} />
)}
{props.children}
</StyledPatternListItem>
);
};

export default PatternListItem;

0 comments on commit eeb88ca

Please sign in to comment.