Skip to content

Commit 1bbed3d

Browse files
committed
Add horizontal layout options: center (default), left, right, space-around
1 parent 087b8ea commit 1bbed3d

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

browser-control-card.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,13 @@ class BrowserControlCard extends HTMLElement {
180180
this.content.style.padding = "1rem";
181181
}
182182

183+
this.content.style.display = "flex";
184+
this.content.style.alignItems = "center";
185+
if (!this.config.layout) {
186+
this.config.layout = "center"
187+
}
188+
this.content.style.justifyContent = this.config.layout;
189+
183190
// Convert old configuration keys
184191
if (!this.config.controls) {
185192
this.config.controls = [];
@@ -411,6 +418,7 @@ class BrowserControlCard extends HTMLElement {
411418
],
412419
no_padding: false,
413420
small_buttons: false,
421+
layout: "center",
414422
};
415423
}
416424

@@ -454,22 +462,32 @@ class BrowserControlCard extends HTMLElement {
454462
schema: [
455463
{ name: "no_padding", selector: { boolean: {} } },
456464
{ name: "small_buttons", selector: { boolean: {} } },
465+
{
466+
name: "layout",
467+
selector: {
468+
select: { options: ["center", "space-around", "left", "right"], multiple: false, mode: "dropdown"},
469+
},
470+
},
457471
],
458472
},
459473
],
460474
computeLabel: (schema) => {
461475
switch (schema.name) {
462476
case "controls":
463477
return "Available controls";
478+
case "layout":
479+
return "Horizontal layout"
464480
}
465481
return undefined;
466482
},
467483
computeHelper: (schema) => {
468484
switch (schema.name) {
469485
case "no_padding":
470-
return "No white space (padding) between buttons and card borders";
486+
return "Remove white space (padding) between buttons and card borders";
471487
case "controls":
472488
return "Select the controls to display. Some controls may be hidden if your current browser does not support the feature.";
489+
case "layout":
490+
return "Configure controls layout inside the card"
473491
}
474492
return undefined;
475493
},

0 commit comments

Comments
 (0)