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

Commit

Permalink
feat: add bug report button to chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
tilmx authored and lkuechler committed Jun 6, 2018
1 parent 245054c commit e2eac1b
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 7 deletions.
11 changes: 11 additions & 0 deletions src/components/bug-report/demo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import DemoContainer from '../demo-container';
import { BugReport } from './index';
import * as React from 'react';

const BugReportDemo: React.StatelessComponent<void> = (): JSX.Element => (
<DemoContainer title="BugReport">
<BugReport title="Found a bug?" />
</DemoContainer>
);

export default BugReportDemo;
22 changes: 22 additions & 0 deletions src/components/bug-report/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Button, ButtonOrder, ButtonSize } from '../button';
import * as React from 'react';
import { getSpace, SpaceSize } from '../space';
import styled from 'styled-components';

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

const StyledBugReport = styled.div`
justify-self: right;
margin-right: -${getSpace(SpaceSize.XXL) * 3 - getSpace(SpaceSize.L)}px; // align to top right corner
`;

export const BugReport: React.StatelessComponent<BugReportProps> = props => (
<StyledBugReport>
<Button order={ButtonOrder.Secondary} size={ButtonSize.Small} onClick={props.onClick}>
{props.title}
</Button>
</StyledBugReport>
);
8 changes: 8 additions & 0 deletions src/components/bug-report/pattern.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "bug-report",
"displayName": "Bug Report",
"description": "Button to report a bug as Github Issue",
"version": "1.0.0",
"tags": ["bug", "bug-report"],
"flag": "alpha"
}
12 changes: 6 additions & 6 deletions src/components/button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,21 @@ export enum ButtonSize {
const StyledButton = styled.button`
border: none;
border-radius: 3px;
&:hover {
opacity: 0.9;
}
outline: none;
${(props: ButtonProps) => {
switch (props.order) {
case ButtonOrder.Secondary:
return css`
background: ${Color.Black};
color: ${Color.White};
background: transparent;
border: 1px solid ${Color.Blue};
color: ${Color.Blue};
`;
case ButtonOrder.Primary:
default:
return css`
background: ${Color.Blue};
border: 1px solid ${Color.Blue};
color: ${Color.White};
`;
}
Expand All @@ -70,6 +69,7 @@ const StyledButton = styled.button`
props.inverted
? `
background: ${Color.White};
border-color: ${Color.White};
`
: ''};
${(props: ButtonProps) =>
Expand Down
1 change: 1 addition & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './bug-report';
export * from './button';
export * from './chrome';
export * from './colors';
Expand Down
11 changes: 10 additions & 1 deletion src/container/chrome/chrome-container.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as AlvaUtil from '../../alva-util';
import { Chrome, CopySize, ViewSwitch, ViewTitle } from '../../components';
import { BugReport, Chrome, CopySize, ViewSwitch, ViewTitle } from '../../components';
import * as Electron from 'electron';
import * as MobxReact from 'mobx-react';
import { OverviewSwitchContainer } from './overview-switch-container';
import * as React from 'react';
Expand Down Expand Up @@ -70,6 +71,14 @@ export const ChromeContainer = MobxReact.inject('store')(
title={project ? project.getName() : 'Alva'}
/>
)}
<BugReport
title="Found a bug?"
onClick={() => {
Electron.shell.openExternal(
'https://github.com/meetalva/alva/labels/type%3A%20bug'
);
}}
/>
{props.children}
</Chrome>
);
Expand Down

0 comments on commit e2eac1b

Please sign in to comment.