Giter Site home page Giter Site logo

kuangpf / dumi-theme-antd Goto Github PK

View Code? Open in Web Editor NEW
36.0 1.0 17.0 22.98 MB

A antd site theme package for the dumi framework.

Home Page: https://kuangpf.com/dumi-theme-antd

License: MIT License

JavaScript 0.49% TypeScript 99.40% Shell 0.09% Less 0.02%
antd dumi dumi-theme

dumi-theme-antd's People

Contributors

aruelius avatar dream2023 avatar hezhijian249 avatar jeasonstudio avatar kuangpf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

dumi-theme-antd's Issues

不支持toc

docs目录的markdown文档,不支持toc功能,无法展示右侧导航。


同样试过四五个版本,几乎所有版本都存在此问题,包括目前最新版本0.2.7

一起查下,给点思路或者建议。一起完善它。

SSR 服务端渲染的问题

添加 ssr 参数后,打包出来的静态文件访问时 js 会最后加载,导致样式渲染不及时,一秒后 js 加载完毕,样式才渲染完毕。

export default defineConfig({
  ssr: {}
});

然而 dumi 官网也是服务端渲染,没有出现这种情况。

umiJs SSR 介绍

dumi SSR 配置
...(process.env.NODE_ENV === 'development' ? {} : { ssr: {} }),

附上 Chrome DevTools Waterfall 图:

我的
image

dumi 官网
image

安装依赖警告问题

项目里使用的antd版本是5.9.0,会报以下警告。
技术栈:pnpm8、antd5.9.0 、dumi2、dumi-theme-antd@latest
image

loading 转圈bug

引用dumi-theme-antd,
启动后,点击任意链接,然后再点击左上角回到首页时,
此时首页右上角一直在loading 转圈。


试过四五个版本,几乎所有版本都存在此问题,包括目前最新版本0.2.7

Markdown内容过少时,内容区样式问题

截图如下:
image

默认主题内容区样式有设置 min-height,所以没有问题

.dumi-default-header+main>.dumi-default-content, .dumi-default-doc-layout-mobile-bar+main>.dumi-default-content {
  min-height: calc(100vh - 76px)
}

使用 antd-style 替换 emotion 方案

一直以来 Ant Design 官网都是使用 emotion 作为 CSS-in-JS 方案, 目前 antd 已经完成从 emoction 迁移至 antd-style ref: ant-design/ant-design#43623

注意到 dumi-theme-antd 一直有在活跃, 有没有考虑也做一波迁移, 如果没啥难度很乐意提供一份 PR. 感谢

首页支持配置背景图片

现在的背景图片明显是antd 5.0的元素,希望可以支持替换;或者默认换成通用一点的图片,不要包含品牌元素

dumi-theme-antd 项目征集

如果你有项目在使用 dumi-theme-antd,并且希望展示在官网首页模块,可以按以下格式回复:

  • 地址:http:xxx.com
  • logo 图片地址:http:xxxx.com
  • title: xxxx
  • 描述:xxxx

多语言配置导致 sidebar 选中状态无效

目前的现象是当 dumi 使用英文为默认语言,中文添加 -cn 的路由后缀时,sidebar 无法高亮选中的 menu。配置如下:

locales: [
  { id: 'en-US', name: 'English', suffix: '' },
  { id: 'zh-CN', name: '中文', suffix: '-zh' }
]

useMenu 中有许多针对 -cn 的硬编码,可能有影响:

key: item.link.replace(/(-cn$)/g, '')

themeConfig的nav配置children无效

例如如下配置

export default defineConfig({
  themeConfig: {
    nav: [
      {
        title: '国内镜像',
        link: 'https://ant-design.antgroup.com/index-cn',
        children: [
          { title: '官方镜像', link: 'https://ant-design.antgroup.com/index-cn' },
          { title: 'Gitee 镜像', link: 'https://ant-design.antgroup.com/index-cn' }
        ]
      }
    ]
  }
});

期望结果
a2

配置项
a1

nginx 部署问题

使用dumi-theme-antd 主题之后,因为首页只需要通过配置,于是docs文件夹下并没有index.md, 这样的话打包出来的项目是不存在
index.html的, 那么问题来了 之前配好的nginx.conf里的rewrite怎么配置呢,以下是我原始的配置,如果docs下有index.md的话是可以的,但是如果有index.md 就无法使用配置文件了,求助如何解决?

.dumirc.ts 配置文件:

    outputPath: 'docs-dist/static-my-ui',
    base: '/my-ui',
    publicPath: '/static-my-ui/',

nginx.conf

worker_processes  1;
events {
    worker_connections  1024;
}
http{
    server {
        listen  8000;
        absolute_redirect off;
        server_name_in_redirect off;
        port_in_redirect off;

        access_log  /home/work/log/access.log;
        error_log   /home/work/log/error.log;

        include  mime.types;

        # 设置静态资源路径
        root  /home/work/web

        location /my-ui {
            root /home/work/web;
            try_files $uri $uri/ @fallback;
            index index.html;
        }

        location @fallback {
            rewrite ^.*$ /static-my-ui/index.html break;
        }
    }
}

InstallDependencies 内置组件增强

解决类似需求: Wxh16144/dumi-debug-app#11 不一定是前端几个包管理器安装依赖操作

下面是一个伪代码:

import React from 'react';
import type { TabsProps } from 'antd';
import { Tabs } from 'antd';
import SourceCode from 'dumi/theme-default/builtins/SourceCode';

const map: any = {
  android: {
    icon: 'https://cdn.jsdelivr.net/gh/devicons/devicon@master/icons/android/android-original.svg',
    label: 'Android'
  },
  ios: {
    icon: 'https://cdn.jsdelivr.net/gh/devicons/devicon@master/icons/apple/apple-original.svg',
    label: 'iOS'
  },
  windows: {
    icon: `https://cdn.jsdelivr.net/gh/devicons/devicon@master/icons/windows8/windows8-original.svg`,
    label: 'Windows'
  },
  linux: {
    icon: `https://cdn.jsdelivr.net/gh/devicons/devicon@master/icons/linux/linux-original.svg`,
    label: 'Linux'
  },
}

const InstallDependencies: React.FC = (props) => {
  const items = Object.entries(props)
    .map(([key, value]: any) => {
      if (!value || !map[key]) return null;

      return {
        key,
        children: <SourceCode lang="bash">{value}</SourceCode>,
        label: (
          <div>
            <img src={map[key].icon} alt={map[key].label} style={{ width: 18, height: 18 }} />
            <span style={{ marginLeft: 8 }}>{map[key].label}</span>
          </div>
        ),
      };
    })
    .filter(Boolean) as TabsProps['items'];

  return (
    <Tabs
      className="antd-site-snippet"
      // defaultActiveKey="npm"
      items={items}
    />
  );
};

export default InstallDependencies;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.