generated from mantinedev/next-pages-template
-
-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from ajnart/dev
Merge dev into master
- Loading branch information
Showing
6 changed files
with
130 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React from 'react'; | ||
import { createStyles, Switch, Group, useMantineColorScheme } from '@mantine/core'; | ||
import { Sun, MoonStars } from 'tabler-icons-react'; | ||
|
||
const useStyles = createStyles((theme) => ({ | ||
root: { | ||
position: 'relative', | ||
'& *': { | ||
cursor: 'pointer', | ||
}, | ||
}, | ||
|
||
icon: { | ||
pointerEvents: 'none', | ||
position: 'absolute', | ||
zIndex: 1, | ||
top: 3, | ||
}, | ||
|
||
iconLight: { | ||
left: 4, | ||
color: theme.white, | ||
}, | ||
|
||
iconDark: { | ||
right: 4, | ||
color: theme.colors.gray[6], | ||
}, | ||
})); | ||
|
||
export function ColorSchemeSwitch() { | ||
const { colorScheme, toggleColorScheme } = useMantineColorScheme(); | ||
const { classes, cx } = useStyles(); | ||
|
||
return ( | ||
<Group> | ||
<div className={classes.root}> | ||
<Sun className={cx(classes.icon, classes.iconLight)} size={18} /> | ||
<MoonStars className={cx(classes.icon, classes.iconDark)} size={18} /> | ||
<Switch checked={colorScheme === 'dark'} onChange={() => toggleColorScheme()} size="md" /> | ||
</div> | ||
Switch to {colorScheme === 'dark' ? 'light' : 'dark'} mode | ||
</Group> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8f71c89
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
myhomepage – ./
myhomepage-ajnart.vercel.app
myhomepage-git-master-ajnart.vercel.app
myhomepage-one.vercel.app