@adamquadmon/gatsby-theme-lucifero 中文文档教程

发布于 3年前 浏览 2 项目主页 更新于 3年前

@adamquadmon/gatsby-theme-lucifero

@adamquadmon/gatsby-theme-lucifero 在 MIT 许可证下发布。 当前 npm 包版本。

Chakra UI 深色/浅色主题的 Satanic Gatsby 主题

具有 MDX 和其他灵感的

Features

  • Chakra UI-based theming
  • Light/Dark mode
  • MDX

Installation

mkdir my-site
cd my-site
yarn init
# install gatsby-theme-lucifero and it's dependencies
yarn add gatsby react react-dom @adamquadmon/gatsby-theme-lucifero

Usage

Theme options

:在 src/config/ 文件夹中,您将找到 defaultConfig.js

KeyDefault ValueDescription
basePath/Root url for the theme

Example usage

// gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: `@adamquadmon/gatsby-theme-lucifero`,
      options: {
        // basePath defaults to `/`
        basePath: `/sideproject`,
      },
    },
  ],
};

Shadowing

请阅读指南盖茨比主题中的阴影了解如何自定义主题! 一般来说,您会希望将文件放入 src/@adamquadmon/gatsby-theme-lucifero/ 以隐藏/覆盖文件。 可以通过在 src/gatsby-theme-lucifero/@chakra-ui/gatsby-plugin 中隐藏其文件来配置 Chakra UI 配置。

What's inside

这是包含插件的列表,以*结尾的是社区插件

Design

Data

SEO & Performances

Design

Theming

这个主题使用Chakra UI用于css-in-js 样式。 您可以在 src/gatsby-theme-lucifero/@chakra-ui/gatsby-plugin/ 文件夹中覆盖主题,入口点是 theme.js

Fonts

添加一个 GoolgeFonts 来自 fontsource 使用 yarn

yarn add @fontsource/im-fell-english

include the font in gatsby-browser.js

import '@fontsource/im-fell-english';

在主题文件中使用字体,例如在typography.js中:

export const typography = {
  fonts: {
    body: 'IM Fell English',
  },
};

Theme Modes

Chakra UI配置为深色和浅色模式,您可以在 components.js 文件中找到一些示例

export const components = {
  components: {
    Heading: {
      baseStyle: ({ colorMode }) => ({
        color: colorMode === 'dark' ? 'gray.300' : 'gray.600',
      }),
    }
  }
}

Colors

Chakra 利用 TailwindCSS 基色。 您可以在这里找到 所有 Tailwind 颜色

Components

该主题提供以下组件:

  • LayoutPage - Layout for Pages
  • LayoutContainer - Base Container including:
  • NavBar - full responsive navbar with LangSelector, ThemeSwitcher, SocialButtons, Logo, address and cell info
  • Footer - Logo with organization info, navigation items, LangSelector, SocialButtons and a Map
  • SEO - with ogImage and SchemaOrg
  • Cards - Dispaly responsive Cards for content
  • CookieConsent - The GDPR stuff
  • Hero - Hero component for home pages

Data

YAML

添加一个 data/collection.yaml 文件

character: a
number: 1

---

character: b
number: 2

,您可以使用 GraphQL 查询内部数据:

{
  allCollectionYaml {
    edges {
      node {
        character
        number
      }
    }
  }
}

MDX

pages 文件夹中,您可以添加 MDX 文件来创建页面和帖子

要覆盖菜单的导航链接,您可以创建文件 src/gatsby-theme-lucifero/hooks/use-navItems.js

Changelog

您可以找到广泛的 GitHub 上的变更日志。 您将能够看到每个补丁、次要和主要更改以及拉取请求对它们的贡献。

Questions?

如果您有一般性问题或需要有关 Gatsby 的帮助,请转到支持平台 在 Gatsby 的文档中提到。 如果您对此主题有具体问题,可以前往存储库的 GitHub 讨论

@adamquadmon/gatsby-theme-lucifero

@adamquadmon/gatsby-theme-lucifero is released under the MIT license. Current npm package version.

A Satanic Gatsby theme featuring Chakra UI Dark/Light theme with MDX and other suff

inspired by:

Features

  • Chakra UI-based theming
  • Light/Dark mode
  • MDX

Installation

mkdir my-site
cd my-site
yarn init
# install gatsby-theme-lucifero and it's dependencies
yarn add gatsby react react-dom @adamquadmon/gatsby-theme-lucifero

Usage

Theme options

In the src/config/ folder you will find defaultConfig.js

KeyDefault ValueDescription
basePath/Root url for the theme

Example usage

// gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: `@adamquadmon/gatsby-theme-lucifero`,
      options: {
        // basePath defaults to `/`
        basePath: `/sideproject`,
      },
    },
  ],
};

Shadowing

Please read the guide Shadowing in Gatsby Themes to understand how to customize the theme! Generally speaking you will want to place your files into src/@adamquadmon/gatsby-theme-lucifero/ to shadow/override files. The Chakra UI config can be configured by shadowing its files in src/gatsby-theme-lucifero/@chakra-ui/gatsby-plugin.

What's inside

This is a list of included plugins, the ones ending in* are community plugins

Design

Data

SEO & Performances

Design

Theming

This theme uses Chakra UI for css-in-js styling. You can override theming in the src/gatsby-theme-lucifero/@chakra-ui/gatsby-plugin/ folder, the entrypoint is theme.js

Fonts

add a GoolgeFonts from fontsource using yarn:

yarn add @fontsource/im-fell-english

include the font in gatsby-browser.js:

import '@fontsource/im-fell-english';

use the font in theme files, for example in typography.js:

export const typography = {
  fonts: {
    body: 'IM Fell English',
  },
};

Theme Modes

Chakra UI is configured for Dark and Light mode, you can find some example in the components.js file

export const components = {
  components: {
    Heading: {
      baseStyle: ({ colorMode }) => ({
        color: colorMode === 'dark' ? 'gray.300' : 'gray.600',
      }),
    }
  }
}

Colors

Chakra leverage on TailwindCSS base colors. You can find here all Tailwind colors

Components

The theme provide the following components:

  • LayoutPage - Layout for Pages
  • LayoutContainer - Base Container including:
  • NavBar - full responsive navbar with LangSelector, ThemeSwitcher, SocialButtons, Logo, address and cell info
  • Footer - Logo with organization info, navigation items, LangSelector, SocialButtons and a Map
  • SEO - with ogImage and SchemaOrg
  • Cards - Dispaly responsive Cards for content
  • CookieConsent - The GDPR stuff
  • Hero - Hero component for home pages

Data

YAML

adding a data/collection.yaml file

character: a
number: 1

---

character: b
number: 2

you can query for data inside using GraphQL:

{
  allCollectionYaml {
    edges {
      node {
        character
        number
      }
    }
  }
}

MDX

In the pages folder you can add MDX files to create pages and posts

To override the navigation links of the menu you can create the file src/gatsby-theme-lucifero/hooks/use-navItems.js

Changelog

You can find the extensive changelog of changes on GitHub. You'll be able to see each patch, minor, and major changes and what pull requests contributed to them.

Questions?

If you have general questions or need help with Gatsby, please go to one of the support platforms mentioned in Gatsby's documentation. If you have a specific question about this theme, you can head to the GitHub Discussions of the repository.

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文