1.1.18-beta.1 • Published 2 years ago

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

Weekly downloads
788
License
MIT
Repository
github
Last release
2 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

2 years ago

1.1.18-beta.0

2 years ago

1.1.17-beta.0

2 years ago

1.1.16

2 years ago

1.1.17

2 years ago

1.1.15

2 years ago

1.1.14

2 years ago

1.1.13

2 years ago

1.1.9

3 years ago

1.1.12

3 years ago

1.1.11

3 years ago

1.1.10

3 years ago

1.1.8

3 years ago

1.1.6-beta.7

3 years ago

1.1.7

3 years ago

1.1.6-beta.6

3 years ago

1.1.6-beta.2

3 years ago

1.1.6-beta.3

3 years ago

1.1.6-beta.4

3 years ago

1.1.6-beta.5

3 years ago

1.1.6-beta.1

3 years ago

1.1.6-beta.0

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.8-alpha.0

3 years ago

1.0.8-beta.3

3 years ago

1.0.8-beta.2

3 years ago

1.0.8-beta.1

3 years ago

1.0.8-beta.0

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

1.0.0-beta.19

3 years ago

1.0.0-beta.18

3 years ago

1.1.0-alpha.2

3 years ago

1.0.0-beta.17

3 years ago

1.0.0-beta.16

3 years ago

1.1.0-alpha.1

3 years ago

1.1.0-alpha.0

3 years ago

1.0.0-beta.15

3 years ago

1.0.0-beta.14

3 years ago

1.0.0-beta.13

3 years ago

1.0.0-beta.12

3 years ago

1.0.0-beta.11

3 years ago

1.1.0-beta.0

3 years ago

1.0.0-beta.10

3 years ago

1.0.0-beta.9

4 years ago

1.0.0-beta.8

4 years ago

0.11.7

4 years ago

1.0.0-beta.5

4 years ago

1.0.0-beta.4

4 years ago

1.0.0-beta.3

4 years ago

1.0.0-beta.1

4 years ago

0.10.72

4 years ago

0.11.6

4 years ago

0.11.5

4 years ago

0.11.4

4 years ago

1.0.0-beta.0

4 years ago

0.11.3

4 years ago

0.11.2

4 years ago

0.11.1

4 years ago

0.11.0

4 years ago

0.10.71

4 years ago

0.10.70

4 years ago

0.10.69

4 years ago

0.10.68

4 years ago

0.10.67

4 years ago

0.10.66

4 years ago

0.10.65

4 years ago

0.10.64

4 years ago

0.10.63

4 years ago

0.10.62

4 years ago

0.10.61

4 years ago

0.10.60

4 years ago

0.10.58

4 years ago

0.10.59

4 years ago

0.10.57

4 years ago

0.10.56

4 years ago

0.10.55

4 years ago

0.10.54

4 years ago

0.10.53

4 years ago

0.10.52

4 years ago

0.10.51

4 years ago

0.10.50

4 years ago

0.10.49

4 years ago

0.10.48

4 years ago

0.10.47

4 years ago

0.10.46

4 years ago

0.10.44

4 years ago

0.10.45

4 years ago

0.10.43

4 years ago

0.10.41

4 years ago

0.10.42

4 years ago

0.10.40

4 years ago

0.10.39

4 years ago

0.10.38

4 years ago

0.10.37

4 years ago

0.10.36

4 years ago

0.10.34

4 years ago

0.10.35

4 years ago

0.10.33

4 years ago

0.10.32

4 years ago

0.10.31

4 years ago

0.10.30

4 years ago

0.10.29

4 years ago

0.10.28

4 years ago

0.10.27

4 years ago

0.10.26

4 years ago

0.10.25

4 years ago

0.10.24

4 years ago

0.10.23

4 years ago

0.10.22

4 years ago

0.10.21

4 years ago

0.10.20

4 years ago

0.10.19

4 years ago

0.10.18

4 years ago

0.10.17

4 years ago

0.10.16

4 years ago

0.10.15

4 years ago

0.10.14

4 years ago

0.10.13

4 years ago

0.10.12

4 years ago

0.10.11

4 years ago

0.10.10

4 years ago

0.10.9

4 years ago

0.10.8

4 years ago

0.10.7

4 years ago

0.10.6

4 years ago

0.10.5

4 years ago

0.10.4

4 years ago

0.10.3

4 years ago

0.10.1

4 years ago

0.10.2

4 years ago

0.10.0

4 years ago

0.9.108

4 years ago

0.9.106

4 years ago

0.9.102

4 years ago

0.9.101

4 years ago

0.9.100

4 years ago

0.9.99

4 years ago

0.9.98

4 years ago

0.9.97

4 years ago

0.9.95

4 years ago

0.9.94

4 years ago

0.9.93

4 years ago

0.9.92

4 years ago

0.9.91

4 years ago

0.9.90

4 years ago

0.9.89

4 years ago

0.9.88

4 years ago

0.9.87

4 years ago

0.9.86

4 years ago

0.9.85

4 years ago

0.9.84

4 years ago

0.9.83

4 years ago

0.9.82

4 years ago

0.9.81

4 years ago

0.9.80

4 years ago

0.9.78

4 years ago

0.9.79

4 years ago

0.9.77

4 years ago

0.9.76

4 years ago

0.9.75

4 years ago

0.9.74

4 years ago

0.9.73

4 years ago

0.9.72

4 years ago

0.9.71

4 years ago

0.9.70

4 years ago

0.9.69

4 years ago

0.9.68

4 years ago

0.9.67

4 years ago

0.9.66

4 years ago

0.9.65

4 years ago

0.9.64

4 years ago

0.9.63

4 years ago

0.9.62

4 years ago

0.9.61

4 years ago

0.9.60

4 years ago

0.9.59

4 years ago

0.9.58

4 years ago

0.9.57

4 years ago

0.9.56

4 years ago

0.9.55

4 years ago

0.9.54

4 years ago

0.9.53

4 years ago

0.9.52

4 years ago

0.9.51

4 years ago

0.9.50

4 years ago

0.9.49

4 years ago

0.9.48

4 years ago

0.9.47

4 years ago

0.9.46

4 years ago

0.9.45

4 years ago

0.9.44

4 years ago

0.9.43

4 years ago

0.9.42

4 years ago

0.9.41

4 years ago

0.9.40

4 years ago

0.9.35

4 years ago

0.9.34

4 years ago

0.9.33

4 years ago

0.9.32

4 years ago

0.9.31

4 years ago

0.9.30

4 years ago

0.9.29

4 years ago

0.9.28

4 years ago

0.9.27

4 years ago

0.9.26

4 years ago

0.9.25

4 years ago

0.9.24

4 years ago

0.9.23

4 years ago

0.9.22

4 years ago

0.9.21

4 years ago

0.9.19

4 years ago

0.9.18

4 years ago

0.9.17

4 years ago

0.9.16

4 years ago

0.9.15

4 years ago

0.9.14

4 years ago

0.9.13

4 years ago

0.9.12

4 years ago

0.9.11

4 years ago

0.9.10

4 years ago

0.9.9

4 years ago

0.9.8

4 years ago

0.9.7

4 years ago

0.9.5

4 years ago

0.9.4

4 years ago

0.9.3

4 years ago

0.9.2

4 years ago

0.9.1

4 years ago

0.9.0

4 years ago

0.8.3

4 years ago

0.8.2

4 years ago

0.8.1

4 years ago

0.8.0

4 years ago

0.7.7

4 years ago

0.7.6

4 years ago

0.7.5

4 years ago

0.7.4

4 years ago

0.7.3

4 years ago

0.7.2

4 years ago

0.7.1

4 years ago

0.7.0

4 years ago

0.6.2

4 years ago

0.6.1

4 years ago

0.6.0

4 years ago

0.5.6

4 years ago

0.5.4

4 years ago

0.5.3

4 years ago

0.5.2

4 years ago

0.5.1

5 years ago

0.5.0

5 years ago

0.4.0

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.7

5 years ago

0.2.6

5 years ago

0.2.5

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago