Skip to content

Commit

Permalink
fix(ui-library): remove margin in error state (#945)
Browse files Browse the repository at this point in the history
  • Loading branch information
angsherpa456 committed Mar 25, 2024
1 parent a66e24a commit f9124a3
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 12 deletions.
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',
hintIcon: 'blr360',
errorIcon: '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.hintIcon)
? html`
<div class="hint-wrapper">
Expand Down Expand Up @@ -342,8 +342,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
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 f9124a3

Please sign in to comment.