Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor mode.ts to use a single persistent store #9

Closed
wants to merge 1 commit into from

Conversation

ollema
Copy link
Collaborator

@ollema ollema commented Oct 26, 2023

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Oct 26, 2023

⚠️ No Changeset found

Latest commit: 97ee5c7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ollema
Copy link
Collaborator Author

ollema commented Oct 26, 2023

passing all tests but I want to test with some actual apps as well

I have not created a changeset, the API remains largely unchanged except for the mode store - it now has three possible values (dark, light, system) just like the solution used in shadcn/ui instead of two (dark, light).

so if you like this change, not sure if this should be a patch or a minor change

@ollema
Copy link
Collaborator Author

ollema commented Oct 26, 2023

also, note that:

/** Automatically set the visible light/dark updates on change */
 export function autoModeWatcher(): void {
 	const mql = window.matchMedia('(prefers-color-scheme: dark)');
 	function setMode(value: boolean) {
 		const htmlEl = document.documentElement;
 		const classDark = 'dark';
 		if (value === true) {
 			htmlEl.classList.remove(classDark);
 			htmlEl.style.colorScheme = 'light';
 		} else {
 			htmlEl.classList.add(classDark);
 			htmlEl.style.colorScheme = 'dark';
 		}
 	}
 	setMode(mql.matches);
 	mql.onchange = () => {
 		setMode(mql.matches);
 	};
 }

was removed. but that code was unused, both here and actually on the skeleton.dev page as well.

not sure if that was intentional. if we want auto watching functionality, I could work on that as well (to add this back and make the necessary changes to make it work again)

@ollema
Copy link
Collaborator Author

ollema commented Oct 26, 2023

Closed in favor of #10

@ollema ollema closed this Oct 26, 2023
@ollema ollema deleted the refactor-mode branch November 8, 2023 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant