Skip to content

Commit

Permalink
feat(ui): update settings modal style
Browse files Browse the repository at this point in the history
  • Loading branch information
scottmckendry committed Aug 25, 2024
1 parent f526619 commit 8b7071a
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 29 deletions.
48 changes: 48 additions & 0 deletions public/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,43 @@ nav:hover .caret-rotate {
transform: rotate(-90deg);
}

.settings-container {
display: flex;
flex-direction: column;
}

.setting {
margin-bottom: 10px;
}

.tooltip-container {
position: relative;
display: inline-block;
}

.tooltip-text {
visibility: hidden;
width: 250px;
background-color: #555;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 10px;
position: absolute;
z-index: 1;
bottom: 125%;
left: 50%;
margin-left: -60px;
opacity: 0;
transition: opacity 0.3s;
font-size: 0.75rem;
}

.tooltip-container:hover .tooltip-text {
visibility: visible;
opacity: 1;
}

/*modal styles*/
#modal {
/* Underlay covers entire screen. */
Expand Down Expand Up @@ -313,6 +350,17 @@ nav:hover .caret-rotate {
color: #fff;
}

#modal select {
padding: 8px !important;
font-size: inherit;
width: 100%;
border-radius: 5px;
background-color: #444;
outline: none;
border: none;
color: #fff;
}

.table-actions {
white-space: nowrap;
padding: 3px 0;
Expand Down
49 changes: 27 additions & 22 deletions views/settings.templ
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,33 @@ import (

templ Settings(user goth.User, settings *data.UserSettings) {
@Modal("Settings") {
<div class="setting">
<label for="leaderKey">Leader Key</label>
<input type="text" name="leaderKey" value={ settings.LeaderKey } placeholder="Leader Key" data-include-edit=""/>
</div>
<div class="setting">
<label for="searchEngine">Search Engine</label>
<select name="searchEngine" data-include-edit="">
// See search.templ for the full list of search engines
for name := range searchEngines {
<option value={ name } selected?={ settings.SearchEngine == name }>{ name }</option>
}
</select>
</div>
<div class="setting">
<label for="suggestions" class="tooltip-container">
Show Google-Powered Suggestions <icon class="bx bx-help-circle"></icon>
<p class="tooltip-text">This feature will send your search queries to Google to provide suggestions - regardless of your search engine choice.</p>
</label>
<input type="checkbox" name="suggestions" checked?={ settings.ShowSuggestions } data-include-edit=""/>
</div>
<div class="action-buttons">
<button class="button" _="on click trigger closeModal" hx-put="/update-settings" hx-include="input[data-include-edit],select[data-include-edit]">Save</button>
<div class="settings-container">
<div class="setting">
<label for="leaderKey">Leader Key</label>
<input type="text" name="leaderKey" value={ settings.LeaderKey } placeholder="Leader Key" data-include-edit=""/>
</div>
<div class="setting">
<label for="searchEngine">Search Engine</label>
<select name="searchEngine" data-include-edit="">
// See search.templ for the full list of search engines
for name := range searchEngines {
<option value={ name } selected?={ settings.SearchEngine == name }>{ name }</option>
}
</select>
</div>
<div class="setting">
<label for="suggestions" class="tooltip-container">
Show Google-Powered Suggestions <icon class="bx bx-help-circle"></icon>
<p class="tooltip-text">This feature will send your search queries to Google to provide suggestions - regardless of your search engine choice.</p>
</label>
<select name="suggestions" data-include-edit="">
<option value="true" selected?={ settings.ShowSuggestions }>Yes</option>
<option value="false" selected?={ !settings.ShowSuggestions }>No</option>
</select>
</div>
<div class="action-buttons">
<button class="button" _="on click trigger closeModal" hx-put="/update-settings" hx-include="input[data-include-edit],select[data-include-edit]">Save</button>
</div>
</div>
}
}
24 changes: 17 additions & 7 deletions views/settings_templ.go

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

0 comments on commit 8b7071a

Please sign in to comment.