Skip to content

Commit 07bdd11

Browse files
committed
Adds layout modifier to button-container
1 parent d5c3b82 commit 07bdd11

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/webviews/apps/shared/components/button-container.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ export class ButtonContainer extends LitElement {
99
css`
1010
:host {
1111
--button-group-gap: 0.4rem;
12+
--button-max-width: 30rem;
13+
--button-group-max-width: 30rem;
1214
display: block;
13-
max-width: 30rem;
14-
margin-right: auto;
15-
margin-left: auto;
15+
max-width: var(--button-max-width, 30rem);
16+
margin-inline: auto;
1617
text-align: left;
1718
transition: max-width 0.2s ease-out;
1819
}
@@ -26,16 +27,21 @@ export class ButtonContainer extends LitElement {
2627
}
2728
2829
@media (min-width: 640px) {
29-
:host(:not([editor])) {
30-
max-width: 100%;
30+
:host([layout='shift']) {
31+
--button-max-width: 100%;
3132
}
3233
}
3334
35+
:host([layout='full']) {
36+
--button-max-width: 100%;
37+
--button-group-max-width: 100%;
38+
}
39+
3440
.group {
3541
display: inline-flex;
3642
gap: var(--button-group-gap, 0.4rem);
3743
width: 100%;
38-
max-width: 30rem;
44+
max-width: var(--button-group-max-width, 30rem);
3945
}
4046
4147
:host([grouping='split']) ::slotted(*:not(:first-child)) {
@@ -53,10 +59,10 @@ export class ButtonContainer extends LitElement {
5359
editor = false;
5460

5561
@property({ reflect: true })
56-
gap?: 'wide';
62+
layout: 'shift' | 'editor' | 'full' = 'shift';
5763

5864
@property({ reflect: true })
59-
grouping?: 'gap' | 'split' | 'gap-wide' = 'gap';
65+
grouping: 'gap' | 'split' | 'gap-wide' = 'gap';
6066

6167
override render(): unknown {
6268
return html`<div class="group"><slot></slot></div>`;

0 commit comments

Comments
 (0)