Skip to content

Commit

Permalink
feat: use rivers header component
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomeYG committed Jan 11, 2024
1 parent aa227f6 commit 63b4be3
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 63 deletions.
172 changes: 118 additions & 54 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
}
},
"dependencies": {
"@chaitin_rivers/multi_river": "^0.0.3",
"@emotion/cache": "^11.11.0",
"@emotion/react": "^11.11.0",
"@emotion/server": "^11.11.0",
Expand Down
8 changes: 0 additions & 8 deletions public/cnzz.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,4 @@ if (
var cnzzTag = document.createElement('script');
cnzzTag.src = 'https://s4.cnzz.com/z.js?id=1281132544&async=1';
document.head.append(cnzzTag);

const DOMAIN = location?.hostname?.includes('dev')
? 'https://dev.rivers.ctopt.cn'
: 'https://rivers.chaitin.cn';
var riverTag = document.createElement('script');
riverTag.src = DOMAIN + '/main-header.js';
document.head.append(riverTag);
document.body.style.paddingTop = '64px';
}
4 changes: 3 additions & 1 deletion src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { usePath } from '@/hooks';
import { useMemo } from 'react';
import { allTools } from '@/utils/tools';
import Head from 'next/head';
import { Header as RiverHeader } from '@chaitin_rivers/multi_river';

const clientSideEmotionCache = createEmotionCache();

Expand All @@ -32,7 +33,7 @@ export default function App({
emotionCache = clientSideEmotionCache,
}: any) {
const { path } = usePath();

const isProduction = process.env.NODE_ENV === 'production';
const currentItem = useMemo(() => {
return allTools.find((item) => item.path === path);
}, [path]);
Expand Down Expand Up @@ -62,6 +63,7 @@ export default function App({
<AnchorContextProvider>
<LikeContextProvider>
<QueryClientProvider client={queryClient}>
{isProduction ? <RiverHeader noSsr={false} /> : null}
<Stack sx={{ width: '1180px', mx: 'auto', height: '100%' }}>
<Header />
<Stack
Expand Down
3 changes: 3 additions & 0 deletions src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ const theme = createTheme({
}
.error:{
color:"#ccc
},
body{
padding-top: ${process.env.NODE_ENV === 'production' ? '64px' : '0'}
}
`,
},
Expand Down

0 comments on commit 63b4be3

Please sign in to comment.