1.1.18-beta.1 • Published 3 years ago

@antv/gatsby-theme-antv v1.1.18-beta.1

Weekly downloads
788
License
MIT
Repository
github
Last release
3 years ago

Gatsby Theme for AntV ⚛

✨ Polished Gatsby theme for documentation site.

npm.io NPM downloads CI status Dependency Status devDependencies Status prettier code style

Features

  • ⚛ Prerendered static site
  • 🌎 Internationalization support by i18next
  • 📝 Markdown-based documentation and menus
  • 🎬 Examples with live playground
  • 🏗 Unified Theme and Layout
  • 🆙 Easy customized header nav
  • 🧩 Built-in home page components

Websites using it

Usage

Create a Gatsby site from gatsby-starter-theme-antv.

$ yarn global add gatsby-cli // or npm install gatsby-cli -g
$ gatsby new mysite https://github.com/antvis/gatsby-starter-theme-antv

Start developing.

$ cd mysite
$ yarn start

✨ AntV 站点 接入方式额外功能

gatsby-config.js

// gatsby-config.js
const { repository } = require('./package.json');

module.exports = {
  plugins: [
    {
      resolve: `@antv/gatsby-theme-antv`,
      options: {
        // pagesPath: './site/pages',
        GATrackingId: `UA-XXXXXXXXX-X`,
        pathPrefix: '/g2',
        // antd 主题:https://github.com/ant-design/ant-design/blob/master/components/style/themes/default.less
        theme: {
          'primary-color': '#873bf4',
        },
        pwa: true, // 是否开启 gatsby-plugin-offline
        cname: true, // 是否自动从 siteUrl 中提取 CNAME 文件
        codeSplit: true, // 是否开启 gatsby 按路由的代码分割,默认为 false
      },
    },
  ],
  siteMetadata: {
    title: `AntV`,
    description: `Ant Visualization solution home page`,
    githubUrl: repository.url,
    logoUrl: '', // 自定义 logo
    navs: [], // 用于定义顶部菜单
    docs: [], // 用于定义文档页面的二级分类菜单
    examples: [], // 用于定义演示页面的二级菜单,属性见下方
    showSearch: true, // 是否展示搜索框
    showChinaMirror: true, // 是否展示国内镜像链接
    showLanguageSwitcher: true, // 用于定义是否展示语言切换
    showAntVProductsCard: true, // 是否展示 AntV 系列产品的卡片链接
    showGithubCorner: true, // 是否展示角落的 GitHub 图标
    showChartResize: true, // 是否在demo页展示图表视图切换
    themeSwitcher: 'g2', // 是否在demo页展示主题切换, 取值为'g2' | 'g2plot' 如果不设置则不展示主题切换工具
    showAPIDoc: true, // 是否在demo页展示API文档
    showExampleDemoTitle: true, // 有截图的是否要展示 title 名称
    playground: {
      container: '<canvas id="container" />', // 定义演示的渲染节点,默认 <div id="container" />
      playgroundDidMount: 'console.log("playgroundDidMount");',
      playgroundWillUnmount: 'console.log("playgroundWillUnmount");',
      devDependencies: {
        // 如果 example 是 ts 文件,需要加上 ts 依赖,才能在 codesandbox 正确运行
        typescript: 'latest',
      },
    },
    versions: [
      {
        '1.x': 'https://1x.ant.design',
        '2.x': 'https://2x.ant.design',
        '3.x': 'https://ant.design',
        '4.x': 'https://next.ant.design',
      },
    ],
    redirects: [
      {
        from: /\/old-url/,
        to: '/new-url', // 不指定 to 时直接跳转到 https://antv-2018.alipay.com/***
      },
    ],
  },
};

Components

import SEO from '@antv/gatsby-theme-antv/site/components/Seo';
import Header from '@antv/gatsby-theme-antv/site/components/Header';
import Footer from '@antv/gatsby-theme-antv/site/components/Footer';
import Banner from '@antv/gatsby-theme-antv/site/components/Banner';
import Features from '@antv/gatsby-theme-antv/site/components/Features';
import Applications from '@antv/gatsby-theme-antv/site/components/Applications';
import Companies from '@antv/gatsby-theme-antv/site/components/Companies';

// @antv/gatsby-theme-antv/components/Header for commonjs version

const Layout = () => {
  const features = [
    {
      icon:
        'https://gw.alipayobjects.com/zos/basement_prod/5dbaf094-c064-4a0d-9968-76020b9f1510.svg',
      title: 'xxxxx',
      description: 'xxxxxxxxxxxxxxxxxxxxxxxxx',
    },
    {
      icon:
        'https://gw.alipayobjects.com/zos/basement_prod/0a0371ab-6bed-41ad-a99b-87a5044ba11b.svg',
      title: 'xxxxx',
      description: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    },
    {
      icon:
        'https://gw.alipayobjects.com/zos/basement_prod/716d0bc0-e311-4b28-b79f-afdd16e8148e.svg',
      title: 'xxxxx',
      description: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    },
  ];
  const cases = [
    {
      logo:
        'https://gw.alipayobjects.com/mdn/rms_23b644/afts/img/A*2Ij9T76DyCcAAAAAAAAAAABkARQnAQ',
      title: '灯塔专业版',
      description:
        '深入金融的基金深入金融的基金深入金融的基金深入金融的基金深入金融的基金深入金融的基金深入金融的基金深入金融的基金深入金融的基金深入金融的基金深入金融的基金',
      link: '#',
      image:
        'https://gw.alipayobjects.com/mdn/rms_23b644/afts/img/A*oCd7Sq3N-QEAAAAAAAAAAABkARQnAQ',
    },
    // ...
  ];
  const companies = [
    {
      name: '公司1',
      image:
        'https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*Z1NnQ6L4xCIAAAAAAAAAAABkARQnAQ',
    },
    {
      name: '公司2',
      image:
        'https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*6u3hTpsd7h8AAAAAAAAAAABkARQnAQ',
    },
    // ...
  ];
  const notifications = [
    {
      type: '测试',
      title: 'G6 3.2 全新上线!',
      date: '2019.12.04',
      link: '#',
    },
  ];

  const downloadButton = {
    text: '下载使用',
    link: 'https://antv.alipay.com/zh-cn/index.html',
  };

  return (
    <>
      <SEO title="蚂蚁数据可视化" lang="zh" />
      <Header
        subTitle="子产品名"
        logo={{
          link: 'https://antv.alipay.com',
          img: <img src="url" />,
        }}
        githubUrl="https://github.com/antvis/g2"
        // docs={[]}
        showSearch={false}
        showGithubCorner={false}
        showLanguageSwitcher={false}
        onLanguageChange={(language) => {
          console.log(language);
        }}
        defaultLanguage="zh"
      />
      <Footer
      // columns={[]}
      // bottom={<div>powered by antv</div>}
      />

      <Banner
        coverImage={<svg></svg>} // 右侧 banner svg 内容
        title="主页标题"
        description="主页描述内容描述内容描述内容描述内容"
        buttonText="按钮文字"
        buttonHref={'#按钮链接路径'}
        notifications={notifications} // 可传 1-2 个内容,若不传则显示 2 个默认通知
        style={{}}
        className="Banner 的 className"
        video="视频按钮点开后视频的链接,不传则不会出现视频按钮"
        githubStarLink="Github Star 链接,不传则不会出现 GitHub Start 按钮"
        downloadButton={downloadButton} // 不传则不会出现下载按钮
      />
      <Features
        title="优势页面名称" // 可不传
        features={features} // 必传
        style={{}}
        className="Features 的 className"
      />
      <Cases cases={cases} style={{}} className="Cases 的 className" />
      <Companies
        title="公司页面名称" // 必传
        companies={companies} // 必传
        style={{}}
        className="Companies 的 className"
      />
    </>
  );
};

Develop

yarn install
yarn start

Visit https://localhost:8000 to preview.

Publish to npm

cd @antv/gatsby-theme-antv
npm run release

Deploy

npm run deploy

Set envoironment variable GATSBY_PATH_PREFIX to / in deploy service like netlify to preview pathPrefix site in root domain.

Add Dependency

cd @antv/gatsby-theme-antv
yarn add shallowequal

or

yarn workspace @antv/gatsby-theme-antv shallowequal

Related libraries

1.1.18-beta.1

3 years ago

1.1.18-beta.0

3 years ago

1.1.17-beta.0

3 years ago

1.1.16

4 years ago

1.1.17

3 years ago

1.1.15

4 years ago

1.1.14

4 years ago

1.1.13

4 years ago

1.1.9

4 years ago

1.1.12

4 years ago

1.1.11

4 years ago

1.1.10

4 years ago

1.1.8

4 years ago

1.1.6-beta.7

4 years ago

1.1.7

4 years ago

1.1.6-beta.6

4 years ago

1.1.6-beta.2

4 years ago

1.1.6-beta.3

4 years ago

1.1.6-beta.4

4 years ago

1.1.6-beta.5

4 years ago

1.1.6-beta.1

4 years ago

1.1.6-beta.0

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.8-alpha.0

4 years ago

1.0.8-beta.3

4 years ago

1.0.8-beta.2

4 years ago

1.0.8-beta.1

4 years ago

1.0.8-beta.0

4 years ago

1.0.8

4 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

1.0.0-beta.19

5 years ago

1.0.0-beta.18

5 years ago

1.1.0-alpha.2

5 years ago

1.0.0-beta.17

5 years ago

1.0.0-beta.16

5 years ago

1.1.0-alpha.1

5 years ago

1.1.0-alpha.0

5 years ago

1.0.0-beta.15

5 years ago

1.0.0-beta.14

5 years ago

1.0.0-beta.13

5 years ago

1.0.0-beta.12

5 years ago

1.0.0-beta.11

5 years ago

1.1.0-beta.0

5 years ago

1.0.0-beta.10

5 years ago

1.0.0-beta.9

5 years ago

1.0.0-beta.8

5 years ago

0.11.7

5 years ago

1.0.0-beta.5

5 years ago

1.0.0-beta.4

5 years ago

1.0.0-beta.3

5 years ago

1.0.0-beta.1

5 years ago

0.10.72

5 years ago

0.11.6

5 years ago

0.11.5

5 years ago

0.11.4

5 years ago

1.0.0-beta.0

5 years ago

0.11.3

5 years ago

0.11.2

5 years ago

0.11.1

5 years ago

0.11.0

5 years ago

0.10.71

5 years ago

0.10.70

5 years ago

0.10.69

5 years ago

0.10.68

5 years ago

0.10.67

5 years ago

0.10.66

5 years ago

0.10.65

5 years ago

0.10.64

5 years ago

0.10.63

5 years ago

0.10.62

5 years ago

0.10.61

5 years ago

0.10.60

5 years ago

0.10.58

5 years ago

0.10.59

5 years ago

0.10.57

5 years ago

0.10.56

5 years ago

0.10.55

5 years ago

0.10.54

5 years ago

0.10.53

5 years ago

0.10.52

5 years ago

0.10.51

5 years ago

0.10.50

5 years ago

0.10.49

5 years ago

0.10.48

5 years ago

0.10.47

5 years ago

0.10.46

5 years ago

0.10.44

5 years ago

0.10.45

5 years ago

0.10.43

5 years ago

0.10.41

6 years ago

0.10.42

6 years ago

0.10.40

6 years ago

0.10.39

6 years ago

0.10.38

6 years ago

0.10.37

6 years ago

0.10.36

6 years ago

0.10.34

6 years ago

0.10.35

6 years ago

0.10.33

6 years ago

0.10.32

6 years ago

0.10.31

6 years ago

0.10.30

6 years ago

0.10.29

6 years ago

0.10.28

6 years ago

0.10.27

6 years ago

0.10.26

6 years ago

0.10.25

6 years ago

0.10.24

6 years ago

0.10.23

6 years ago

0.10.22

6 years ago

0.10.21

6 years ago

0.10.20

6 years ago

0.10.19

6 years ago

0.10.18

6 years ago

0.10.17

6 years ago

0.10.16

6 years ago

0.10.15

6 years ago

0.10.14

6 years ago

0.10.13

6 years ago

0.10.12

6 years ago

0.10.11

6 years ago

0.10.10

6 years ago

0.10.9

6 years ago

0.10.8

6 years ago

0.10.7

6 years ago

0.10.6

6 years ago

0.10.5

6 years ago

0.10.4

6 years ago

0.10.3

6 years ago

0.10.1

6 years ago

0.10.2

6 years ago

0.10.0

6 years ago

0.9.108

6 years ago

0.9.106

6 years ago

0.9.102

6 years ago

0.9.101

6 years ago

0.9.100

6 years ago

0.9.99

6 years ago

0.9.98

6 years ago

0.9.97

6 years ago

0.9.95

6 years ago

0.9.94

6 years ago

0.9.93

6 years ago

0.9.92

6 years ago

0.9.91

6 years ago

0.9.90

6 years ago

0.9.89

6 years ago

0.9.88

6 years ago

0.9.87

6 years ago

0.9.86

6 years ago

0.9.85

6 years ago

0.9.84

6 years ago

0.9.83

6 years ago

0.9.82

6 years ago

0.9.81

6 years ago

0.9.80

6 years ago

0.9.78

6 years ago

0.9.79

6 years ago

0.9.77

6 years ago

0.9.76

6 years ago

0.9.75

6 years ago

0.9.74

6 years ago

0.9.73

6 years ago

0.9.72

6 years ago

0.9.71

6 years ago

0.9.70

6 years ago

0.9.69

6 years ago

0.9.68

6 years ago

0.9.67

6 years ago

0.9.66

6 years ago

0.9.65

6 years ago

0.9.64

6 years ago

0.9.63

6 years ago

0.9.62

6 years ago

0.9.61

6 years ago

0.9.60

6 years ago

0.9.59

6 years ago

0.9.58

6 years ago

0.9.57

6 years ago

0.9.56

6 years ago

0.9.55

6 years ago

0.9.54

6 years ago

0.9.53

6 years ago

0.9.52

6 years ago

0.9.51

6 years ago

0.9.50

6 years ago

0.9.49

6 years ago

0.9.48

6 years ago

0.9.47

6 years ago

0.9.46

6 years ago

0.9.45

6 years ago

0.9.44

6 years ago

0.9.43

6 years ago

0.9.42

6 years ago

0.9.41

6 years ago

0.9.40

6 years ago

0.9.35

6 years ago

0.9.34

6 years ago

0.9.33

6 years ago

0.9.32

6 years ago

0.9.31

6 years ago

0.9.30

6 years ago

0.9.29

6 years ago

0.9.28

6 years ago

0.9.27

6 years ago

0.9.26

6 years ago

0.9.25

6 years ago

0.9.24

6 years ago

0.9.23

6 years ago

0.9.22

6 years ago

0.9.21

6 years ago

0.9.19

6 years ago

0.9.18

6 years ago

0.9.17

6 years ago

0.9.16

6 years ago

0.9.15

6 years ago

0.9.14

6 years ago

0.9.13

6 years ago

0.9.12

6 years ago

0.9.11

6 years ago

0.9.10

6 years ago

0.9.9

6 years ago

0.9.8

6 years ago

0.9.7

6 years ago

0.9.5

6 years ago

0.9.4

6 years ago

0.9.3

6 years ago

0.9.2

6 years ago

0.9.1

6 years ago

0.9.0

6 years ago

0.8.3

6 years ago

0.8.2

6 years ago

0.8.1

6 years ago

0.8.0

6 years ago

0.7.7

6 years ago

0.7.6

6 years ago

0.7.5

6 years ago

0.7.4

6 years ago

0.7.3

6 years ago

0.7.2

6 years ago

0.7.1

6 years ago

0.7.0

6 years ago

0.6.2

6 years ago

0.6.1

6 years ago

0.6.0

6 years ago

0.5.6

6 years ago

0.5.4

6 years ago

0.5.3

6 years ago

0.5.2

6 years ago

0.5.1

6 years ago

0.5.0

6 years ago

0.4.0

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.7

6 years ago

0.2.6

6 years ago

0.2.5

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago