Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,15 @@
clonedButton._originalButton = originalButton;
clonedButton.removeAttribute("slot");
clonedButton.style.display = '';
clonedButton.addEventListener('click', ev => {
clonedButton.addEventListener('click', () => {
// Update server side button component state
clonedButton._originalButton.$server.toggleState();
if (clonedButton.getAttribute("theme")) {
clonedButton.removeAttribute("theme")
} else {
clonedButton.setAttribute("theme", "primary");
}
// Toggle only the "primary" token, preserving any other theme tokens
const themes = new Set((clonedButton.getAttribute('theme') || '').split(/\s+/).filter(Boolean));
themes.has('primary') ? themes.delete('primary') : themes.add('primary');
themes.size
? clonedButton.setAttribute('theme', [...themes].join(' '))

Check warning on line 208 in src/main/resources/META-INF/resources/frontend/src/fc-days-of-week-selector.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Using `join()` for [...themes] will use Object's default stringification format ('[object Object]') when stringified.

See more on https://sonarcloud.io/project/issues?id=FlowingCode_DayOfWeekSelectorAddon&issues=AZ4tQSpA9wBRmoDDwav-&open=AZ4tQSpA9wBRmoDDwav-&pullRequest=28
: clonedButton.removeAttribute('theme');
// Notify value change to DayOfWeekSelector component
this.dispatchEvent(new CustomEvent('change', {bubbles: true}));
});
Expand Down
Loading