feat: Style update for buttons, reduce style duplication (#621)

This commit is contained in:
James Read 2025-07-19 12:51:19 +01:00 committed by GitHub
parent e922baa2e0
commit b91c0d7e45
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 91 additions and 86 deletions

View File

@ -207,8 +207,8 @@
<div class = "arguments"></div> <div class = "arguments"></div>
<div class = "buttons"> <div class = "buttons">
<input name = "start" type = "submit" value = "Start"> <button name = "start" type = "submit">Start</button>
<button name = "cancel" title = "Cancel">Cancel</button> <button name = "cancel" title = "Cancel" type = "button">Cancel</button>
</div> </div>
</div> </div>
</form> </form>

View File

@ -38,9 +38,9 @@ class ArgumentForm extends window.HTMLElement {
for (const arg of this.argInputs) { for (const arg of this.argInputs) {
if (arg.type === 'checkbox') { if (arg.type === 'checkbox') {
if (arg.checked) { if (arg.checked) {
arg.value = "1" arg.value = '1'
} else { } else {
arg.value = "0" arg.value = '0'
} }
} }
@ -122,7 +122,7 @@ class ArgumentForm extends window.HTMLElement {
createDomInput (arg) { createDomInput (arg) {
let domEl = null let domEl = null
if (arg.choices.length > 0 && (arg.type == "select" || arg.type == "")) { if (arg.choices.length > 0 && (arg.type === 'select' || arg.type === '')) {
domEl = document.createElement('select') domEl = document.createElement('select')
// select/choice elements don't get an onchange/validation because theoretically // select/choice elements don't get an onchange/validation because theoretically
@ -164,8 +164,8 @@ class ArgumentForm extends window.HTMLElement {
domEl = document.createElement('input') domEl = document.createElement('input')
domEl.setAttribute('type', 'checkbox') domEl.setAttribute('type', 'checkbox')
domEl.setAttribute('name', arg.name) domEl.setAttribute('name', arg.name)
domEl.setAttribute('value', "1") domEl.setAttribute('value', '1')
break break
case 'password': case 'password':
case 'email': case 'email':

View File

@ -6,7 +6,7 @@ export class NavigationBar {
} }
createLink (title, url, isSupplemental) { createLink (title, url, isSupplemental) {
let parent = (isSupplemental) ? this.supplementalLinks : this.mainLinks const parent = (isSupplemental) ? this.supplementalLinks : this.mainLinks
const existsAlready = Array.from(parent.querySelectorAll('li')).some(el => el.title === title) const existsAlready = Array.from(parent.querySelectorAll('li')).some(el => el.title === title)

View File

@ -128,9 +128,9 @@ export function marshalDashboardComponentsJsonToHtml (json) {
marshalActionsJsonToHtml(json) marshalActionsJsonToHtml(json)
marshalDashboardStructureToHtml(json) marshalDashboardStructureToHtml(json)
window.navbar.refreshSectionPolicyLinks(json.effectivePolicy) window.navbar.refreshSectionPolicyLinks(json.effectivePolicy)
refreshDiagnostics(json) refreshDiagnostics(json)
} }
document.body.setAttribute('initial-marshal-complete', 'true') document.body.setAttribute('initial-marshal-complete', 'true')

View File

@ -5,7 +5,7 @@ import {
setupSectionNavigation, setupSectionNavigation,
marshalDashboardComponentsJsonToHtml, marshalDashboardComponentsJsonToHtml,
marshalLogsJsonToHtml, marshalLogsJsonToHtml,
refreshServerConnectionLabel, refreshServerConnectionLabel
} from './js/marshaller.js' } from './js/marshaller.js'
import { checkWebsocketConnection } from './js/websocket.js' import { checkWebsocketConnection } from './js/websocket.js'

View File

@ -2507,10 +2507,11 @@
"dev": true "dev": true
}, },
"node_modules/brace-expansion": { "node_modules/brace-expansion": {
"version": "1.1.11", "version": "1.1.12",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
@ -5311,9 +5312,9 @@
} }
}, },
"node_modules/nanoid": { "node_modules/nanoid": {
"version": "3.3.7", "version": "3.3.11",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz",
"integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@ -5321,6 +5322,7 @@
"url": "https://github.com/sponsors/ai" "url": "https://github.com/sponsors/ai"
} }
], ],
"license": "MIT",
"bin": { "bin": {
"nanoid": "bin/nanoid.cjs" "nanoid": "bin/nanoid.cjs"
}, },

View File

@ -264,38 +264,71 @@ details {
/* General Buttons */ /* General Buttons */
button, button {
input[type="submit"] transition: none;
{ font-weight: bold;
border-radius: .7em;
box-shadow: none;
font-size: 1em;
padding: 0.6em 1em;
border: 1px solid #ccc;
font-family: sans-serif; font-family: sans-serif;
padding: 1em;
color: black; color: black;
text-align: center; text-align: center;
border: 1px solid #999;
background-color: white; background-color: white;
box-shadow: 0 0 6px 0 #aaa;
user-select: none; user-select: none;
transition: background-color 1s ease, color .3s ease;
} }
input[type="checkbox"] {
justify-self: baseline;
}
fieldset button {
border-radius: .7em;
}
/* Action Buttons */
action-button { action-button {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
action-button button { action-button button {
font-size: .85em;
font-weight: normal;
flex-grow: 1; flex-grow: 1;
width: 100%; width: 100%;
z-index: 1; z-index: 1;
padding: 1em;
box-shadow: 0 0 6px 0 #aaa;
transition: background-color 1s ease, color .3s ease;
}
execution-button button {
margin-top: 0.2em;
margin-bottom: 0.2em;
}
button:focus {
outline: 1px solid black;
}
button:hover {
background-color: #ececec;
color: black;
cursor: pointer;
}
button:disabled {
color: #3c3c3c;
background-color: #cecece;
cursor: not-allowed;
text-decoration: line-through;
}
button[name="cancel"]:hover {
background-color: salmon;
color: black;
}
button[name="start"]:hover {
background-color: #aceaac;
color: black;
}
action-button button:hover {
box-shadow: 0 0 10px 0 #666;
} }
span.title { span.title {
@ -331,31 +364,6 @@ execution-button {
margin-top: .2em; margin-top: .2em;
} }
execution-button button {
margin-top: 0.2em;
margin-bottom: 0.2em;
}
/* Button states */
button:hover,
input[type="submit"]:hover {
box-shadow: 0 0 10px 0 #666;
cursor: pointer;
}
button:focus,
input[type="submit"]:focus {
outline: 1px solid black;
}
button:disabled,
input[type="submit"]:disabled {
color: #3c3c3c;
background-color: #cecece;
cursor: not-allowed;
}
.action-status { .action-status {
padding: .4em; padding: .4em;
border-radius: .4em; border-radius: .4em;
@ -427,27 +435,23 @@ header {
input { input {
font-family: sans-serif; font-family: sans-serif;
padding: 0.6em; padding: 0.6em;
border: 1px solid #ccc;
border-radius: .4em;
} }
input:invalid { input:invalid {
outline: 2px solid red; outline: 2px solid red;
} }
input[type="checkbox"] {
justify-self: baseline;
}
form .wrapper span.icon { form .wrapper span.icon {
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
} }
button[name="cancel"]:hover {
background-color: salmon;
color: black;
}
input[name="start"]:hover {
background-color: #aceaac;
color: black;
}
div.arguments { div.arguments {
display: grid; display: grid;
grid-template-columns: max-content auto auto; /* We don't want the label or the description to wrap, and the input to take up the rest of the space */ grid-template-columns: max-content auto auto; /* We don't want the label or the description to wrap, and the input to take up the rest of the space */
@ -605,12 +609,9 @@ label.input-with-icons button:disabled {
} }
#content-login button { #content-login button {
display: block;
width: 100%; width: 100%;
grid-column: 1 / span 3; grid-column: 1 / span 3;
margin-bottom: 1em; margin-bottom: 1em;
font-weight: bold;
background-color: #ced3d7;
} }
#content-login button:last-child { #content-login button:last-child {
@ -695,21 +696,33 @@ label.input-with-icons button:disabled {
input { input {
background-color: #383838; background-color: #383838;
color: white; color: white;
border: 1px solid #666;
} }
button, button {
input[type="submit"] {
border: 1px solid #666; border: 1px solid #666;
background-color: #222; background-color: #222;
box-shadow: 0 0 6px 0 #444;
color: white; color: white;
} }
button:focus, action-button button {
input[type="submit"]:focus { box-shadow: 0 0 6px 0 #444;
}
button:focus {
outline: 2px solid #72B7F4; outline: 2px solid #72B7F4;
} }
button:disabled {
background-color: black;
}
button:hover {
background-color: #444;
color: white;
}
footer { footer {
color: #bbb; color: #bbb;
} }
@ -743,10 +756,6 @@ label.input-with-icons button:disabled {
color: white; color: white;
} }
button:disabled {
background-color: black;
}
table, table,
td, td,
th { th {
@ -770,10 +779,4 @@ label.input-with-icons button:disabled {
div.display { div.display {
box-shadow: 0 0 6px 0 #444; box-shadow: 0 0 6px 0 #444;
} }
#content-login button {
background-color: #000;
border: 1px solid #666;
color: white;
}
} }