mirror of
https://github.com/Stone-Red-Code/website.git
synced 2026-09-06 23:43:45 +02:00
feat: implement dark mode
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import React from "react"
|
||||
import useTheme from "../../hooks/useTheme"
|
||||
import * as SC from "./styles"
|
||||
|
||||
export function ThemeToggler() {
|
||||
const { theme, toggleTheme } = useTheme()
|
||||
|
||||
return (
|
||||
<SC.ThemeTogglerWrapper onClick={toggleTheme}>
|
||||
<SC.Link>Switch to {theme === "dark" ? "light" : "dark"} mode</SC.Link>
|
||||
</SC.ThemeTogglerWrapper>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { transparentize } from "polished"
|
||||
import styled from "styled-components"
|
||||
|
||||
export const ThemeTogglerWrapper = styled.div``
|
||||
|
||||
export const Link = styled.span`
|
||||
display: inline-block;
|
||||
cursor: pointer;
|
||||
border-bottom: 2px solid transparent;
|
||||
|
||||
&:hover {
|
||||
border-bottom: 2px solid
|
||||
${props => transparentize(0.6, props.theme.sidebar.foreground)};
|
||||
}
|
||||
`
|
||||
Reference in New Issue
Block a user