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

Commit

Permalink
feat(lsg): handleClick for element pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
Lasse Küchler committed Dec 11, 2017
1 parent 1778f79 commit 706a296
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/lsg/patterns/element/demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ const ElementDemo: React.StatelessComponent<void> = (): JSX.Element => (
<StyledTestDiv>
With Child and handleIconClick
<Element
handleClick={e => {
console.log('Clicked', e);
e.stopPropagation();
}}
handleIconClick={() => {
console.log('Clicked');
console.log('Icon Clicked');
}}
title="Element"
>
Expand Down
5 changes: 3 additions & 2 deletions src/lsg/patterns/element/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface ElementProps {
open?: boolean;
title: string;

handleClick?: React.MouseEventHandler<HTMLElement>;
handleIconClick?: React.MouseEventHandler<SVGSVGElement>;
}

Expand Down Expand Up @@ -52,10 +53,10 @@ const StyledIcon = styled(Icon)`
`;

const Element: React.StatelessComponent<ElementProps> = props => {
const { children, title, active, open, handleIconClick } = props;
const { children, title, active, open, handleClick, handleIconClick } = props;

return (
<StyledElement title={title} active={active}>
<StyledElement onClick={handleClick} title={title} active={active}>
<StyledElementLabel>
{children && (
<StyledIcon
Expand Down

0 comments on commit 706a296

Please sign in to comment.