1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-12 22:33:35 +00:00

[CL-54] Add support for button block without argument + submit button (#3498)

This commit is contained in:
Oscar Hinton
2022-09-16 11:30:41 +02:00
committed by GitHub
parent 0783bb2f7d
commit 868f12bfd8
5 changed files with 39 additions and 9 deletions

View File

@@ -59,13 +59,12 @@ export class ButtonDirective {
"focus-visible:tw-ring-primary-700",
"focus-visible:tw-z-10",
]
.concat(this.block ? ["tw-w-full", "tw-block"] : ["tw-inline-block"])
.concat(
this.block == null || this.block === false ? ["tw-inline-block"] : ["tw-w-full", "tw-block"]
)
.concat(buttonStyles[this.buttonType ?? "secondary"]);
}
@Input()
buttonType: ButtonTypes = null;
@Input()
block = false;
@Input() buttonType: ButtonTypes = null;
@Input() block?: boolean;
}

View File

@@ -52,3 +52,21 @@ export const Disabled = DisabledTemplate.bind({});
Disabled.args = {
size: "small",
};
const BlockTemplate: Story<ButtonDirective> = (args: ButtonDirective) => ({
props: args,
template: `
<span class="tw-flex">
<button bitButton [buttonType]="buttonType" [block]="block">[block]="true" Button</button>
<a bitButton [buttonType]="buttonType" [block]="block" href="#" class="tw-ml-2">[block]="true" Link</a>
<button bitButton [buttonType]="buttonType" block class="tw-ml-2">block Button</button>
<a bitButton [buttonType]="buttonType" block href="#" class="tw-ml-2">block Link</a>
</span>
`,
});
export const Block = BlockTemplate.bind({});
Block.args = {
block: true,
};