Skip to content

Commit d54f1bc

Browse files
authored
ensure that select AWS or Snowflake in dropdown updates the URL (#118)
1 parent 48e1d39 commit d54f1bc

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

public/js/icon-loader.js

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,30 @@
8484
addIconClassesToNavigation();
8585
},
8686
};
87-
})();
8887

89-
/* const leftNavSelect = document.querySelector('select.astro-oojz3yon');
90-
if (leftNavSelect) {
91-
leftNavSelect.addEventListener('change', (event) => {
92-
console.log('leftNavSelect changed');
93-
window.LocalStackIconLoader.refresh();
94-
});
95-
}
96-
*/
88+
function handleDropdownNavigation() {
89+
const leftNavSelect = document.querySelector('select.astro-oojz3yon');
90+
if (leftNavSelect) {
91+
leftNavSelect.addEventListener('change', (event) => {
92+
const selectedValue = event.target.value;
93+
console.log('Dropdown changed to:', selectedValue);
94+
95+
if (selectedValue === 'AWS') {
96+
window.location.href = '/aws/';
97+
} else if (selectedValue === 'Snowflake') {
98+
window.location.href = '/snowflake/';
99+
}
100+
101+
setTimeout(() => {
102+
window.LocalStackIconLoader.refresh();
103+
}, 100);
104+
});
105+
}
106+
}
107+
if (document.readyState === 'loading') {
108+
document.addEventListener('DOMContentLoaded', handleDropdownNavigation);
109+
} else {
110+
handleDropdownNavigation();
111+
}
112+
setTimeout(handleDropdownNavigation, 500);
113+
})();

0 commit comments

Comments
 (0)