Skip to content

Commit ad68dfa

Browse files
Add description to layout
1 parent 6f51149 commit ad68dfa

3 files changed

Lines changed: 47 additions & 23 deletions

File tree

app/modals/AddModal.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ const AddModal: React.FC<AddModalProps> = ({ setOpen }) => {
5151
<p>Enter the database information used to track the service</p>
5252
</div>
5353
<form onSubmit={handleSubmit}>
54-
<div className="input-field">
54+
<div>
5555
<label htmlFor="db-type">Type</label>
5656
<select id="db-type" name="database" value={database} onChange={e => handleChange(e)}>
5757
<option value="SQL">SQL</option>
5858
<option value="MongoDB">MongoDB</option>
5959
</select>
6060
</div>
61-
<div className="input-field">
61+
<div>
6262
<label htmlFor="db-uri">URI</label>
6363
<input
6464
id="db-uri"
@@ -69,7 +69,7 @@ const AddModal: React.FC<AddModalProps> = ({ setOpen }) => {
6969
required
7070
/>
7171
</div>
72-
<div className="input-field">
72+
<div>
7373
<label htmlFor="db-name">Name</label>
7474
<input
7575
id="db-name"
@@ -81,6 +81,10 @@ const AddModal: React.FC<AddModalProps> = ({ setOpen }) => {
8181
required
8282
/>
8383
</div>
84+
<div>
85+
<label htmlFor="db-desc">Description</label>
86+
<textarea name="db-desc" id="db-desc" placeholder="Add a short description" />
87+
</div>
8488
<button>Submit</button>
8589
</form>
8690
</div>

app/stylesheets/AddModal.scss

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

33
.add-container {
4-
@include centerModal();
4+
@include centerModal(30%, 500px);
55

66
/* Header */
77
.add-header {
8+
width: 100%;
89
padding: 20px 30px;
910
text-align: center;
1011
border-bottom: thin solid $lightgray;
@@ -21,43 +22,61 @@
2122
form {
2223
@include centerWithFlex($direction: column);
2324
padding: 0 30px;
25+
width: 100%;
2426

2527
div {
26-
display: flex;
27-
align-items: center;
28+
@include centerWithFlex();
2829

30+
// <select /> margins
2931
&:first-of-type {
3032
margin-top: 20px;
3133
}
3234

35+
// <textarea>
36+
&:last-of-type {
37+
@include centerWithFlex($justify: flex-start, $align: flex-start);
38+
}
39+
3340
@include centerWithFlex(space-between);
3441
width: 100%;
3542
margin: 15px 0;
3643

37-
/* Text input */
38-
input {
39-
height: 30px;
40-
border: thin solid $lightgray;
41-
border-radius: 3px;
42-
flex: 1;
43-
font-family: inherit;
44+
select,
45+
input,
46+
textarea {
4447
font-size: 100%;
4548
padding: 5px;
49+
border: thin solid $lightgray;
50+
flex: 1;
51+
border-radius: 3px;
4652
}
47-
48-
/* Select field */
53+
54+
// Select field
4955
select {
56+
cursor: pointer;
57+
height: 30px;
5058
margin: 0;
5159
appearance: none;
52-
cursor: pointer;
60+
transition: 0.2s;
61+
62+
&:hover {
63+
background-color: darken(#fff, 5%);
64+
}
65+
}
66+
67+
// Text input
68+
input {
5369
height: 30px;
54-
border: thin solid $lightgray;
55-
flex: 1;
56-
font-size: 100%;
70+
}
71+
72+
// Textarea
73+
textarea {
74+
resize: none;
75+
height: 90px;
5776
}
5877

5978
label {
60-
width: 100px;
79+
width: 140px;
6180
font-size: 135%;
6281
font-weight: 400;
6382
}

app/stylesheets/constants.scss

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,22 @@ $headergray: #e8e8e8;
44
$lightgray: #c3c3c3;
55
$boxshadow: 2px 2px 6px rgb(187, 187, 187);
66

7-
@mixin centerWithFlex($justify: center, $direction: row) {
7+
@mixin centerWithFlex($justify: center, $direction: row, $align: center) {
88
display: flex;
9-
align-items: center;
9+
align-items: $align;
1010
justify-content: $justify;
1111
flex-direction: $direction;
1212
}
1313

14-
@mixin centerModal($width: auto) {
14+
@mixin centerModal($width: auto, $minwidth: 400px) {
1515
@include centerWithFlex(center, column);
1616
position: absolute;
1717
top: 50%;
1818
left: 50%;
1919
transform: translate(-50%, -50%);
2020
border-radius: 5px;
2121
width: $width;
22+
min-width: $minwidth;
2223
min-height: 100px;
2324
background-color: #f4f4f4;
2425
}

0 commit comments

Comments
 (0)