Skip to content

Commit

Permalink
docs: pr feedbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
TomMenga committed Jan 17, 2024
1 parent ccf7cf5 commit 456c019
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
8 changes: 2 additions & 6 deletions src/components/form-field/form-field/form-field.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ const TemplateInputWithErrorSpace = (args: Args): TemplateResult => {
<form>
<div>
<sbb-form-field
id="sbb-form-field"
error-space=${args['error-space']}
label=${args.label}
?optional=${args.optional}
Expand All @@ -136,14 +135,13 @@ const TemplateInputWithErrorSpace = (args: Args): TemplateResult => {
?negative=${args.negative}
>
<input
id="sbb-form-field-input"
@keyup=${(event: KeyboardEvent) => {
const input = event.currentTarget as HTMLInputElement;
if (input.value !== '') {
sbbFormError.remove();
input.classList.remove(args.cssClass);
} else {
input.closest('#sbb-form-field')!.append(sbbFormError);
input.closest('sbb-form-field')!.append(sbbFormError);
input.classList.add(args.cssClass);
}
}}
Expand Down Expand Up @@ -223,7 +221,6 @@ const TemplateSelectWithErrorSpace = (args: Args): TemplateResult => {
<form>
<div>
<sbb-form-field
id="sbb-form-field"
error-space=${args['error-space']}
label=${args.label}
?optional=${args.optional}
Expand All @@ -234,14 +231,13 @@ const TemplateSelectWithErrorSpace = (args: Args): TemplateResult => {
?negative=${args.negative}
>
<select
id="sbb-form-field-input"
@change=${(event) => {
const select = event.currentTarget as HTMLSelectElement;
if (select.value !== '0') {
sbbFormError.remove();
select.classList.remove(args.cssClass);
} else {
select.closest('#sbb-form-field')!.append(sbbFormError);
select.closest('sbb-form-field')!.append(sbbFormError);
select.classList.add(args.cssClass);
}
}}
Expand Down
1 change: 0 additions & 1 deletion src/components/selection-panel/selection-panel.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@ const WithCheckboxesErrorMessageTemplate = ({
<sbb-checkbox-group
orientation="vertical"
horizontal-from="large"
id="sbb-checkbox-group"
@change=${(event: Event) => {
const checkboxGroup = event.currentTarget as HTMLElement;
const hasChecked = Array.from(checkboxGroup.querySelectorAll('sbb-checkbox')).some(
Expand Down
6 changes: 3 additions & 3 deletions src/components/tag/tag-group/tag-group.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import type { SbbTagGroupElement } from './tag-group';

const uncheckAllTag = (event): void => {
const tagGroup = event.currentTarget.closest('sbb-tag-group') as SbbTagGroupElement;
tagGroup.querySelector('#all').removeAttribute('checked');
tagGroup.querySelector('.all').removeAttribute('checked');
};

const uncheckTags = (event): void => {
const tagGroup = event.currentTarget.closest('sbb-tag-group') as SbbTagGroupElement;
Array.from(tagGroup.querySelectorAll('sbb-tag'))
.filter((e) => e.getAttribute('id') !== 'all' && !e.getAttribute('disabled'))
.filter((e) => !e.classList.contains('all') && !e.getAttribute('disabled'))
.forEach((e) => e.removeAttribute('checked'));
};

Expand Down Expand Up @@ -102,7 +102,7 @@ const ExclusiveTagGroupTemplate = ({ numberOfTagsInGroup, ...args }): TemplateRe

const AllChoiceTagGroupTemplate = ({ numberOfTagsInGroup, ...args }): TemplateResult => html`
<sbb-tag-group ${sbbSpread(args)}>
<sbb-tag id="all" @change=${(ev) => uncheckTags(ev)} value="All" checked> All </sbb-tag>
<sbb-tag class="all" @change=${(ev) => uncheckTags(ev)} value="All" checked> All </sbb-tag>
${repeat(
new Array(numberOfTagsInGroup),
(_e, i) => html`
Expand Down

0 comments on commit 456c019

Please sign in to comment.