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

Commit

Permalink
fix: disable doubleClick for chrome elements
Browse files Browse the repository at this point in the history
  • Loading branch information
barinali authored and marionebl committed Aug 21, 2018
1 parent 581d096 commit 66c97cb
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/components/bug-report/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import styled from 'styled-components';

export interface BugReportProps {
onClick?: React.MouseEventHandler<HTMLElement>;
onDoubleClick?: React.MouseEventHandler<HTMLElement>;
title: string;
}

Expand All @@ -14,7 +15,12 @@ const StyledBugReport = styled.div`

export const BugReport: React.StatelessComponent<BugReportProps> = props => (
<StyledBugReport>
<Button order={ButtonOrder.Secondary} size={ButtonSize.Small} onClick={props.onClick}>
<Button
order={ButtonOrder.Secondary}
size={ButtonSize.Small}
onClick={props.onClick}
onDoubleClick={props.onDoubleClick}
>
{props.title}
</Button>
</StyledBugReport>
Expand Down
2 changes: 2 additions & 0 deletions src/components/button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface ButtonProps {
/** @description For dark backgrounds */
inverted?: boolean;
onClick?: React.MouseEventHandler<HTMLElement>;
onDoubleClick?: React.MouseEventHandler<HTMLElement>;
/** @description Visual weight @default Primary */
order?: ButtonOrder;
/** @description Spatial weight @default */
Expand Down Expand Up @@ -106,6 +107,7 @@ const StyledButton = styled.button`
export const Button: React.StatelessComponent<ButtonProps> = props => (
<StyledButton
onClick={props.onClick}
onDoubleClick={props.onDoubleClick}
textColor={props.textColor}
order={props.order}
size={props.size}
Expand Down
3 changes: 2 additions & 1 deletion src/components/layout-switch/layout-switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface LayoutSwitchProps {
active?: boolean;
onPrimaryClick?: React.MouseEventHandler<HTMLElement>;
onSecondaryClick?: React.MouseEventHandler<HTMLElement>;
onDoubleClick?: React.MouseEventHandler<HTMLElement>;
children?: React.ReactNode;
}

Expand Down Expand Up @@ -60,7 +61,7 @@ const StyledSecondaryContainer = styled.label`
`;

export const LayoutSwitch: React.SFC<LayoutSwitchProps> = props => (
<StyledLayoutSwitch>
<StyledLayoutSwitch onDoubleClick={props.onDoubleClick}>
<StyledPrimaryContainer onClick={props.onPrimaryClick} active={props.active}>
<Layout size={IconSize.XS} strokeWidth={1.5} />
</StyledPrimaryContainer>
Expand Down
6 changes: 6 additions & 0 deletions src/components/view-switch/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,19 @@ export const ViewSwitch: React.SFC<ViewSwitchProps> = (props): JSX.Element => (
<StyledLeftIcon
color={Color.Grey60}
onClick={props.onLeftClick}
onDoubleClick={event => {
event.stopPropagation();
}}
size={IconSize.XS}
visible={props.leftVisible}
/>
{props.children}
<StyledRightIcon
color={Color.Grey60}
onClick={props.onRightClick}
onDoubleClick={event => {
event.stopPropagation();
}}
size={IconSize.XS}
visible={props.rightVisible}
/>
Expand Down
3 changes: 3 additions & 0 deletions src/container/chrome/chrome-container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ export const ChromeContainer = MobxReact.inject('store')(
payload: 'https://github.com/meetalva/alva/labels/type%3A%20bug'
});
}}
onDoubleClick={event => {
event.stopPropagation();
}}
/>
{props.children}
</Chrome>
Expand Down
3 changes: 3 additions & 0 deletions src/container/chrome/chrome-switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ export class ChromeSwitch extends React.Component {
onSecondaryClick={() => {
layoutMenu(store);
}}
onDoubleClick={event => {
event.stopPropagation();
}}
/>
</div>
);
Expand Down

0 comments on commit 66c97cb

Please sign in to comment.