Add dark theme
This commit is contained in:
@@ -49,7 +49,7 @@ const Honkai3rdLayout: React.FC = ({ children }) => {
|
|||||||
width: ['100%', 240],
|
width: ['100%', 240],
|
||||||
borderRightWidth: 1,
|
borderRightWidth: 1,
|
||||||
borderRightStyle: 'solid',
|
borderRightStyle: 'solid',
|
||||||
borderRightColor: 'gray.2',
|
borderRightColor: 'border',
|
||||||
overflowY: 'auto',
|
overflowY: 'auto',
|
||||||
overflowX: 'hidden',
|
overflowX: 'hidden',
|
||||||
display: [hiddenMobileNav ? 'none' : 'block', 'block'],
|
display: [hiddenMobileNav ? 'none' : 'block', 'block'],
|
||||||
|
|||||||
@@ -20,7 +20,9 @@ const Breadcrumb = ({ items }: BreadcrumbProps) => {
|
|||||||
<Flex
|
<Flex
|
||||||
mb={3}
|
mb={3}
|
||||||
sx={{
|
sx={{
|
||||||
backgroundColor: 'gray.2',
|
backgroundColor: 'altBackground',
|
||||||
|
transition:
|
||||||
|
'background-color 300ms ease-in-out, color 300ms ease-in-out',
|
||||||
paddingY: 2,
|
paddingY: 2,
|
||||||
paddingX: 4,
|
paddingX: 4,
|
||||||
borderRadius: 8,
|
borderRadius: 8,
|
||||||
|
|||||||
@@ -82,10 +82,10 @@ const GanttChart = ({
|
|||||||
height: totalRow * 50 + 40,
|
height: totalRow * 50 + 40,
|
||||||
borderBottomStyle: 'solid',
|
borderBottomStyle: 'solid',
|
||||||
borderBottomWidth: 1,
|
borderBottomWidth: 1,
|
||||||
borderBottomColor: 'gray.5',
|
borderBottomColor: 'border',
|
||||||
borderTopStyle: 'solid',
|
borderTopStyle: 'solid',
|
||||||
borderTopWidth: 1,
|
borderTopWidth: 1,
|
||||||
borderTopColor: 'gray.5',
|
borderTopColor: 'border',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{times((index) => {
|
{times((index) => {
|
||||||
@@ -97,7 +97,7 @@ const GanttChart = ({
|
|||||||
height: totalRow * 50 + 40,
|
height: totalRow * 50 + 40,
|
||||||
borderRightStyle: 'solid',
|
borderRightStyle: 'solid',
|
||||||
borderRightWidth: 1,
|
borderRightWidth: 1,
|
||||||
borderRightColor: index % 7 === 6 ? 'gray.5' : 'gray.3',
|
borderRightColor: index % 7 === 6 ? 'border' : 'altBorder',
|
||||||
left: (index + 1) * 40 - 1 - 20,
|
left: (index + 1) * 40 - 1 - 20,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@@ -111,7 +111,7 @@ const GanttChart = ({
|
|||||||
key={`week-start-date-${index}`}
|
key={`week-start-date-${index}`}
|
||||||
sx={{
|
sx={{
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
color: 'gray.5',
|
color: 'border',
|
||||||
zIndex: 21,
|
zIndex: 21,
|
||||||
top: 0,
|
top: 0,
|
||||||
left: weekNumber * 280 - 15,
|
left: weekNumber * 280 - 15,
|
||||||
@@ -235,10 +235,10 @@ const GanttChart = ({
|
|||||||
sx={{
|
sx={{
|
||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
borderColor: 'gray.5',
|
borderColor: 'border',
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
borderStyle: 'solid',
|
borderStyle: 'solid',
|
||||||
backgroundColor: 'white',
|
backgroundColor: 'background',
|
||||||
width: length,
|
width: length,
|
||||||
left: offset,
|
left: offset,
|
||||||
top: (item.row - 1) * 50 + 20,
|
top: (item.row - 1) * 50 + 20,
|
||||||
|
|||||||
@@ -8,9 +8,11 @@ import {
|
|||||||
Box,
|
Box,
|
||||||
Flex,
|
Flex,
|
||||||
IconButton,
|
IconButton,
|
||||||
|
Switch,
|
||||||
} from '@theme-ui/components'
|
} from '@theme-ui/components'
|
||||||
import NextLink from 'next/link'
|
import NextLink from 'next/link'
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
|
import { useColorMode } from 'theme-ui'
|
||||||
import { assetsBucketBaseUrl } from '../../lib/consts'
|
import { assetsBucketBaseUrl } from '../../lib/consts'
|
||||||
import { useTranslation } from '../../lib/i18n'
|
import { useTranslation } from '../../lib/i18n'
|
||||||
import SquareImageBox from '../atoms/SquareImageBox'
|
import SquareImageBox from '../atoms/SquareImageBox'
|
||||||
@@ -23,6 +25,7 @@ const Honkai3rdNavigator = ({ close }: Honkai3rdNavigatorProps) => {
|
|||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { pathname, asPath, query, locale } = router
|
const { pathname, asPath, query, locale } = router
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
const [colorMode, setColorMode] = useColorMode()
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
@@ -83,6 +86,24 @@ const Honkai3rdNavigator = ({ close }: Honkai3rdNavigatorProps) => {
|
|||||||
<Icon path={mdiMenuSwap} size='20px' />
|
<Icon path={mdiMenuSwap} size='20px' />
|
||||||
</NavLink>
|
</NavLink>
|
||||||
</NextLink>
|
</NextLink>
|
||||||
|
|
||||||
|
<Box>
|
||||||
|
<Switch
|
||||||
|
checked={colorMode === 'dark'}
|
||||||
|
onChange={(event) => {
|
||||||
|
setColorMode(event.target.checked ? 'dark' : 'default')
|
||||||
|
}}
|
||||||
|
sx={{
|
||||||
|
'input ~ &': {
|
||||||
|
backgroundColor: 'muted',
|
||||||
|
},
|
||||||
|
'input:checked ~ &': {
|
||||||
|
backgroundColor: 'primary',
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
label={colorMode === 'default' ? '☀️' : '🌙'}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+39
-9
@@ -3,6 +3,10 @@ import { colors } from './colors'
|
|||||||
|
|
||||||
export const theme: Theme = {
|
export const theme: Theme = {
|
||||||
breakpoints: ['576px', '768px', '992px', '1200px'],
|
breakpoints: ['576px', '768px', '992px', '1200px'],
|
||||||
|
config: {
|
||||||
|
initialColorModeName: 'light',
|
||||||
|
printColorModeName: 'light',
|
||||||
|
},
|
||||||
colors: {
|
colors: {
|
||||||
...colors,
|
...colors,
|
||||||
white: '#fff',
|
white: '#fff',
|
||||||
@@ -11,7 +15,7 @@ export const theme: Theme = {
|
|||||||
background: '#fff',
|
background: '#fff',
|
||||||
primary: '#007bff',
|
primary: '#007bff',
|
||||||
secondary: '#6c757d',
|
secondary: '#6c757d',
|
||||||
muted: '#dee2e6',
|
muted: colors.gray[5],
|
||||||
success: '#28a745',
|
success: '#28a745',
|
||||||
info: '#17a2b8',
|
info: '#17a2b8',
|
||||||
warning: '#ffc107',
|
warning: '#ffc107',
|
||||||
@@ -20,6 +24,32 @@ export const theme: Theme = {
|
|||||||
dark: '#343a40',
|
dark: '#343a40',
|
||||||
textMuted: '#6c757d',
|
textMuted: '#6c757d',
|
||||||
transparent: 'transparent',
|
transparent: 'transparent',
|
||||||
|
border: colors.gray[5],
|
||||||
|
altBackground: colors.gray[2],
|
||||||
|
altBorder: colors.gray[3],
|
||||||
|
modes: {
|
||||||
|
dark: {
|
||||||
|
...colors,
|
||||||
|
white: '#fff',
|
||||||
|
black: '#000',
|
||||||
|
text: '#dedede',
|
||||||
|
background: '#202124',
|
||||||
|
primary: colors.blue[4],
|
||||||
|
secondary: '#6c757d',
|
||||||
|
muted: '#dee2e6',
|
||||||
|
success: '#28a745',
|
||||||
|
info: '#17a2b8',
|
||||||
|
warning: '#ffc107',
|
||||||
|
danger: '#dc3545',
|
||||||
|
light: '#f8f9fa',
|
||||||
|
dark: '#343a40',
|
||||||
|
textMuted: '#6c757d',
|
||||||
|
transparent: 'transparent',
|
||||||
|
border: colors.gray[7],
|
||||||
|
altBorder: colors.gray[8],
|
||||||
|
altBackground: colors.gray[8],
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
space: ['0rem', '0.25rem', '0.5rem', '1rem', '1.5rem', '3rem'],
|
space: ['0rem', '0.25rem', '0.5rem', '1rem', '1.5rem', '3rem'],
|
||||||
fonts: {
|
fonts: {
|
||||||
@@ -53,8 +83,8 @@ export const theme: Theme = {
|
|||||||
display: 300,
|
display: 300,
|
||||||
},
|
},
|
||||||
borders: {
|
borders: {
|
||||||
default: `1px solid ${colors.gray[5]}`,
|
default: '1px solid var(--theme-ui-colors-border)',
|
||||||
primary: `1px solid #007bff`,
|
primary: `1px solid var(--theme-)`,
|
||||||
},
|
},
|
||||||
lineHeights: {
|
lineHeights: {
|
||||||
body: 1.6,
|
body: 1.6,
|
||||||
@@ -96,7 +126,7 @@ export const theme: Theme = {
|
|||||||
borderColor: 'primary',
|
borderColor: 'primary',
|
||||||
borderStyle: 'solid',
|
borderStyle: 'solid',
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
bg: 'background',
|
bg: 'transparent',
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
textDecoration: 'none',
|
textDecoration: 'none',
|
||||||
borderRadius: 'default',
|
borderRadius: 'default',
|
||||||
@@ -192,24 +222,23 @@ export const theme: Theme = {
|
|||||||
table: {
|
table: {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
marginBottom: 3,
|
marginBottom: 3,
|
||||||
color: 'gray.9',
|
|
||||||
borderCollapse: 'collapse',
|
borderCollapse: 'collapse',
|
||||||
},
|
},
|
||||||
th: {
|
th: {
|
||||||
verticalAlign: 'bottom',
|
verticalAlign: 'bottom',
|
||||||
borderTopWidth: 2,
|
borderTopWidth: 2,
|
||||||
borderTopStyle: 'solid',
|
borderTopStyle: 'solid',
|
||||||
borderTopColor: 'gray.3',
|
borderTopColor: 'default',
|
||||||
borderBottomWidth: 2,
|
borderBottomWidth: 2,
|
||||||
borderBottomStyle: 'solid',
|
borderBottomStyle: 'solid',
|
||||||
borderBottomColor: 'gray.3',
|
borderBottomColor: 'default',
|
||||||
padding: '.75rem',
|
padding: '.75rem',
|
||||||
textAlign: 'inherit',
|
textAlign: 'inherit',
|
||||||
},
|
},
|
||||||
td: {
|
td: {
|
||||||
borderBottomWidth: 2,
|
borderBottomWidth: 2,
|
||||||
borderBottomStyle: 'solid',
|
borderBottomStyle: 'solid',
|
||||||
borderBottomColor: 'gray.3',
|
borderBottomColor: 'default',
|
||||||
verticalAlign: 'top',
|
verticalAlign: 'top',
|
||||||
padding: '.75rem',
|
padding: '.75rem',
|
||||||
},
|
},
|
||||||
@@ -224,6 +253,7 @@ export const theme: Theme = {
|
|||||||
cards: {
|
cards: {
|
||||||
primary: {
|
primary: {
|
||||||
border: 'default',
|
border: 'default',
|
||||||
|
borderColor: 'border',
|
||||||
borderRadius: 'default',
|
borderRadius: 'default',
|
||||||
|
|
||||||
transition:
|
transition:
|
||||||
@@ -235,7 +265,7 @@ export const theme: Theme = {
|
|||||||
stigmata: {
|
stigmata: {
|
||||||
padding: 2,
|
padding: 2,
|
||||||
borderRadius: 4,
|
borderRadius: 4,
|
||||||
borderColor: 'gray.3',
|
borderColor: 'default',
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
borderStyle: 'solid',
|
borderStyle: 'solid',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -5,3 +5,7 @@ body {
|
|||||||
#__next {
|
#__next {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
transition: background-color 300ms ease-in-out, color 300ms ease-in-out;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user