example主题支持fullwidth

This commit is contained in:
tangly1024
2023-12-30 17:24:03 +08:00
parent b15d5f7c2c
commit 0477836a68
4 changed files with 13 additions and 10 deletions

View File

@@ -12,7 +12,7 @@ const GlobalContext = createContext()
* @constructor
*/
export function GlobalContextProvider(props) {
const { children, siteInfo, categoryOptions, tagOptions, NOTION_CONFIG } = props
const { post, children, siteInfo, categoryOptions, tagOptions, NOTION_CONFIG } = props
const router = useRouter()
const [lang, updateLang] = useState(NOTION_CONFIG?.LANG || LANG) // 默认语言
const [locale, updateLocale] = useState(generateLocaleDict(NOTION_CONFIG?.LANG || LANG)) // 默认语言
@@ -20,6 +20,9 @@ export function GlobalContextProvider(props) {
const [isDarkMode, updateDarkMode] = useState(NOTION_CONFIG?.APPEARANCE || APPEARANCE === 'dark') // 默认深色模式
const [onLoading, setOnLoading] = useState(false) // 抓取文章数据
// 是否全屏
const fullWidth = post?.fullWidth ?? false
// 切换主题
function switchTheme() {
const currentIndex = THEMES.indexOf(theme)
@@ -82,6 +85,7 @@ export function GlobalContextProvider(props) {
return (
<GlobalContext.Provider value={{
fullWidth,
NOTION_CONFIG,
toggleDarkMode,
onLoading,