mirror of
https://github.com/peritus/obsidian-interactive-ratings.git
synced 2026-07-22 05:43:17 +00:00
Extract applySymbolState function from RatingWidget.ts
This commit is contained in:
parent
2e53c1e164
commit
784e2f905e
1 changed files with 10 additions and 0 deletions
10
src/editor-extension/RatingWidget/applySymbolState.ts
Normal file
10
src/editor-extension/RatingWidget/applySymbolState.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
/**
|
||||
* Apply the appropriate CSS class to a symbol based on its state
|
||||
*/
|
||||
export function applySymbolState(span: HTMLElement, state: 'rated' | 'unrated' | 'normal'): void {
|
||||
// Remove all state classes
|
||||
span.classList.remove('interactive-rating-symbol--rated', 'interactive-rating-symbol--unrated', 'interactive-rating-symbol--normal');
|
||||
|
||||
// Add the appropriate state class
|
||||
span.classList.add(`interactive-rating-symbol--${state}`);
|
||||
}
|
||||
Loading…
Reference in a new issue