Skip to content

Commit e803cb8

Browse files
committed
feat(ui): update ui for modal section
other changes: -refactored the styles file to sort sections -small typo fixes in template.html
1 parent 1bd0fc3 commit e803cb8

2 files changed

Lines changed: 121 additions & 53 deletions

File tree

src/assets/styles.css

Lines changed: 112 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ body {
8080
text-transform: uppercase;
8181
font-weight: bold;
8282
}
83+
/* list project section */
8384
.projects-list, .button-add-project{
8485
padding-left: 5px;
8586
}
@@ -121,6 +122,7 @@ body {
121122
.right-project-panel:hover{
122123
transform: scale(1.1);
123124
}
125+
/* New project section */
124126
.button-add-project{
125127
margin-top: 5px;
126128
padding: 10px 0;
@@ -159,52 +161,6 @@ body {
159161
flex: 4;
160162
padding: 1.2rem;
161163
}
162-
.tasks-wrapper, .new-todo-btn-wrapper{
163-
padding-left: 10px;
164-
}
165-
.new-todo-btn{
166-
width: 100%;
167-
margin-top: 5px;
168-
background-color: var(--button-color);
169-
}
170-
.new-todo-btn:hover{
171-
background-color: var(--button-color-hover);
172-
}
173-
/* The Modal (hidden by default) */
174-
.modal {
175-
display: none; /* Hidden by default */
176-
position: fixed; /* Stay in place */
177-
z-index: 1; /* Sit on top */
178-
left: 0;
179-
top: 0;
180-
width: 100%; /* Full width */
181-
height: 100%; /* Full height */
182-
background-color: rgba(0, 0, 0, 0.4); /* Black background with opacity */
183-
}
184-
185-
/* Modal Content */
186-
.modal-content {
187-
background-color: #fefefe;
188-
margin: 15% auto; /* 15% from the top and centered */
189-
padding: 20px;
190-
border: 1px solid #888;
191-
width: 80%; /* Could be more or less, depending on screen size */
192-
max-width: 400px;
193-
}
194-
195-
/* Close Button */
196-
.close {
197-
color: #aaa;
198-
float: right;
199-
font-size: 28px;
200-
font-weight: bold;
201-
}
202-
203-
.close:hover,
204-
.close:focus {
205-
color: black;
206-
cursor: pointer;
207-
}
208164

209165
.todo-item {
210166
display: flex;
@@ -243,6 +199,19 @@ body {
243199
text-decoration: line-through;
244200
opacity: 0.6;
245201
}
202+
/* New Task Button */
203+
.tasks-wrapper, .new-todo-btn-wrapper{
204+
padding-left: 10px;
205+
}
206+
.new-todo-btn{
207+
width: 100%;
208+
margin-top: 5px;
209+
background-color: var(--button-color);
210+
font-size: medium;
211+
}
212+
.new-todo-btn:hover{
213+
background-color: var(--button-color-hover);
214+
}
246215

247216
/* Footer */
248217
.footer {
@@ -268,3 +237,100 @@ body {
268237
.fa-github:hover {
269238
transform: rotate(360deg) scale(1.2);
270239
}
240+
241+
/* The Modal (hidden by default) */
242+
.modal {
243+
display: none; /* Hidden by default */
244+
position: fixed; /* Stay in place */
245+
z-index: 1; /* Sit on top */
246+
left: 0;
247+
top: 0;
248+
width: 100%; /* Full width */
249+
height: 100%; /* Full height */
250+
background-color: rgba(0, 0, 0, 0.4); /* Black background with opacity */
251+
}
252+
253+
/* Modal Content */
254+
.modal-content {
255+
display: flex ;
256+
flex-direction: column;
257+
background-color: #fefefe;
258+
margin: 15% auto; /* 15% from the top and centered */
259+
padding: 20px;
260+
border: 1px solid #888;
261+
border-radius: 15px;
262+
width: 80%; /* Could be more or less, depending on screen size */
263+
max-width: 400px;
264+
}
265+
.modal-header{
266+
display: flex;
267+
flex-grow: 1;
268+
justify-content: space-between;
269+
align-items: center;
270+
margin-bottom: 15px;
271+
}
272+
.modal-header>h2{
273+
flex-grow: 1;
274+
/* text-align: center; */
275+
}
276+
.close {
277+
color: #aaa;
278+
font-size: 28px;
279+
font-weight: bold;
280+
}
281+
.close:hover,
282+
.close:focus {
283+
color: black;
284+
cursor: pointer;
285+
}
286+
/* Modal Content -form*/
287+
.modal-content > form {
288+
display: grid;
289+
grid-template-columns: 1fr 2fr; /* Label takes 1fr, input takes 2fr */
290+
grid-template-rows: min-content min-content min-content auto;
291+
grid-row-gap: 1.2rem;
292+
width: 100%;
293+
}
294+
295+
.title-wrapper,
296+
.description-wrapper,
297+
.duedate-wrapper,
298+
.priority-wrapper {
299+
/* To allow the grid to position the label and input/textarea */
300+
display: contents;
301+
}
302+
303+
.title-wrapper label,
304+
.description-wrapper label,
305+
.duedate-wrapper label {
306+
grid-column: 1; /* Place labels in the first column */
307+
justify-self: start; /* Align the labels to the start */
308+
}
309+
310+
.title-wrapper input,
311+
.description-wrapper textarea,
312+
.duedate-wrapper input {
313+
grid-column: 2; /* Inputs and textarea in the second column */
314+
width: 100%; /* Full width of the input area */
315+
}
316+
317+
.priority-wrapper {
318+
grid-column: 1 / span 2; /* Make the priority options take full width */
319+
display: grid;
320+
grid-template-columns: repeat(6, auto);
321+
align-items: center;
322+
}
323+
.priority-wrapper>input, .priority-wrapper>label{
324+
cursor: pointer;
325+
}
326+
.submit-todo {
327+
grid-column: 1 / span 2; /* Make the submit button take full width */
328+
width: 100%;
329+
margin-top: 10px;
330+
font-size: large;
331+
background-color: var(--button-color);
332+
}
333+
334+
.submit-todo:hover {
335+
background-color: var(--button-color-hover);
336+
}

src/template.html

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,21 @@ <h1 class="headerText">ToDo</h1>
4545
<section class="taskview"></section>
4646
<div id="todoModal" class="modal">
4747
<div class="modal-content">
48-
<span class="close">&times;</span>
49-
<h2>Create New ToDo</h2>
48+
<div class="modal-header">
49+
<h2>Create New Task</h2>
50+
<span class="close">&times;</span>
51+
</div>
5052
<form id="todoForm">
5153
<div class="title-wrapper">
5254
<label for="todoTitle">Title:</label>
53-
<input type="text" id="todoTitle" name="title" required /><br /><br />
55+
<input type="text" id="todoTitle" name="title" required />
5456
</div>
5557
<div class="description-wrapper">
5658
<label for="todoDescription">Description:</label>
57-
<textarea id="todoDescription" name="description" required></textarea><br /><br />
59+
<textarea id="todoDescription" name="description"></textarea>
5860
</div>
59-
<div class="dudate-wrapper">
60-
<label for="dueDate">Due-date</label>
61+
<div class="duedate-wrapper">
62+
<label for="dueDate">Due-date:</label>
6163
<input type="date" id="dueDate" name="dueDate" required />
6264
</div>
6365
<div class="priority-wrapper">
@@ -68,7 +70,7 @@ <h2>Create New ToDo</h2>
6870
<input type="radio" id="priority-high" name="priority" value="high" required />
6971
<label for="priority-high">High</label>
7072
</div>
71-
<button type="submit" class="submit-todo">Add ToDo</button>
73+
<button type="submit" class="submit-todo">Add Task</button>
7274
</form>
7375
</div>
7476
</div>

0 commit comments

Comments
 (0)