Skip to content

Commit

Permalink
feat: tidy up modal styling
Browse files Browse the repository at this point in the history
  • Loading branch information
scottmckendry committed Aug 22, 2024
1 parent d55adce commit 54db3d0
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 20 deletions.
53 changes: 46 additions & 7 deletions public/css/modal.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@
max-width: 600px;

/* Display properties for visible dialog*/
border: solid 1px #999;
border-radius: 8px;
box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.3);
box-shadow: 0px 0px 20px 0px rgba(33, 33, 33, 0.5);
background-color: #323130;
padding: 20px;

Expand All @@ -51,6 +50,11 @@
animation-timing-function: ease;
}

#modal h2 {
margin-bottom: 20px;
font-size: 1.5rem;
}

#modal.closing {
/* Animate when closing */
animation-name: fadeOut;
Expand All @@ -65,13 +69,48 @@
animation-timing-function: ease;
}

#modal input[type="text"] {
width: 95%;
#modal table {
width: 100%;
table-layout: fixed;
margin-bottom: 20px;
}

#modal table th {
border-bottom: 1px solid #fff;
text-align: left;
}

#modal table td {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}

#modal button {
padding: 5px 10px;
background-color: #555;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}

#modal input {
padding: 5px;
font-size: 16px;
margin-bottom: 10px;
border: 1px solid #fff;
width: 100%;
border-radius: 5px;
background-color: #444;
outline: none;
border: none;
color: #fff;
}

.table-actions {
white-space: nowrap;
}

#modal .action-buttons {
margin-top: 20px;
}

@keyframes fadeIn {
Expand Down
9 changes: 5 additions & 4 deletions views/mappings.templ
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ templ Mappings(user goth.User, mappings []data.Mapping) {
<div id="modal" _="on closeModal add .closing then wait for animationend then remove me then go to location.reload()">
<div class="modal-underlay" _="on click trigger closeModal"></div>
<div class="modal-content">
<h2>Mappings</h2>
<h2>Edit key mappings</h2>
<table id="mappings-table">
<thead>
<tr>
Expand Down Expand Up @@ -39,7 +39,7 @@ templ MappingRow(mapping *data.Mapping) {
<tr>
<td>{ mapping.Keymap }</td>
<td>{ mapping.MapsTo }</td>
<td>
<td class="table-actions">
<button
class="button"
hx-get={ "/mappings/edit/" + strconv.Itoa(mapping.ID) }
Expand All @@ -66,8 +66,9 @@ templ NewMapping() {
<td>
<input type="text" id="mapsto" name="mapsto" data-include-add="" required/>
</td>
<td>
<td class="table-actions">
<button class="button" hx-post="/mappings/add" hx-target="#mappings-table" hx-include="input[data-include-add]" hx-swap="outerHTML">Save</button>
<button class="button" hx-get="/mappings" hx-swap="outerHTML">Cancel</button>
</td>
</tr>
}
Expand All @@ -80,7 +81,7 @@ templ EditMapping(user goth.User, mapping *data.Mapping) {
<td>
<input type="text" id="mapsto" name="mapsto" data-include-edit="" value={ mapping.MapsTo } required/>
</td>
<td>
<td class="table-actions">
<button class="button" hx-put={ "/mappings/update/" + strconv.Itoa(mapping.ID) } hx-target="#mappings-table" hx-include="input[data-include-edit]">Save</button>
<button class="button" hx-get={ "/mappings/" + strconv.Itoa(mapping.ID) }>Cancel</button>
</td>
Expand Down
18 changes: 9 additions & 9 deletions views/mappings_templ.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 54db3d0

Please sign in to comment.