Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: signature #1080

Merged
merged 5 commits into from
Jun 6, 2023
Merged

refactor: signature #1080

merged 5 commits into from
Jun 6, 2023

Conversation

irisSong
Copy link
Collaborator

@irisSong irisSong commented Jun 1, 2023

🤔 这个变动的性质是?

  • 新特性提交
  • 日常 bug 修复
  • 站点、文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • TypeScript 定义更新
  • 包体积优化
  • 性能优化
  • 功能增强
  • 国际化改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他改动(是关于什么的改动?)

🔗 相关 Issue

💡 需求背景和解决方案

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • fock仓库代码是否为最新避免文件冲突
  • Files changed 没有 package.json lock 等无关文件

@@ -1,3 +1,13 @@
.demo-tips {
color: #1a1a1a;
.demo {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以给 signarure 一个单独的 className,.demo 的样式有可能影响其他组件的展示


const signatureRef = useRef<signatureRefState>(null)
const signatureRef1 = useRef<signatureRefState>(null)

const confirm = (dataurl: string) => {
console.log('图片地址', dataurl)
// Taro.saveImageToPhotosAlbum({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注释可以删掉

@@ -94,18 +94,19 @@ export default App;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API 需要改为组件名称 Signature


| Property | Description | Type |
| --- | --- | --- |
| confirm | 确认签字 | `() => void` |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要翻译

@@ -1,16 +1,4 @@
@import '../button/button';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

button 在组件中没有用到的话,可以不 import button 的样式文件。在 demo 中用到的 button 组件,也不需要在这里 import button 的样式文件

import Button from '@/packages/button/index.taro'
import bem from '@/utils/bem'
import { useConfig } from '@/packages/configprovider/configprovider.taro'
import { BasicComponent, ComponentDefaults } from '@/utils/typings'

interface FileType {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个类型可以在 index 文件中导出

export interface SignatureProps {
type: string
export interface SignatureProps extends BasicComponent {
type: 'png' | 'jpg'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以像 taro 文件中,声明一个同名的类型,在 index 中导出

className: string
confirm?: (canvas: HTMLCanvasElement, dataurl: string) => void
clear?: () => void
unsupported: string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的类型是不是能改成 ReactNode,如果改为 ReactNode ,下面代码中用到的 unsupported 的地方需要做类型判断,来兼容默认值

<p className={`${b('unsopport')}`}>
{locale.signature.unSupportTpl || unSupportTpl}
<p className={`${classPrefix}__unsopport}`}>
{locale.signature.unsupported || unsupported}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个逻辑写反了,使用语言包, 默认值那块可以设置为空

@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (next@3d89c7c). Click here to learn what that means.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             next    #1080   +/-   ##
=======================================
  Coverage        ?   69.58%           
=======================================
  Files           ?      187           
  Lines           ?     7589           
  Branches        ?     2189           
=======================================
  Hits            ?     5281           
  Misses          ?     2089           
  Partials        ?      219           

@oasis-cloud oasis-cloud merged commit c1f7fc6 into jdf2e:next Jun 6, 2023
@irisSong irisSong deleted the next-signature branch January 15, 2024 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants