Skip to content

Commit

Permalink
📚 docs: add token meta info to token system model (ant-design#39101)
Browse files Browse the repository at this point in the history
* ♻️ refactor token system interface

* 📝 docs: add more token meta info to seeds and map token

* 🔨 chore: update token meta generator scripts

* 🚨 chore: fix lint

* 📝 docs: 补充 token 的 meta 信息

* chore: add json in pkg

* chore: update script

* chore: update flag

Co-authored-by: MadCcc <[email protected]>
  • Loading branch information
arvinxx and MadCcc authored Nov 30, 2022
1 parent ffbb19e commit 479e4e8
Show file tree
Hide file tree
Showing 14 changed files with 1,190 additions and 888 deletions.
6 changes: 6 additions & 0 deletions .antd-tools.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@ const fs = require('fs');
const path = require('path');

const restCssPath = path.join(process.cwd(), 'components', 'style', 'reset.css');
const tokenStatisticPath = path.join(process.cwd(), 'components', 'version', 'token.json');
const tokenMetaPath = path.join(process.cwd(), 'components', 'version', 'token-meta.json');

function finalizeCompile() {
if (fs.existsSync(path.join(__dirname, './es'))) {
fs.copyFileSync(restCssPath, path.join(process.cwd(), 'es', 'style', 'reset.css'));
fs.copyFileSync(tokenStatisticPath, path.join(process.cwd(), 'es', 'version', 'token.json'));
fs.copyFileSync(tokenMetaPath, path.join(process.cwd(), 'es', 'version', 'token-meta.json'));
}

if (fs.existsSync(path.join(__dirname, './lib'))) {
fs.copyFileSync(restCssPath, path.join(process.cwd(), 'lib', 'style', 'reset.css'));
fs.copyFileSync(tokenStatisticPath, path.join(process.cwd(), 'lib', 'version', 'token.json'));
fs.copyFileSync(tokenMetaPath, path.join(process.cwd(), 'lib', 'version', 'token-meta.json'));
}
}

Expand Down
5 changes: 2 additions & 3 deletions .dumi/theme/builtins/TokenTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import React, { useMemo } from 'react';
// @ts-ignore
import tokenMeta from 'antd/es/version/token-meta.json';
import { getDesignToken } from 'antd-token-previewer';
import type { TableProps } from 'antd';
import { Table } from 'antd';
import type { TableProps } from 'antd';
import { css } from '@emotion/react';
import useLocale from '../../../hooks/useLocale';
import useSiteToken from '../../../hooks/useSiteToken';
Expand Down Expand Up @@ -68,7 +68,6 @@ const TokenTable: FC<TokenTableProps> = ({ type }) => {
title: locale.description,
key: 'desc',
dataIndex: 'desc',
width: 300,
},
{
title: locale.type,
Expand Down Expand Up @@ -104,7 +103,7 @@ const TokenTable: FC<TokenTableProps> = ({ type }) => {
const data = useMemo<TokenData[]>(
() =>
tokenMeta[type].map((token) => ({
name: token.name,
name: token.token,
desc: lang === 'cn' ? token.desc : token.descEn,
type: token.type,
value: (defaultToken as any)[token.name],
Expand Down
Loading

0 comments on commit 479e4e8

Please sign in to comment.