Skip to content

Commit 2b3478d

Browse files
committed
loading and header
1 parent bae4cdd commit 2b3478d

File tree

5 files changed

+84
-56
lines changed

5 files changed

+84
-56
lines changed

src/Components/ProjectListApplyer.js

Lines changed: 30 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ const LabelList = ({ header, labels, className, applyedLabels }) => (
2929

3030
const ProjectListApplyer = ({
3131
className,
32-
loading,
3332
projects,
3433
selectedPreject,
3534
applying,
@@ -40,52 +39,45 @@ const ProjectListApplyer = ({
4039
alert
4140
}) => (
4241
<div className={`ProjectListApplyer ${className}`}>
43-
{loading ?
44-
<section>
45-
<h2>Loading...</h2>
46-
<Loading />
47-
</section>
48-
:
49-
<section>
50-
<ProjectListSelector className="select-group"
51-
disabled={applying}
52-
selected={selectedPreject}
53-
projects={projects}
54-
onApply={(selected) => onApply(selected)}
42+
<section>
43+
<ProjectListSelector className="select-group"
44+
disabled={applying}
45+
selected={selectedPreject}
46+
projects={projects}
47+
onApply={(selected) => onApply(selected)}
48+
/>
49+
50+
{!alert ? null :
51+
<Alert
52+
color={alert.type}
53+
children={alert.message}
5554
/>
56-
{!alert ? null :
57-
<Alert
58-
color={alert.type}
59-
children={alert.message}
60-
/>
61-
}
62-
{!applying ? null :
63-
<div className="row applying-status">
64-
<div className="col-md-12"><Loading status={applyingStatus} /></div>
65-
</div>
66-
}
55+
}
56+
{!applying ? null :
57+
<div className="row applying-status">
58+
<div className="col-md-12"><Loading status={applyingStatus} /></div>
59+
</div>
60+
}
61+
<LabelList
62+
header="Labels to Add:"
63+
className="labels-to-add"
64+
labels={LABELS_TO_ADD}
65+
applyedLabels={applyedLabels}
66+
/>
67+
{labelsToRemove.length === 0 ? null :
6768
<LabelList
68-
header="Labels to Add:"
69-
className="labels-to-add"
70-
labels={LABELS_TO_ADD}
69+
header="Labels to Remove:"
70+
className="labels-to-remove"
71+
labels={labelsToRemove}
7172
applyedLabels={applyedLabels}
7273
/>
73-
{labelsToRemove.length === 0 ? null :
74-
<LabelList
75-
header="Labels to Remove:"
76-
className="labels-to-remove"
77-
labels={labelsToRemove}
78-
applyedLabels={applyedLabels}
79-
/>
80-
}
81-
</section>
82-
}
74+
}
75+
</section>
8376
</div>
8477
);
8578

8679
ProjectListApplyer.propTypes = {
8780
className: PropTypes.string,
88-
loading: PropTypes.bool,
8981

9082
applying: PropTypes.bool,
9183
applyingStatus: PropTypes.string,
@@ -108,7 +100,6 @@ ProjectListApplyer.propTypes = {
108100
ProjectListApplyer.defaultProps = {
109101
className: "",
110102
applying: false,
111-
loading: false,
112103
applyedLabels: [],
113104
labelsToRemove: [],
114105
}

src/Home.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
margin: auto;
2828
}
2929

30+
.CWSPApp .Home .project-handlers-buttons .btn .icon path {
31+
fill: var(--primary)
32+
}
33+
3034
.CWSPApp .Home .project-handlers-buttons .btn:active .icon path,
3135
.CWSPApp .Home .project-handlers-buttons .btn:hover .icon path {
3236
fill: white;

src/Origins/GitHub.js

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import React from 'react'
22
import LABELS_TO_ADD from '../Labels';
33
import ProjectListApplyer from '../Components/ProjectListApplyer';
4+
import Loading from '../Components/Loading'
5+
import GitHubLogo from '../assets/images/github.svg'
6+
7+
import './helper.css';
48

59
const LABELS_TO_REMOVE = [
610
{ name: "bug", color: "d73a4a" },
@@ -123,23 +127,39 @@ class GitHub extends React.Component {
123127
render() {
124128
const { loading, repositories, selectedOption, applyedLabels, applying, applyingStatus, alert } = this.state;
125129

126-
return <ProjectListApplyer
127-
loading={loading}
128-
projects={repositories.map(r => Object.assign(r, {
129-
value: r.full_name,
130-
label: r.full_name,
131-
}))}
132-
selectedPreject={selectedOption}
133-
134-
labelsToRemove={LABELS_TO_REMOVE}
135-
136-
onApply={(selected) => this.handleApply(selected)}
130+
if (loading) {
131+
return <section>
132+
<h2>Loading GitHub...</h2>
133+
<Loading />
134+
</section>
135+
}
137136

138-
applyedLabels={applyedLabels}
139-
applying={applying}
140-
applyingStatus={applyingStatus}
141-
alert={alert}
142-
/>
137+
return (
138+
<div className="GitHub">
139+
<section className="origin-header">
140+
<h1>
141+
<span className="origin-logo"><GitHubLogo /></span>
142+
<span className="origin-name">GitHub</span>
143+
</h1>
144+
</section>
145+
<ProjectListApplyer
146+
projects={repositories.map(r => Object.assign(r, {
147+
value: r.full_name,
148+
label: r.full_name,
149+
}))}
150+
selectedPreject={selectedOption}
151+
152+
labelsToRemove={LABELS_TO_REMOVE}
153+
154+
onApply={(selected) => this.handleApply(selected)}
155+
156+
applyedLabels={applyedLabels}
157+
applying={applying}
158+
applyingStatus={applyingStatus}
159+
alert={alert}
160+
/>
161+
</div>
162+
)
143163
}
144164
}
145165

src/Origins/helper.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.origin-header {
2+
padding-bottom: 0;
3+
}
4+
5+
.origin-logo {
6+
vertical-align: middle;
7+
display: inline-block;
8+
margin-right: .5ex;
9+
}
10+
11+
.origin-logo svg {
12+
height: 1em;
13+
}

src/assets/images/github.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)