-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: DiamondYuan <fandi.yfd@antgroup.com>
- Loading branch information
1 parent
3902272
commit 4c80852
Showing
70 changed files
with
672 additions
and
99 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
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 |
---|---|---|
@@ -1,5 +1,8 @@ | ||
import { mountComponent } from '../../_util/component'; | ||
import { SkeletonAvatarDefaultProps } from './props'; | ||
|
||
Component({ | ||
props: SkeletonAvatarDefaultProps, | ||
}); | ||
const Avatar = () => { | ||
// | ||
}; | ||
|
||
mountComponent(Avatar, SkeletonAvatarDefaultProps); |
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,12 +1,12 @@ | ||
import { ISkeletonBaseProps } from '../props'; | ||
import { ISkeletonBaseProps, SkeletonDefaultBaseProps } from '../props'; | ||
|
||
export interface SkeletonAvatarProps extends ISkeletonBaseProps { | ||
shape: 'circle' | 'square'; | ||
size: 'x-small' | 'small' | 'medium' | 'large'; | ||
} | ||
|
||
export const SkeletonAvatarDefaultProps: Partial<SkeletonAvatarProps> = { | ||
...SkeletonDefaultBaseProps, | ||
shape: 'square', | ||
loading: true, | ||
size: 'medium', | ||
}; |
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,5 +1,8 @@ | ||
import { mountComponent } from '../../_util/component'; | ||
import { SkeletonButtonDefaultProps } from './props'; | ||
|
||
Component({ | ||
props: SkeletonButtonDefaultProps, | ||
}); | ||
const Button = () => { | ||
// | ||
}; | ||
|
||
mountComponent(Button, SkeletonButtonDefaultProps); |
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,10 +1,10 @@ | ||
import { ISkeletonBaseProps } from '../props'; | ||
import { ISkeletonBaseProps, SkeletonDefaultBaseProps } from '../props'; | ||
|
||
export interface SkeletonButtonProps extends ISkeletonBaseProps { | ||
size?: 'small' | 'medium' | 'large'; | ||
} | ||
|
||
export const SkeletonButtonDefaultProps: Partial<SkeletonButtonProps> = { | ||
loading: true, | ||
...SkeletonDefaultBaseProps, | ||
size: 'medium', | ||
}; |
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,5 +1,8 @@ | ||
import { SkeletonInputDefaultProps } from './props'; | ||
import { mountComponent } from '../../_util/component'; | ||
|
||
Component({ | ||
props: SkeletonInputDefaultProps, | ||
}); | ||
const Input = () => { | ||
// | ||
}; | ||
|
||
mountComponent(Input, SkeletonInputDefaultProps); |
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,8 +1,7 @@ | ||
import { ISkeletonBaseProps } from '../props'; | ||
import { ISkeletonBaseProps, SkeletonDefaultBaseProps } from '../props'; | ||
|
||
export interface SkeletonInputProps extends ISkeletonBaseProps { | ||
} | ||
export interface SkeletonInputProps extends ISkeletonBaseProps {} | ||
|
||
export const SkeletonInputDefaultProps: Partial<SkeletonInputProps> = { | ||
loading: true, | ||
...SkeletonDefaultBaseProps, | ||
}; |
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,5 +1,8 @@ | ||
import { mountComponent } from '../../_util/component'; | ||
import { SkeletonParagraphDefaultProps } from './props'; | ||
|
||
Component({ | ||
props: SkeletonParagraphDefaultProps, | ||
}); | ||
const Paragraph = () => { | ||
// | ||
}; | ||
|
||
mountComponent(Paragraph, SkeletonParagraphDefaultProps); |
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,10 +1,10 @@ | ||
import { ISkeletonBaseProps } from '../props'; | ||
import { ISkeletonBaseProps, SkeletonDefaultBaseProps } from '../props'; | ||
|
||
export interface SkeletonParagraphProps extends ISkeletonBaseProps { | ||
rows: number; | ||
} | ||
|
||
export const SkeletonParagraphDefaultProps: Partial<SkeletonParagraphProps> = { | ||
loading: true, | ||
...SkeletonDefaultBaseProps, | ||
rows: 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 |
---|---|---|
@@ -1,5 +1,8 @@ | ||
import { mountComponent } from '../../_util/component'; | ||
import { SkeletonTitleDefaultProps } from './props'; | ||
|
||
Component({ | ||
props: SkeletonTitleDefaultProps, | ||
}); | ||
const Title = () => { | ||
// | ||
}; | ||
|
||
mountComponent(Title, SkeletonTitleDefaultProps); |
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,8 +1,7 @@ | ||
import { ISkeletonBaseProps } from '../props'; | ||
import { ISkeletonBaseProps, SkeletonDefaultBaseProps } from '../props'; | ||
|
||
export interface SkeletonTitleProps extends ISkeletonBaseProps { | ||
} | ||
export interface SkeletonTitleProps extends ISkeletonBaseProps {} | ||
|
||
export const SkeletonTitleDefaultProps: Partial<SkeletonTitleProps> = { | ||
loading: true, | ||
...SkeletonDefaultBaseProps, | ||
}; |
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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import { mountComponent } from '../_util/component'; | ||
import { SkeletonDefaultProps } from './props'; | ||
import '../_util/assert-component2'; | ||
|
||
Component({ | ||
props: SkeletonDefaultProps, | ||
methods: {}, | ||
}); | ||
const Skeleton = () => { | ||
// | ||
}; | ||
|
||
mountComponent(Skeleton, SkeletonDefaultProps); |
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
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,11 @@ | ||
Page({ | ||
data: { | ||
showLoading: true, | ||
paragraph: { | ||
rows: 4, | ||
}, | ||
}, | ||
handleToggleShowLoading: function () { | ||
this.setData({ showLoading: !this.data.showLoading }); | ||
}, | ||
}); |
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 @@ | ||
{ | ||
"defaultTitle": "Skeleton", | ||
"usingComponents": { | ||
"avatar": "../../../src/Avatar/index", | ||
"skeleton": "../../../src/Skeleton/index", | ||
"switch": "../../../src/Switch/index", | ||
"skeleton-avatar": "../../../src/Skeleton/Avatar/index", | ||
"skeleton-title": "../../../src/Skeleton/Title/index", | ||
"skeleton-button": "../../../src/Skeleton/Button/index", | ||
"skeleton-paragraph": "../../../src/Skeleton/Paragraph/index", | ||
"skeleton-input": "../../../src/Skeleton/Input/index", | ||
"container": "../../../src/Container/index" | ||
} | ||
} |
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,51 @@ | ||
<container title="基础用法"> | ||
<skeleton /> | ||
</container> | ||
|
||
<container title="有动画的骨架屏"> | ||
<skeleton animate="{{ true }}" /> | ||
</container> | ||
|
||
<container title="带avatar"> | ||
<skeleton avatar="{{ true }}" /> | ||
</container> | ||
|
||
<container title="自定义组合"> | ||
<view class="list"> | ||
<skeleton-avatar className="custom" /> | ||
<skeleton-paragraph | ||
className="custom" | ||
rows="{{ 1 }}" /> | ||
<skeleton-input className="custom" /> | ||
<skeleton-input className="custom" /> | ||
<skeleton-input className="custom" /> | ||
<skeleton-button | ||
className="custom" | ||
size="small" /> | ||
</view> | ||
</container> | ||
|
||
<container title="复杂组合"> | ||
<skeleton | ||
loading="{{ showLoading }}" | ||
title="{{ false }}" | ||
avatar="{{ true }}" | ||
paragraph="{{ paragraph }}"> | ||
<view class="container"> | ||
<avatar | ||
src="https://images.unsplash.com/photo-1546967191-fdfb13ed6b1e?ixlib=rb-1.2.1&q=80&fm=jpg&crop=faces&fit=crop&h=200&w=200&ixid=eyJhcHBfaWQiOjE3Nzg0fQ" /> | ||
<view class="content"> | ||
We supply a series of design principles, practical patterns and high | ||
quality design resources, to help people create their product prototypes | ||
beautifully and efficiently. | ||
</view> | ||
</view> | ||
</skeleton> | ||
<view slot="headerRight"> | ||
显示骨架 | ||
<switch | ||
style="margin-left: 8px" | ||
checked="{{ showLoading }}" | ||
bind:change="handleToggleShowLoading" /> | ||
</view> | ||
</container> |
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,19 @@ | ||
page { | ||
padding: 24px; | ||
box-sizing: border-box; | ||
} | ||
.list { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
.custom { | ||
margin-bottom: 16px; | ||
} | ||
.container { | ||
display: flex; | ||
color: #333333; | ||
align-items: flex-start; | ||
} | ||
.content { | ||
padding: 12px 16px 0 16px; | ||
} |
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 @@ | ||
import { mountComponent } from '../../_util/component'; | ||
import { SkeletonAvatarDefaultProps } from './props'; | ||
var Avatar = function () { | ||
// | ||
}; | ||
mountComponent(Avatar, SkeletonAvatarDefaultProps); |
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 @@ | ||
{ | ||
"component": true, | ||
"usingComponents": {} | ||
} |
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,9 @@ | ||
<wxs | ||
src="./index.wxs" | ||
module="utils" /> | ||
|
||
<view | ||
wx:if="{{ loading }}" | ||
style="{{ style }}" | ||
class="ant-skeleton-avatar ant-skeleton-avatar-{{ shape }} {{ animate ? 'ant-skeleton-avatar-animate' : '' }} {{ utils.getClass(size) }} {{ className || '' }}" /> | ||
<slot wx:else /> |
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,10 @@ | ||
function getClass(size) { | ||
var list = ['x-small', 'small', 'medium', 'large']; | ||
if (list.indexOf(size) >= 0) { | ||
return "ant-skeleton-avatar-".concat(size); | ||
} | ||
return 'ant-skeleton-avatar-medium'; | ||
} | ||
module.exports = { | ||
getClass: getClass | ||
}; |
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,31 @@ | ||
.ant-skeleton-avatar { | ||
width: 44px; | ||
height: 44px; | ||
border-radius: 4px; | ||
background: #eeeeee; | ||
display: inline-block; | ||
} | ||
.ant-skeleton-avatar-animate { | ||
background: linear-gradient(90deg, #eeeeee 25%, rgba(204, 204, 204, 0.6) 37%, #eeeeee 63%); | ||
background-size: 400% 100%; | ||
animation: ant-skeleton-loading 1.4s ease infinite; | ||
} | ||
.ant-skeleton-avatar-circle { | ||
border-radius: 50%; | ||
} | ||
.ant-skeleton-avatar-x-small { | ||
width: 40px; | ||
height: 40px; | ||
} | ||
.ant-skeleton-avatar-small { | ||
width: 44px; | ||
height: 44px; | ||
} | ||
.ant-skeleton-avatar-medium { | ||
width: 52px; | ||
height: 52px; | ||
} | ||
.ant-skeleton-avatar-large { | ||
width: 60px; | ||
height: 60px; | ||
} |
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 @@ | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
import { SkeletonDefaultBaseProps } from '../props'; | ||
export var SkeletonAvatarDefaultProps = __assign(__assign({}, SkeletonDefaultBaseProps), { shape: 'square', size: 'medium' }); |
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 @@ | ||
import { mountComponent } from '../../_util/component'; | ||
import { SkeletonButtonDefaultProps } from './props'; | ||
var Button = function () { | ||
// | ||
}; | ||
mountComponent(Button, SkeletonButtonDefaultProps); |
Oops, something went wrong.