-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4e50410
Showing
146 changed files
with
7,658 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
presets: ['@babel/preset-env', '@babel/preset-react', '@babel/preset-typescript'], | ||
plugins: ['react-native-reanimated/plugin', '@babel/plugin-transform-runtime'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Editor configuration, see http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
max_line_length = off | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
module.exports = { | ||
extends: [ | ||
'airbnb-base', | ||
'prettier', // eslint-config-prettier 处理冲突 | ||
'@react-native-community', | ||
], | ||
parser: '@typescript-eslint/parser', | ||
env: { | ||
browser: true, | ||
node: true, | ||
jest: true, | ||
}, | ||
settings: { | ||
react: { | ||
pragma: 'React', | ||
version: 'detect', | ||
}, | ||
}, | ||
parserOptions: { | ||
ecmaVersion: 2019, | ||
sourceType: 'module', | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
rules: { | ||
'no-use-before-define': 'off', | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/ban-types': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/indent': ['off', 2], | ||
'@typescript-eslint/ban-ts-comment': 'off', | ||
'@typescript-eslint/camelcase': 'off', | ||
'@typescript-eslint/no-empty-interface': 'error', // codecc | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/no-use-before-define': ['error', { functions: false }], | ||
'@typescript-eslint/no-var-requires': 'off', | ||
'@typescript-eslint/no-unused-vars': 'error', // codecc | ||
'import/order': 'error', | ||
'import/extensions': 'off', | ||
'import/no-named-as-default': 'off', | ||
'import/prefer-default-export': 'off', | ||
'import/no-extraneous-dependencies': 'off', | ||
'import/no-cycle': 'off', // TODO: turn on this rule later | ||
'import/no-unresolved': 'off', // TODO: turn on this rule later | ||
'react/display-name': 'off', | ||
'react/react-in-jsx-scope': 'off', | ||
'react-hooks/exhaustive-deps': 'warn', | ||
'react-hooks/rules-of-hooks': 'error', | ||
'react-native/no-inline-styles': 'off', | ||
'react/prop-types': 'off', | ||
'max-len': 'off', | ||
'no-shadow': 'off', | ||
'no-console': 'off', | ||
'no-throw-literal': 'off', | ||
'no-unused-expressions': 'off', | ||
'no-bitwise': 'off', | ||
'no-useless-return': 'off', | ||
'no-plusplus': [ | ||
'error', | ||
{ | ||
allowForLoopAfterthoughts: true, | ||
}, | ||
], | ||
'no-continue': 'off', | ||
'no-return-assign': 'off', | ||
'no-restricted-syntax': 'off', | ||
'no-restricted-globals': 'off', | ||
'no-unneeded-ternary': 'off', | ||
'eol-last': 'error', // codecc | ||
'func-names': 'off', | ||
'consistent-return': 'off', | ||
'default-case': 'off', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "src/_common"] | ||
path = src/_common | ||
url = https://github.com/TDesignOteam/tdesign-common.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"*.{js,jsx,ts,tsx}": "eslint --cache --fix", | ||
"*.{js,tx,tsx,sass,less,css}": "prettier --write" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
example/ | ||
site/ | ||
**/.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
module.exports = { | ||
// 一行最多 120 字符 | ||
printWidth: 120, | ||
// 使用 2 个空格缩进 | ||
tabWidth: 2, | ||
// 不使用缩进符,而使用空格 | ||
useTabs: false, | ||
// 行尾需要有分号 | ||
semi: true, | ||
// 使用单引号 | ||
singleQuote: true, | ||
// 对象的 key 仅在必要时用引号 | ||
quoteProps: 'as-needed', | ||
// jsx 不使用单引号,而使用双引号 | ||
jsxSingleQuote: false, | ||
// 末尾需要有逗号 | ||
trailingComma: 'all', | ||
// 大括号内的首尾需要空格 | ||
bracketSpacing: true, | ||
// jsx 标签的反尖括号需要换行 | ||
jsxBracketSameLine: false, | ||
// 箭头函数,只有一个参数的时候,也需要括号 | ||
arrowParens: 'always', | ||
// 每个文件格式化的范围是文件的全部内容 | ||
rangeStart: 0, | ||
rangeEnd: Infinity, | ||
// 不需要写文件开头的 @prettier | ||
requirePragma: false, | ||
// 不需要自动在文件开头插入 @prettier | ||
insertPragma: false, | ||
// 使用默认的折行标准 | ||
proseWrap: 'preserve', | ||
// 根据显示样式决定 html 要不要折行 | ||
htmlWhitespaceSensitivity: 'css', | ||
// vue 文件中的 script 和 style 内不用缩进 | ||
vueIndentScriptAndStyle: false, | ||
// 换行符使用 lf | ||
endOfLine: 'lf', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
title: 更新日志 | ||
docClass: timeline | ||
toc: false | ||
spline: explain | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
# 参与贡献 | ||
|
||
非常感谢你对 TDesign 的关注,如果你想为组件库或其他产品贡献一份力量,请先了解下以下内容。 | ||
|
||
## 开启 issue | ||
|
||
如果你想要贡献一个新特性,请在实际写代码前先开一个 issue 与社区里的小伙伴一起讨论必要性及实现方案。 | ||
|
||
## Github flow 贡献流程 | ||
|
||
- 请将本项目 fork & clone 至本地 | ||
- 创建 feature/fix 分支 | ||
- 开发过程中可以使用 `git fetch` 或 `git rebase` 来同步上游分支代码 | ||
- 提交代码到 forked 仓库,commit message 撰写请参照 [Angular Commits 规范](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#commits) | ||
- 发起 pr | ||
- 会有 PMC 同学来 CR 本次提交的代码,请及时关注 CR 评论通知信息 | ||
- CR 通过后会合并进入 develop 分支,等待周迭代或紧急 patch 版本发布 npm | ||
|
||
## 目录结构 | ||
``` | ||
├── CHANGELOG.md 更新日志 | ||
├── DEVELOP_GUIDE.md 开发者readme | ||
├── README.md readme | ||
├── example 演示项目运行目录 | ||
├── scripts 通用脚本目录 | ||
├── site 站点目录 | ||
├── src 源码目录 | ||
``` | ||
## 开发 | ||
|
||
```bash | ||
git clone fork仓库代码 | ||
cd tdesign-react-native | ||
修改.gitmodules子仓库为自己fork的仓库,分支main | ||
git submodule sync | ||
git submodule init | ||
git submodule update | ||
|
||
# 开发预览 | ||
cd .. | ||
yarn | ||
cd example && yarn web | ||
|
||
``` | ||
|
||
## 编写demo | ||
|
||
为了demo和文档的对应,编写demo时需要使用特定格式及组件进行编写,便于自动提取demo生成文档。 | ||
|
||
每个组件对应demo应在该组件的_example文件夹下,可以分文件编写demo,但应以index文件作为入口进行汇总。 | ||
|
||
`example/src/components`目录下提供以下组件: | ||
|
||
``` | ||
export { CodeSpace } from './CodeSpace'; | ||
export { Section } from './Section'; | ||
export { H3, H4, H5, P } from './Element'; | ||
Section: 每部分demo容器 | ||
CodeSpace: 引用的demo组件的容器 | ||
H3, H4, H5, P: 文字说明内容组件 | ||
``` | ||
|
||
例如需要根据Button不同属性去编写示例: | ||
|
||
```jsx | ||
// index.tsx | ||
|
||
// 不同尺寸 | ||
const Demo1 = () => { | ||
return <> | ||
<Button style={{ marginTop: 10 }} theme="primary" content={'默认'} /> | ||
<Button style={{ marginTop: 10 }} size="small" theme="primary" content={'size=small'} /> | ||
<Button style={{ marginTop: 10 }} size="large" theme="primary" content={'size=large'} /> | ||
</> | ||
} | ||
|
||
// 不同状态 | ||
const Demo2 = () => { | ||
return <Button style={{ marginTop: 10 }} disabled theme="primary" content={'disabled'} /> | ||
} | ||
|
||
const Demo = () => ( | ||
<> | ||
<Section> | ||
<H3>按钮尺寸</H3> | ||
<P>按钮根据尺寸分为small、normal、large,默认为normal</P> | ||
<CodeSpace> | ||
<Demo1 /> | ||
</CodeSpace> | ||
</Section> | ||
<Section> | ||
<H3>按钮状态</H3> | ||
<P>按钮可以设置禁用的disable状态</P> | ||
<CodeSpace> | ||
<Demo2 /> | ||
</CodeSpace> | ||
</Section> | ||
</> | ||
); | ||
export default Demo; | ||
``` | ||
|
||
根据以上demo示例会生成如下类似如下文档: | ||
|
||
```md | ||
### 按钮尺寸 | ||
|
||
按钮根据尺寸分为small、normal、large,默认为normal | ||
|
||
`` | ||
const Demo1 = () => { | ||
return <> | ||
<Button style={{ marginTop: 10 }} theme="primary" content={'默认'} /> | ||
<Button style={{ marginTop: 10 }} size="small" theme="primary" content={'size=small'} /> | ||
<Button style={{ marginTop: 10 }} size="large" theme="primary" content={'size=large'} /> | ||
</> | ||
} | ||
`` | ||
|
||
### 按钮状态 | ||
|
||
按钮可以设置禁用的disable状态 | ||
|
||
`` | ||
const Demo2 = () => { | ||
return <Button style={{ marginTop: 10 }} disabled theme="primary" content={'disabled'} /> | ||
} | ||
`` | ||
|
||
``` | ||
|
||
更多指引请参考: | ||
|
||
- [开发指南](./DEVELOP_GUIDE.md) | ||
<!-- - [测试指南](./TEST_GUIDE.md) --> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
### 启动项目 | ||
|
||
在项目根目录中运行`npm i`安装代码需要对应依赖,再进入对应 package 运行项目 | ||
|
||
### 运行命令 | ||
|
||
|
||
|
||
### 提交规范: type(scope): subject | ||
|
||
type- | ||
feat:新功能(feature) | ||
fix:修补 bug | ||
docs:文档(documentation) | ||
style: 格式(不影响代码运行的变动) | ||
refactor:重构(即不是新增功能,也不是修改 bug 的代码变动) | ||
perf:性能 代码变更提高性能 | ||
test:增加测试 | ||
chore:构建过程或辅助工具的变动 | ||
|
||
scope-修改了哪个模块 | ||
subject-描述 | ||
|
||
例如: | ||
|
||
1. feat(button): 修改文案 | ||
2. fix: fixbug | ||
3. refactor: 调整代码结构 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
BUNDLE_PATH: "vendor/bundle" | ||
BUNDLE_FORCE_RUBY_PLATFORM: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2.7.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
source 'https://rubygems.org' | ||
|
||
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version | ||
ruby File.read(File.join(__dir__, '.ruby-version')).strip | ||
|
||
gem 'cocoapods', '~> 1.11', '>= 1.11.3' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* @format | ||
*/ | ||
|
||
import 'react-native'; | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
import App from '../src/App'; | ||
|
||
// Note: test renderer must be required after react-native. | ||
|
||
it('renders correctly', () => { | ||
renderer.create(<App />); | ||
}); |
Oops, something went wrong.