Skip to content

The props attribute, enableSystem, and disableTransitionOnChange are accepted but not applied. Either implement their handling (e.g., toggling classes or system theme detection) or remove them to keep the API surface clean. #3

@omoladeodetara

Description

@omoladeodetara

The props attribute, enableSystem, and disableTransitionOnChange are accepted but not applied. Either implement their handling (e.g., toggling classes or system theme detection) or remove them to keep the API surface clean.

    const root = document.documentElement;
    
    // Handle disableTransitionOnChange
    if (disableTransitionOnChange) {
      root.classList.add('disable-transition');
      setTimeout(() => {
        root.classList.remove('disable-transition');
      }, 0);
    }
    
    // Handle enableSystem
    if (enableSystem) {
      const systemTheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
      root.classList.remove('dark', 'light');
      root.classList.add(systemTheme);
    } else {
      // Set default theme
      root.classList.remove('dark', 'light');
      root.classList.add(defaultTheme);
    }
  }, [defaultTheme, enableSystem, disableTransitionOnChange]);

Originally posted by @Copilot in omoladeodetara#1 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions