FEATURE Introducing the component and basic active buttons features
This commit is contained in:
parent
25d1c21096
commit
8188ba8557
21
resources/js/singles/article-toolbar.ts
Normal file
21
resources/js/singles/article-toolbar.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
export function handleArticleToolbar() {
|
||||
observeTabsButtons();
|
||||
}
|
||||
|
||||
function observeTabsButtons(): void {
|
||||
const toolbarButtons = document.querySelectorAll('#article-toolbar button');
|
||||
|
||||
toolbarButtons.forEach((toolbarButton) => {
|
||||
toolbarButton.addEventListener('click', () => {
|
||||
resetToolbarButtons();
|
||||
toolbarButton.setAttribute('aria-selected', 'true');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function resetToolbarButtons(): void {
|
||||
const toolbarButtons = document.querySelectorAll('#article-toolbar button');
|
||||
toolbarButtons.forEach((toolbarButton) => {
|
||||
toolbarButton.setAttribute('aria-selected', 'false');
|
||||
});
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user