浏览代码

chore: update banner config

走鹃 3 年之前
父节点
当前提交
e62ef153fc
共有 2 个文件被更改,包括 6 次插入4 次删除
  1. 3 1
      gatsby-node.js
  2. 3 3
      src/components/layout.js

+ 3 - 1
gatsby-node.js

@@ -112,6 +112,7 @@ exports.onCreateWebpackConfig = ({ stage, rules, loaders, plugins, actions }) =>
         resolve: {
         resolve: {
             alias: {
             alias: {
                 'semi-site-header': process.env.SEMI_SITE_HEADER || '@douyinfe/semi-site-header',
                 'semi-site-header': process.env.SEMI_SITE_HEADER || '@douyinfe/semi-site-header',
+                'semi-site-banner': process.env.SEMI_SITE_BANNER || '@douyinfe/semi-site-banner',
                 '@douyinfe/semi-ui': resolve('packages/semi-ui'),
                 '@douyinfe/semi-ui': resolve('packages/semi-ui'),
                 '@douyinfe/semi-foundation': resolve('packages/semi-foundation'),
                 '@douyinfe/semi-foundation': resolve('packages/semi-foundation'),
                 '@douyinfe/semi-icons': resolve('packages/semi-icons/src/'),
                 '@douyinfe/semi-icons': resolve('packages/semi-icons/src/'),
@@ -179,7 +180,8 @@ exports.onCreateWebpackConfig = ({ stage, rules, loaders, plugins, actions }) =>
         plugins: [plugins.extractText(),plugins.define({
         plugins: [plugins.extractText(),plugins.define({
             "THEME_SWITCHER_URL":JSON.stringify(process.env['THEME_SWITCHER_URL']),
             "THEME_SWITCHER_URL":JSON.stringify(process.env['THEME_SWITCHER_URL']),
             "DSM_URL":JSON.stringify(process.env['DSM_URL']),
             "DSM_URL":JSON.stringify(process.env['DSM_URL']),
-            'process.env.SEMI_SITE_HEADER':JSON.stringify(process.env.SEMI_SITE_HEADER)
+            'process.env.SEMI_SITE_HEADER':JSON.stringify(process.env.SEMI_SITE_HEADER),
+            'process.env.SEMI_SITE_BANNER':JSON.stringify(process.env.SEMI_SITE_BANNER),
         })],
         })],
     });
     });
 };
 };

+ 3 - 3
src/components/layout.js

@@ -21,8 +21,8 @@ import { IntlProvider } from 'react-intl';
 import { LocaleProvider } from '@douyinfe/semi-ui';
 import { LocaleProvider } from '@douyinfe/semi-ui';
 import semiZhCN from '@douyinfe/semi-ui/locale/source/zh_CN';
 import semiZhCN from '@douyinfe/semi-ui/locale/source/zh_CN';
 import semiEnUS from '@douyinfe/semi-ui/locale/source/en_US';
 import semiEnUS from '@douyinfe/semi-ui/locale/source/en_US';
-import SemiSiteBanner from '@douyinfe/semi-site-banner';
-import '@douyinfe/semi-site-banner/dist/index.css';
+import SemiSiteBanner from 'semi-site-banner';
+import 'semi-site-banner/dist/index.css';
 
 
 import appLocaleCN from '../locale/zh-CN';
 import appLocaleCN from '../locale/zh-CN';
 import appLocaleUS from '../locale/en-US';
 import appLocaleUS from '../locale/en-US';
@@ -143,7 +143,7 @@ const AppLayout = ({ type, location, children }) => {
         <>
         <>
             <IntlProvider locale={locale} messages={messages}>
             <IntlProvider locale={locale} messages={messages}>
                 <LocaleProvider locale={semiLocaleSource}>
                 <LocaleProvider locale={semiLocaleSource}>
-                    <div style={{position: 'fixed', width: '100%', top: 0, zIndex: 999}}>
+                    <div style={{ position: 'fixed', width: '100%', top: 0, zIndex: 999 }}>
                         <SemiSiteBanner ref={bannerRef} type="black" style={{ height: 32 }} icon={null} />
                         <SemiSiteBanner ref={bannerRef} type="black" style={{ height: 32 }} icon={null} />
                         {/* ssr, can't use location directly, get location from layout and pass to children */}
                         {/* ssr, can't use location directly, get location from layout and pass to children */}
                         <Header style={headerStyle} location={location} localeCode={locale} />
                         <Header style={headerStyle} location={location} localeCode={locale} />