1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 15:23:33 +00:00

[PM-2195] Adjust radio groups margin (#5410)

* Adjust radio groups margin

* Move hint margin to input field

* Tweak field spacing

* Add story for hint, and fix hint display

* Fix label ssue

* Revert input margin

* Re-add margin to hint

* Change font weight

* Fix required placement

* Add support for required

* Change margin of radio group

* Remove unnecessary div

* Fix long inputs cutting off

* Fix radio story

* Remove newline

---------

Co-authored-by: Will Martin <contact@willmartian.com>
This commit is contained in:
Oscar Hinton
2023-11-21 04:59:03 +01:00
committed by GitHub
parent 651593bcd2
commit 50493ab6f7
12 changed files with 168 additions and 23 deletions

View File

@@ -25,6 +25,7 @@ export class CheckboxComponent implements BitFormControlAbstraction {
"tw-w-3.5",
"tw-mr-1.5",
"tw-bottom-[-1px]", // Fix checkbox looking off-center
"tw-flex-none", // Flexbox fix for bit-form-control
"before:tw-content-['']",
"before:tw-block",

View File

@@ -1,5 +1,12 @@
import { Component, Input } from "@angular/core";
import { FormsModule, ReactiveFormsModule, FormBuilder, Validators } from "@angular/forms";
import {
FormsModule,
ReactiveFormsModule,
FormBuilder,
Validators,
FormGroup,
FormControl,
} from "@angular/forms";
import { Meta, StoryObj, moduleMetadata } from "@storybook/angular";
import { I18nService } from "@bitwarden/common/src/platform/abstractions/i18n.service";
@@ -15,7 +22,8 @@ const template = `
<input type="checkbox" bitCheckbox formControlName="checkbox">
<bit-label>Click me</bit-label>
</bit-form-control>
</form>`;
</form>
`;
@Component({
selector: "app-example",
@@ -89,6 +97,40 @@ export const Default: Story = {
},
};
export const Hint: Story = {
render: (args) => ({
props: {
formObj: new FormGroup({
checkbox: new FormControl(false),
}),
},
template: `
<form [formGroup]="formObj">
<bit-form-control>
<input type="checkbox" bitCheckbox formControlName="checkbox">
<bit-label>Really long value that never ends.</bit-label>
<bit-hint>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur iaculis consequat enim vitae elementum.
Ut non odio est. Duis eu nisi ultrices, porttitor lorem eget, ornare libero. Fusce ex ante, consequat ac
sem et, euismod placerat tellus.
</bit-hint>
</bit-form-control>
</form>
`,
}),
parameters: {
docs: {
source: {
code: template,
},
},
},
args: {
checked: false,
disabled: false,
},
};
export const Custom: Story = {
render: (args) => ({
props: args,