Skip to content

Commit b375ac5

Browse files
Style ServicesModal
1 parent 42ce0c0 commit b375ac5

5 files changed

Lines changed: 87 additions & 65 deletions

File tree

app/modals/ServicesModal.tsx

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
import React, { useContext, useEffect } from 'react';
2-
import { ApplicationContext } from '../context/ApplicationContext';
3-
import '../stylesheets/ServicesModal.css';
42
import { Link } from 'react-router-dom';
53

4+
import { ApplicationContext } from '../context/ApplicationContext';
5+
import '../stylesheets/ServicesModal.scss';
6+
67
interface ServicesModalProps {
78
i: number;
8-
app: string
9+
app: string;
910
}
1011

1112
interface IService {
12-
microservice: string
13+
microservice: string;
1314
}
1415

1516
const ServicesModal: React.SFC<ServicesModalProps> = ({ i, app }) => {
@@ -30,7 +31,7 @@ const ServicesModal: React.SFC<ServicesModalProps> = ({ i, app }) => {
3031
* TEMPORARY fix to allow us to fetch service names
3132
* AFTER we connect to the Mongo Database. This error does
3233
* not occur with PostgreSQL databases.
33-
*
34+
*
3435
* Just click on the whitespace of the modal to run another
3536
* fetch request for service names
3637
*/
@@ -39,18 +40,25 @@ const ServicesModal: React.SFC<ServicesModalProps> = ({ i, app }) => {
3940
};
4041

4142
return (
42-
<div className="modal" onClick={() => fetchStuff()}>
43+
<div className="services-container" onClick={() => fetchStuff()}>
4344
{!servicesData.length ? (
44-
<h3>Loading...</h3>
45+
<h2>Loading...</h2>
4546
) : (
4647
<>
47-
<h3>Microservices for <strong>{app}</strong></h3>
48-
{servicesData.map((service: IService, i: number) => (
49-
<Link key={i} className="link" to={`/applications/${app}/${service.microservice}`}>
50-
{service.microservice}
51-
</Link>
52-
))}
53-
<Link className="link" to={`/applications/${app}/communications`}>communications</Link>
48+
<div className="services-header">
49+
<h2>{app}</h2>
50+
<p>Select a server to monitor</p>
51+
</div>
52+
<div className="services-links">
53+
{servicesData.map((service: IService, i: number) => (
54+
<Link key={i} className="link" to={`/applications/${app}/${service.microservice}`}>
55+
{service.microservice}
56+
</Link>
57+
))}
58+
<Link className="link" to={`/applications/${app}/communications`}>
59+
communications
60+
</Link>
61+
</div>
5462
</>
5563
)}
5664
</div>

app/stylesheets/AddModal.scss

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,11 @@
11
@import './constants.scss';
22

33
.add-container {
4-
position: absolute;
5-
top: 50%;
6-
left: 50%;
7-
transform: translate(-50%, -50%);
8-
padding: 50px 40px;
9-
background-color: #f4f4f4;
10-
border-radius: 5px;
11-
width: 50%;
12-
max-width: 600px;
4+
@include centerModal();
135

146
/* Header */
157
h2 {
16-
margin: 0 auto 35px;
17-
text-align: center;
18-
font-weight: 700;
19-
font-size: 200%;
20-
color: #333;
8+
@include modalHeader();
219
}
2210

2311
/* Form */

app/stylesheets/ServicesModal.css

Lines changed: 0 additions & 36 deletions
This file was deleted.

app/stylesheets/ServicesModal.scss

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
@import './constants.scss';
2+
3+
.services-container {
4+
@include centerModal(400px);
5+
padding: 20px 20px 30px;
6+
7+
// Header
8+
.services-header {
9+
text-align: center;
10+
margin-bottom: 20px;
11+
h2 {
12+
@include modalHeader();
13+
}
14+
}
15+
16+
// Buttons
17+
.services-links {
18+
width: 100%;
19+
20+
.link {
21+
display: block;
22+
width: 80%;
23+
font-size: 110%;
24+
text-decoration: none;
25+
border: thin solid lighten($sidebarblue, 35%);
26+
border-bottom: none;
27+
padding: 12px;
28+
margin: 0 auto;
29+
background-color: lighten($sidebarblue, 70%);
30+
color: rgb(31, 31, 31);
31+
transition: 0.1s;
32+
text-align: center;
33+
font-weight: 700;
34+
35+
&:last-of-type {
36+
border-bottom: thin solid lighten($sidebarblue, 35%);
37+
}
38+
}
39+
40+
.link:hover {
41+
color: #fff;
42+
background-color: $sidebarblue;
43+
}
44+
}
45+
}

app/stylesheets/constants.scss

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,23 @@ $lightgray: #c3c3c3;
1010
flex-direction: $direction;
1111
}
1212

13+
@mixin centerModal($width: auto) {
14+
@include centerWithFlex(center, column);
15+
position: absolute;
16+
top: 50%;
17+
left: 50%;
18+
transform: translate(-50%, -50%);
19+
border-radius: 5px;
20+
width: $width;
21+
background-color: #f4f4f4;
22+
}
23+
24+
@mixin modalHeader() {
25+
font-weight: 700;
26+
font-size: 200%;
27+
color: #333;
28+
}
29+
1330
@keyframes blink {
1431
0%,
1532
65% {
@@ -28,4 +45,4 @@ $lightgray: #c3c3c3;
2845
to {
2946
transform: rotateZ(360deg);
3047
}
31-
}
48+
}

0 commit comments

Comments
 (0)