-
Notifications
You must be signed in to change notification settings - Fork 260
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(avatar): rn 适配 #2343
Merged
Merged
feat(avatar): rn 适配 #2343
Changes from 11 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
f4c8c88
feat: avatar rn
058615f
fix: 调整样式
93f903d
fix: 不改动web h5 的实现
af54ef1
Merge branch 'dev-harmony' into rn-avatar
xiaoyatong a9332d3
fix: 简化样式
be20eff
fix: 样式改为flex布局,修复没有设置max时的问题,调整image的样式
500706c
fix: 修改avatargroup样式
47d06ee
fix: 给第一个元素增加样式
4c6a1a6
fix: 释放图片模式
3840de8
fix: 样式转化
28fbbca
Merge branch 'dev-harmony' into rn-avatar
xiaoyatong 8389c6e
Merge branch 'dev-harmony' into rn-avatar
xiaoyatong d05ae0d
fix: fixed merge conflicts
f24f465
fix: taro h5 下无法展示max时的问题修复
66d7a97
fix: 鸿蒙下无法支持改变大小的问题
624b024
fix: conflicts
815ea17
fix: 调整group实现,解决rn问题,引入image组件改为taro组件,去掉并没有使用的alt属性
9771aaa
fix: 回滚错误提交
3e72375
Merge branch 'dev-harmony' into rn-avatar
xiaoyatong f392a3d
fix: 去掉 isFirst ,直接使用 avatarIndex
9a1c7ce
Merge branch 'rn-avatar' of https://github.com/xiaoyatong/nutui-react…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -25,4 +25,6 @@ exports = module.exports = [ | |
'hoverbutton', | ||
'safearea', | ||
'hoverbuttonitem', | ||
'avatar', | ||
'avatargroup', | ||
] |
3 changes: 2 additions & 1 deletion
3
packages/nutui-taro-demo-rn/src/exhibition/pages/avatar/index.tsx
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
export default <>button</>; | ||
import Demo from '@/packages/avatar/demo.taro' | ||
export default Demo |
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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 需要删除 image 样式 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. web h5 还需要这个样式~ |
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 |
---|---|---|
@@ -1,76 +1,170 @@ | ||
.nut-avatar { | ||
background-size: 100% 100%; | ||
background-repeat: no-repeat; | ||
background-position: center center; | ||
display: inline-block; | ||
.nut-image { | ||
display: block; | ||
position: relative; | ||
flex: 0 0 auto; | ||
text-align: center; | ||
} | ||
.nut-avatar .avatar-img { | ||
position: absolute; | ||
.nut-image-default { | ||
display: block; | ||
width: 100%; | ||
height: 100%; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
flex-shrink: 0; | ||
} | ||
.nut-avatar .icon { | ||
background-size: 100% 100%; | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
.nut-image.nut-image-round { | ||
border-radius: 50%; | ||
overflow: hidden; | ||
} | ||
.nut-avatar .nut-icon-img { | ||
.nut-image-loading { | ||
width: 100%; | ||
height: 100%; | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
background: #f5f6fa; | ||
background-size: 100% 100%; | ||
} | ||
.nut-avatar .text { | ||
display: inline-block; | ||
.nut-image-error { | ||
width: 100%; | ||
height: 100%; | ||
text-align: center; | ||
overflow: hidden; | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
background: #f5f6fa; | ||
background-size: 100% 100%; | ||
} | ||
|
||
[dir=rtl] .nut-avatar .avatar-img, | ||
.nut-rtl .nut-avatar .avatar-img { | ||
[dir=rtl] .nut-image .nut-img-loading, | ||
.nut-rtl .nut-image .nut-img-loading { | ||
left: auto; | ||
right: 50%; | ||
transform: translate(50%, -50%); | ||
right: 0; | ||
} | ||
[dir=rtl] .nut-avatar .icon, | ||
.nut-rtl .nut-avatar .icon { | ||
[dir=rtl] .nut-image .nut-img-error, | ||
.nut-rtl .nut-image .nut-img-error { | ||
left: auto; | ||
right: 50%; | ||
transform: translate(50%, -50%); | ||
right: 0; | ||
} | ||
|
||
.nut-avatar-group { | ||
display: flex; | ||
flex-direction: row; | ||
flex: 0 0 auto; | ||
} | ||
.nut-avatar-group-avatar, | ||
.nut-avatar-group .nut-avatar { | ||
border: 1px solid #fff; | ||
margin-left: -8px; | ||
} | ||
.nut-avatar-group-avatar:not(:first-of-type), | ||
.nut-avatar-group .nut-avatar:not(:first-of-type) { | ||
margin-left: -8px; | ||
} | ||
|
||
[dir=rtl] .nut-avatar-group .nut-avatar:not(:first-of-type), | ||
.nut-rtl .nut-avatar-group .nut-avatar:not(:first-of-type) { | ||
margin-left: 0; | ||
margin-right: -8px; | ||
} | ||
|
||
.nut-avatar { | ||
position: relative; | ||
flex: 0 0 auto; | ||
} | ||
.nut-avatar-round { | ||
border-radius: 999px; | ||
overflow: hidden; | ||
} | ||
.nut-avatar-square { | ||
border-radius: 5px; | ||
} | ||
.nut-avatar-first-child { | ||
margin-left: 0; | ||
margin-right: 0; | ||
} | ||
.nut-avatar-img { | ||
width: 100%; | ||
height: 100%; | ||
flex-shrink: 0; | ||
background-size: 100% 100%; | ||
background-repeat: no-repeat; | ||
background-position: center center; | ||
} | ||
.nut-avatar-icon { | ||
background-size: 100% 100%; | ||
} | ||
.nut-avatar .nut-icon-img { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
.nut-avatar-text { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
.nut-avatar-large { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
width: 60px; | ||
height: 60px; | ||
} | ||
.nut-avatar-large-img { | ||
width: 60px; | ||
height: 60px; | ||
} | ||
.nut-avatar-large-img-image { | ||
width: 60px; | ||
height: 60px; | ||
} | ||
.nut-avatar-large-icon { | ||
width: 60px; | ||
height: 60px; | ||
} | ||
.nut-avatar-large .nut-icon-img { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
.nut-avatar-large-text { | ||
width: 60px; | ||
height: 60px; | ||
line-height: 60px; | ||
} | ||
|
||
.nut-avatar-small { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
width: 32px; | ||
height: 32px; | ||
} | ||
.nut-avatar-small-img-image { | ||
width: 32px; | ||
height: 32px; | ||
} | ||
.nut-avatar-small-text { | ||
width: 32px; | ||
height: 32px; | ||
line-height: 32px; | ||
} | ||
|
||
.nut-avatar-normal { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
width: 40px; | ||
height: 40px; | ||
line-height: 40px; | ||
} | ||
|
||
.nut-avatar-round { | ||
border-radius: 50%; | ||
overflow: hidden; | ||
.nut-avatar-normal-img-image { | ||
width: 40px; | ||
height: 40px; | ||
} | ||
|
||
.nut-avatar-square { | ||
border-radius: 5px; | ||
.nut-avatar-normal .nut-icon-img { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
.nut-avatar-normal-text { | ||
width: 40px; | ||
height: 40px; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
全局变量应避免重新赋值。
Committable suggestion