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

feat: add swap token component #893

Closed
wants to merge 20 commits into from
Closed

feat: add swap token component #893

wants to merge 20 commits into from

Conversation

MarioJames
Copy link
Collaborator

@MarioJames MarioJames commented May 20, 2024

新增 token 相关组件,UED 设计如下
image

在目前实现中实现了两个组件:

  1. 只有 Token 选择的 Token.Select 组件,适用于在任何场景中嵌入供用户选择预期的 Token
  2. 结合 Token 选择和数量输入的 Token.Output 组件,适用于用户需要选择 Token 并且输入操作数量的场景,同时带有 Token 数量与总价计算与展示功能

Copy link

vercel bot commented May 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ant-design-web3 ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 29, 2024 2:36pm

Copy link

changeset-bot bot commented May 20, 2024

🦋 Changeset detected

Latest commit: fdcc456

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@ant-design/web3 Minor
@example/eth-web3js Patch
@example/ethers-v5 Patch
@example/ethers Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

github-actions bot commented May 20, 2024

Prepare preview

@LCJove
Copy link
Collaborator

LCJove commented May 20, 2024

可以加一下changest

Copy link

@MarioJames You can run the pnpm changeset command locally to generate a changelog. Please refer to the operation precautions. https://web3.ant.design/guide/changelog

@MarioJames 可以在本地运行 pnpm changeset 命令生成 changelog, 操作注意事项参考:https://web3.ant.design/guide/changelog-cn

Copy link

codecov bot commented May 20, 2024

Codecov Report

Attention: Patch coverage is 60.44776% with 53 lines in your changes are missing coverage. Please review.

Project coverage is 99.75%. Comparing base (ac888ee) to head (8be087c).
Report is 10 commits behind head on main.

Current head 8be087c differs from pull request most recent head fdcc456

Please upload reports for the commit fdcc456 to get more accurate results.

Files Patch % Lines
packages/web3/src/swap/Token.tsx 65.68% 35 Missing ⚠️
packages/web3/src/swap/index.tsx 43.75% 18 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##              main     #893      +/-   ##
===========================================
- Coverage   100.00%   99.75%   -0.25%     
===========================================
  Files          708      710       +2     
  Lines        21461    21589     +128     
  Branches      1214     1214              
===========================================
+ Hits         21461    21536      +75     
- Misses           0       53      +53     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

packages/web3/src/token/Token.tsx Outdated Show resolved Hide resolved
packages/web3/src/token/demos/basic.tsx Outdated Show resolved Hide resolved
.changeset/eighty-hounds-prove.md Outdated Show resolved Hide resolved
packages/web3/src/token/demos/basic.tsx Outdated Show resolved Hide resolved
packages/web3/src/token/index.tsx Outdated Show resolved Hide resolved
packages/web3/src/token/demos/token.tsx Outdated Show resolved Hide resolved
@@ -0,0 +1,33 @@
import { useState } from 'react';
Copy link
Collaborator

Choose a reason for hiding this comment

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

demo 可以设置个宽度,现在这样撑开感觉看上去有点不正常:

image

类似 antd 的 demo 这样:

image

@@ -0,0 +1,91 @@
import { Suspense, useDeferredValue, useState } from 'react';
Copy link
Collaborator

Choose a reason for hiding this comment

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

可以给一个这个效果的 Demo:

image

*/
[`${token.componentCls}-wrapper`]: {
background: '#fff',
width: 196,
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个是 select 的宽度吗?感觉这个宽度不应该写死在组件里面,参考 antd 的 select


import { useTokenSelectStyle } from './style';

export interface TokenSelectProps {
Copy link
Collaborator

Choose a reason for hiding this comment

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

TokenSelect 不能基于 antd 的 Select 实现吗?感觉 TokenSelect 应该是基于 antd 的 Select 封装,是它的一个超集,并且直接透出 antd 的 Select 的 props。

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TokenSelect 不能基于 antd 的 Select 实现吗?感觉 TokenSelect 应该是基于 antd 的 Select 封装,是它的一个超集,并且直接透出 antd 的 Select 的 props。

样式不太一样 antd select 就是一个我们常规理解中的 select,TokenSelect 更像是 Dropdown
不过可以切成基于 select 去做,在视觉设计上要做一些调整

input: {
padding: 0,
fontSize: 24,
lineHeight: 1.5,
Copy link
Collaborator

Choose a reason for hiding this comment

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

cryptoInput 的输入框大小应该和 antd 的保持一致,设计图中的大框应该通过设置 size='large' 来实现,尽可能的不要 hack antd 基础组件的样式。如果设计稿和 antd 组件规范有冲突的,可以和设计师商量调整。我们整体尽量和 antd 的基础组件保持样式和用法上的一致。

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

cryptoInput 的输入框大小应该和 antd 的保持一致,设计图中的大框应该通过设置 size='large' 来实现,尽可能的不要 hack antd 基础组件的样式。如果设计稿和 antd 组件规范有冲突的,可以和设计师商量调整。我们整体尽量和 antd 的基础组件保持样式和用法上的一致。

ok 现在是做的 flex 自适应 我全切成 antd input 的 props

MarioJames and others added 20 commits May 29, 2024 22:31
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 5.4.4 to 5.4.5.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](microsoft/TypeScript@v5.4.4...v5.4.5)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [@types/lodash](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/lodash) from 4.14.202 to 4.17.4.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/lodash)

---
updated-dependencies:
- dependency-name: "@types/lodash"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: thinkasany <480968828@qq.com>
Bumps [classnames](https://github.com/JedWatson/classnames) from 2.3.2 to 2.5.1.
- [Changelog](https://github.com/JedWatson/classnames/blob/main/HISTORY.md)
- [Commits](JedWatson/classnames@v2.3.2...v2.5.1)

---
updated-dependencies:
- dependency-name: classnames
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: thinkasany <480968828@qq.com>
Bumps [@ant-design/icons](https://github.com/ant-design/ant-design-icons) from 5.3.6 to 5.3.7.
- [Commits](https://github.com/ant-design/ant-design-icons/commits)

---
updated-dependencies:
- dependency-name: "@ant-design/icons"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: thinkasany <480968828@qq.com>
* feat: add ant design meetup 2024 sbt dapp

* fix: update ui

---------

Co-authored-by: tingzhao.ytz <tingzhao.ytz@antgroup.com>
@thinkasany
Copy link
Collaborator

thinkasany commented May 29, 2024

看起来好像有很多无关的filechange,是不是rebase的时候冲突太多了,或者可以考虑重新提交一个pr,使用git cherry-pick,拿出一些比较重要的 比如这个5acc3c31fb89e239559972278352b65fe9707862 hash下的commit的file change,然后对比这个pr中的cr意见再做修改,那样子会整洁很多。

下面这些commit 其实对于这个pr来说也是没用的,避免到时候处理错了,丢失重要代码,所以新起一个pr应该问题也不大,除了git cherry-pick,也可以试试新建一个分支reset 到比较前面,然后把冲突一起处理了,看怎么方便怎么来了。
image

@MarioJames
Copy link
Collaborator Author

看起来好像有很多无关的filechange,是不是rebase的时候冲突太多了,或者可以考虑重新提交一个pr,使用git cherry-pick,拿出一些比较重要的 比如这个5acc3c31fb89e239559972278352b65fe9707862 hash下的commit的file change,然后对比这个pr中的cr意见再做修改,那样子会整洁很多。

下面这些commit 其实对于这个pr来说也是没用的,避免到时候处理错了,丢失重要代码,所以新起一个pr应该问题也不大,除了git cherry-pick,也可以试试新建一个分支reset 到比较前面,然后把冲突一起处理了,看怎么方便怎么来了。 image

发现了 明天我会新发一个只有新组件的PR出来

@MarioJames MarioJames closed this May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Independent new features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants