Skip to content

Commit

Permalink
fix(ui-library): remove margin in error state (#945) (#1060)
Browse files Browse the repository at this point in the history
  • Loading branch information
angsherpa456 authored and ChristianHoffmannS2 committed Jan 13, 2025
1 parent 5d8faed commit 573282a
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 18 deletions.
6 changes: 3 additions & 3 deletions packages/ui-library/src/components/checkbox/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export class BlrCheckbox extends LitElementCustom {
this.size.toUpperCase(),
]).toLowerCase() as FormSizesType;

const captionContent = html`
const getCaptionContent = () => html`
${this.hasHint && (this.hintMessage || this.hintIcon)
? html`
<div class="hint-wrapper">
Expand Down Expand Up @@ -303,8 +303,8 @@ export class BlrCheckbox extends LitElementCustom {
labelSize: this.size,
})}`
: nothing}
${this.hasHint || this.hasError
? BlrFormCaptionGroupRenderFunction({ sizeVariant: this.size }, captionContent)
${(this.hasHint && this.hintMessage) || (this.hasError && this.errorMessage)
? BlrFormCaptionGroupRenderFunction({ sizeVariant: this.size }, getCaptionContent())
: nothing}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ const sampleParams: BlrInputFieldNumberType = {
inputFieldNumberId: 'egal',
label: 'Hello',
hasHint: false,
hintMessage: 'This is a sample hint',
hintMessageIcon: 'blr360',
errorMessageIcon: 'blrInfo',
errorMessage: "OMG it's an error",
value: 4,
unit: 'gr',
decimals: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ export class BlrInputFieldNumber extends LitElementCustom {
[this.stepperVariant || 'split']: this.stepperVariant || 'split',
});

const captionContent = html`
const getCaptionContent = () => html`
${this.hasHint && (this.hintMessage || this.hintMessageIcon)
? html`
<div class="hint-wrapper">
Expand Down Expand Up @@ -344,8 +344,8 @@ export class BlrInputFieldNumber extends LitElementCustom {
</div>
</div>
${this.hasHint || this.hasError
? BlrFormCaptionGroupRenderFunction({ sizeVariant: this.sizeVariant }, captionContent)
${(this.hasHint && this.hintMessage) || (this.hasError && this.errorMessage)
? BlrFormCaptionGroupRenderFunction({ sizeVariant: this.sizeVariant }, getCaptionContent())
: nothing}
`;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ const defaultParams: BlrInputFieldTextType = {
required: false,
hasError: false,
errorMessage: '',
errorMessageIcon: 'blrInfo',
errorMessageIcon: undefined,
arialabel: 'InputFieldText',
name: 'InputFieldText',
inputFieldTextId: 'Input Id',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const sampleParams: BlrInputFieldTextType = {
readonly: false,
required: false,
hasError: false,
errorMessage: '',
errorMessage: "OMG it's an error",
errorMessageIcon: 'blrInfo',
arialabel: 'InputFieldText',
inputFieldTextId: 'Input Id',
Expand Down
6 changes: 3 additions & 3 deletions packages/ui-library/src/components/input-field-text/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class BlrInputFieldText extends LitElementCustom {
this.sizeVariant,
]).toLowerCase() as SizesType;

const captionContent = html`
const getCaptionContent = () => html`
${this.hasHint && (this.hintMessage || this.hintMessageIcon)
? BlrFormCaptionRenderFunction({
variant: 'hint',
Expand Down Expand Up @@ -238,8 +238,8 @@ export class BlrInputFieldText extends LitElementCustom {
)}`
: nothing}
</div>
${this.hasHint || this.hasError
? BlrFormCaptionGroupRenderFunction({ sizeVariant: this.sizeVariant }, captionContent)
${(this.hasHint && this.hintMessage) || (this.hasError && this.errorMessage)
? BlrFormCaptionGroupRenderFunction({ sizeVariant: this.sizeVariant }, getCaptionContent())
: nothing}
</div>
`;
Expand Down
6 changes: 3 additions & 3 deletions packages/ui-library/src/components/select/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export class BlrSelect extends LitElementCustom {
'blr-input-icon': true,
[this.sizeVariant]: this.sizeVariant,
});
const captionContent = html`
const getCaptionContent = () => html`
${this.hasHint && (this.hintMessage || this.hintMessageIcon)
? BlrFormCaptionRenderFunction({
variant: 'hint',
Expand Down Expand Up @@ -219,8 +219,8 @@ export class BlrSelect extends LitElementCustom {
</div>
${this.renderIcon(iconClasses)}
</div>
${this.hasHint || this.hasError
? BlrFormCaptionGroupRenderFunction({ sizeVariant: this.sizeVariant }, captionContent)
${(this.hasHint && this.hintMessage) || (this.hasError && this.errorMessage)
? BlrFormCaptionGroupRenderFunction({ sizeVariant: this.sizeVariant }, getCaptionContent())
: nothing}
</div>
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const defaultParams: BlrTextareaType = {
required: false,
hasError: false,
errorMessage: '',
errorMessageIcon: 'blr360',
errorMessageIcon: undefined,
arialabel: 'Text Area',
textAreaId: '#textAreaId',
name: 'Text Area',
Expand Down
6 changes: 3 additions & 3 deletions packages/ui-library/src/components/textarea/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export class BlrTextarea extends LitElementCustom {

const counterVariant = this.determinateCounterVariant();

const captionContent = html`
const getCaptionContent = () => html`
${this.hasHint && (this.hintMessage || this.hintMessageIcon)
? BlrFormCaptionRenderFunction({
variant: 'hint',
Expand Down Expand Up @@ -232,8 +232,8 @@ export class BlrTextarea extends LitElementCustom {
@keyup=${this.updateCounter}
></textarea>
<div class="${textareaInfoContainer}">
${this.hasHint || this.hasError
? BlrFormCaptionGroupRenderFunction({ sizeVariant: this.sizeVariant }, captionContent)
${(this.hasHint && this.hintMessage) || (this.hasError && this.errorMessage)
? BlrFormCaptionGroupRenderFunction({ sizeVariant: this.sizeVariant }, getCaptionContent())
: nothing}
${this.hasCounter
? BlrCounterRenderFunction({
Expand Down

0 comments on commit 573282a

Please sign in to comment.