Skip to content

Commit 1183330

Browse files
committed
Style new functionality
1 parent 0a0e806 commit 1183330

File tree

8 files changed

+104
-51
lines changed

8 files changed

+104
-51
lines changed

src/js/__tests__/components/__snapshots__/enterprise-login.js.snap

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,26 @@
22

33
exports[`components/enterprise-login.js renders correctly 1`] = `
44
<div
5-
className="container-fluid main-container settings"
5+
className="container-fluid main-container login"
66
>
7-
<a
8-
className="btn btn-lg btn-block enterprise"
9-
href="/login"
10-
onClick={[Function]}
7+
<div
8+
className="d-flex flex-row-reverse"
119
>
12-
<i
13-
className="fa fa-angle-left"
14-
/>
15-
Back
16-
</a>
10+
<a
11+
className="btn btn-close"
12+
href="/login"
13+
onClick={[Function]}
14+
>
15+
<i
16+
className="fa fa-close"
17+
/>
18+
</a>
19+
</div>
20+
<div
21+
className="desc"
22+
>
23+
Login to GitHub Enterprise.
24+
</div>
1725
<form
1826
onSubmit={[Function]}
1927
>
@@ -87,7 +95,7 @@ exports[`components/enterprise-login.js renders correctly 1`] = `
8795
</div>
8896
</div>
8997
<button
90-
className="btn btn-md"
98+
className="btn btn-md btn-login mt-2"
9199
type="submit"
92100
>
93101
<i

src/js/__tests__/components/__snapshots__/login.js.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@ exports[`components/login.js should render itself & its children 1`] = `
1616
in your menu bar.
1717
</div>
1818
<button
19-
className="btn btn-lg btn-block github"
19+
className="btn btn-block btn-login"
2020
onClick={[Function]}
2121
>
2222
<i
23-
className="fa fa-github"
23+
className="fa fa-github mr-2"
2424
/>
25-
Log in to GitHub
25+
Login to GitHub
2626
</button>
2727
<a
28-
className="btn btn-lg btn-block enterprise"
28+
className="btn btn-block btn-login mt-3"
2929
href="/enterpriselogin"
3030
onClick={[Function]}
3131
>
3232
<i
33-
className="fa fa-github"
33+
className="fa fa-github mr-2"
3434
/>
35-
Enterprise
35+
Login to GitHub Enterprise
3636
</a>
3737
</div>
3838
`;

src/js/__tests__/components/login.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ describe('components/login.js', () => {
107107

108108
expect(wrapper).toBeDefined();
109109

110-
wrapper.find('.github').simulate('click');
110+
wrapper.find('button').simulate('click');
111111

112112
expect(BrowserWindow().loadURL).toHaveBeenCalledTimes(1);
113113
expect(BrowserWindow().loadURL).toHaveBeenCalledWith(expectedUrl);
@@ -140,7 +140,7 @@ describe('components/login.js', () => {
140140

141141
expect(wrapper).toBeDefined();
142142

143-
wrapper.find('.github').simulate('click');
143+
wrapper.find('button').simulate('click');
144144

145145
expect(BrowserWindow().loadURL).toHaveBeenCalledTimes(1);
146146
expect(BrowserWindow().loadURL).toHaveBeenCalledWith(expectedUrl);
@@ -168,7 +168,7 @@ describe('components/login.js', () => {
168168

169169
expect(wrapper).toBeDefined();
170170

171-
wrapper.find('.github').simulate('click');
171+
wrapper.find('button').simulate('click');
172172

173173
expect(BrowserWindow().loadURL).toHaveBeenCalledTimes(1);
174174
expect(props.dispatch).not.toHaveBeenCalled();

src/js/__tests__/components/sidebar.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,11 @@ describe('components/Sidebar.js', () => {
6868
expect(wrapper).toBeDefined();
6969
expect(wrapper.find('.fa-refresh').length).toBe(1);
7070
expect(wrapper.find('.fa-cog').length).toBe(1);
71-
expect(wrapper.find('.badge-primary').first().text()).toBe(`GitHub ${notifications.size}`);
72-
expect(wrapper.find('.badge-primary').last().text()).toBe(`gitify ${notifications.size}`);
71+
72+
expect(wrapper.find('.badge-account').first().children().first().text()).toBe('GitHub');
73+
expect(wrapper.find('.badge-account').first().children().last().text()).toBe(`${notifications.size}`);
74+
expect(wrapper.find('.badge-account').last().children().first().text()).toBe('gitify');
75+
expect(wrapper.find('.badge-account').last().children().last().text()).toBe(`${notifications.size}`);
7376
});
7477

7578
it('should clear the interval when unmounting', () => {

src/js/components/enterprise-login.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ export class EnterpriseLogin extends React.Component {
5959

6060
render() {
6161
return (
62-
<div className="container-fluid main-container settings">
63-
<Link
64-
to="/login"
65-
className="btn btn-lg btn-block enterprise"
66-
replace
67-
>
68-
<i className="fa fa-angle-left" /> Back
69-
</Link>
62+
<div className="container-fluid main-container login">
63+
<div className="d-flex flex-row-reverse">
64+
<Link to="/login" className="btn btn-close" replace>
65+
<i className="fa fa-close" />
66+
</Link>
67+
</div>
68+
69+
<div className="desc">Login to GitHub Enterprise.</div>
7070

7171
<form onSubmit={this.props.handleSubmit(this.handleSubmit)}>
7272
<Field
@@ -87,7 +87,7 @@ export class EnterpriseLogin extends React.Component {
8787
label="Client Secret"
8888
placeholder="ABC123DEF456" />
8989

90-
<button className="btn btn-md" type="submit">
90+
<button className="btn btn-md btn-login mt-2" type="submit">
9191
<i className="fa fa-github" /> Login to GitHub Enterprise
9292
</button>
9393
</form>
@@ -104,10 +104,11 @@ export function mapStateToProps(state) {
104104

105105
export default connect(mapStateToProps, null)(reduxForm({
106106
form: 'loginEnterprise',
107-
initialValues: {
108-
hostname: 'github.example.com',
109-
clientId: '1231231231',
110-
clientSecret: 'ABC123ABCDABC123ABCDABC123ABCDABC123ABCD',
111-
},
107+
// Use for development
108+
// initialValues: {
109+
// hostname: 'github.example.com',
110+
// clientId: '1231231231',
111+
// clientSecret: 'ABC123ABCDABC123ABCDABC123ABCDABC123ABCD',
112+
// },
112113
validate,
113114
})(EnterpriseLogin));

src/js/components/login.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ export class LoginPage extends React.Component {
2525
<img className="img-responsive logo" src="images/gitify-logo-outline-dark.png" />
2626
<div className="desc">GitHub Notifications<br />in your menu bar.</div>
2727
<button
28-
className="btn btn-lg btn-block github"
28+
className="btn btn-block btn-login"
2929
onClick={() => authGithub(undefined, this.props.dispatch)}
3030
>
31-
<i className="fa fa-github" /> Log in to GitHub
31+
<i className="fa fa-github mr-2" /> Login to GitHub
3232
</button>
3333

3434
<Link
3535
to="/enterpriselogin"
36-
className="btn btn-lg btn-block enterprise">
37-
<i className="fa fa-github" /> Enterprise
36+
className="btn btn-block btn-login mt-3">
37+
<i className="fa fa-github mr-2" /> Login to GitHub Enterprise
3838
</Link>
3939
</div>
4040
);

src/js/components/sidebar.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ export class Sidebar extends React.Component {
4545
.get('notifications', List()).size;
4646

4747
return (
48-
<div className="badge badge-primary text-uppercase" title={defaultHostname}>
49-
GitHub {notificationsCount}
48+
<div className="badge-account" title={defaultHostname}>
49+
<div className="mr-auto name">GitHub</div>
50+
<div>{notificationsCount === 0 ? <span className="octicon octicon-check" /> : notificationsCount}</div>
5051
</div>
5152
);
5253
}
@@ -60,8 +61,13 @@ export class Sidebar extends React.Component {
6061
.get('notifications', List()).size;
6162

6263
return (
63-
<div className="badge badge-primary text-uppercase" key={idx} title={account.get('hostname')}>
64-
{accountDomain} {notificationsCount}
64+
<div
65+
key={idx}
66+
title={account.get('hostname')}
67+
className="badge-account"
68+
>
69+
<div className="mr-auto name">{accountDomain}</div>
70+
<div>{notificationsCount === 0 ? <span className="octicon octicon-check" /> : notificationsCount}</div>
6571
</div>
6672
);
6773
});
@@ -85,7 +91,7 @@ export class Sidebar extends React.Component {
8591
)}
8692

8793
{isEitherLoggedIn && (
88-
<ul className="nav nav-inline mb-1">
94+
<ul className="nav nav-inline mb-2">
8995
<li className="nav-item text-white">
9096
<i
9197
title="Refresh"
@@ -106,7 +112,11 @@ export class Sidebar extends React.Component {
106112
{this._renderEnterpriseAccounts()}
107113

108114
<div className="footer">
109-
{!!isEitherLoggedIn && <Link to="/enterpriselogin" className="btn btn-block">Add</Link>}
115+
{!!isEitherLoggedIn &&
116+
<Link
117+
to="/enterpriselogin"
118+
className="btn btn-block btn-sm btn-outline-secondary btn-add">Add <br />Enterprise</Link>
119+
}
110120

111121
{!hasStarred && (
112122
<button className="btn btn-block btn-sm btn-outline-secondary btn-star" onClick={this.openBrowser}>

src/scss/app.scss

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,41 @@ input {
274274
}
275275
}
276276

277+
.badge-account {
278+
display: flex;
279+
flex-direction: row;
280+
justify-content: end;
281+
282+
margin: .75rem -.75rem;
283+
background-color: $gray-darker;
284+
padding: .5rem;
285+
text-transform: uppercase;
286+
line-height: 1;
287+
color: $light-gray;
288+
font-size: 75%;
289+
font-weight: bold;
290+
291+
.name {
292+
overflow: hidden;
293+
text-overflow: ellipsis;
294+
}
295+
296+
.octicon {
297+
font-size: 12px;
298+
}
299+
}
300+
277301
.footer {
278302
position: absolute;
279303
right: .75rem;
280304
bottom: 1rem;
281305
left: .75rem;
282306

307+
.btn-add {
308+
font-size: 75%;
309+
}
310+
311+
.btn-add,
283312
.btn-star {
284313
-webkit-app-region: no-drag;
285314

@@ -342,7 +371,6 @@ input {
342371
padding-top: 20px;
343372
width: 100%;
344373
height: 100%;
345-
color: $white;
346374

347375
.logo {
348376
display: block;
@@ -351,18 +379,21 @@ input {
351379
}
352380

353381
.desc {
354-
margin-bottom: 25px;
382+
margin: 1rem 0 2rem;
355383
text-align: center;
356384
line-height: 22px;
357385
color: $gray-dark;
358386
font-size: 20px;
359387
}
360388

361-
.login-btn {
362-
padding: 5px 0;
389+
.btn-close {
390+
margin-bottom: 1rem;
391+
padding: 0;
392+
color: $gray-dark;
393+
font-size: 2rem;
363394
}
364395

365-
.btn {
396+
.btn-login {
366397
@include button-variant($white, $gray, $gray);
367398
padding: .55rem 1.25rem;
368399
}

0 commit comments

Comments
 (0)