-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(avatar&list): complete avatar and list ; change menu style ; fix…
… alert bug ;
- Loading branch information
1 parent
d0519b9
commit 407cc83
Showing
36 changed files
with
556 additions
and
48 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
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
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 @@ | ||
import AutoComplete from './autocomplete' | ||
export default AutoComplete; |
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,62 @@ | ||
.bigbear-avatar{ | ||
overflow: hidden; | ||
>img{ | ||
@include square(100%); | ||
vertical-align: top; | ||
} | ||
>svg.bigbear-icon{ | ||
@include square(100%); | ||
vertical-align: top; | ||
} | ||
|
||
>div{ | ||
@include square(100%); | ||
vertical-align: top; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
} | ||
|
||
@each $key,$val in $theme-colors{ | ||
.bigbear-avatar-type-#{$key}{ | ||
color:#{nth($val,2)}; | ||
display: inline-block; | ||
@include square(100%); | ||
@include neufactory-noactive(nth($val,1),nth($val,3),nth($val,4)); | ||
} | ||
} | ||
|
||
@each $key,$val in $theme-colors{ | ||
.bigbear-avatar-wrapper-#{$key}{ | ||
display: inline-block; | ||
@include ringwrapper(nth($val,1),nth($val,3),nth($val,4)); | ||
} | ||
} | ||
|
||
.bigbear-avatar-size-default{ | ||
display: inline-block; | ||
@include square($avatar-size-default); | ||
padding:$avatar-padding-default; | ||
overflow: hidden; | ||
} | ||
.bigbear-avatar-size-lg{ | ||
padding:$avatar-padding-lg; | ||
font-size: $avatar-fontsize-lg; | ||
display: inline-block; | ||
@include square($avatar-size-lg); | ||
overflow: hidden; | ||
} | ||
.bigbear-avatar-size-sm{ | ||
font-size: $avatar-fontsize-sm; | ||
padding:$avatar-padding-sm; | ||
display: inline-block; | ||
@include square($avatar-size-sm); | ||
overflow: hidden; | ||
} | ||
.isround{ | ||
border-radius: 50%; | ||
>.bigbear-avatar{ | ||
border-radius: 50%; | ||
} | ||
} |
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,90 @@ | ||
import { Meta, Story, Props ,Preview } from '@storybook/addon-docs/blocks'; | ||
import Icon from '../Icon'; | ||
import Avatar from './avatar' | ||
|
||
<Meta title='DISPLAY|Avatar 头像' component={Avatar} /> | ||
|
||
<br/> | ||
|
||
# Avatar 头像 | ||
<br/> | ||
|
||
如果想使用文字,需要用div包裹一下。 | ||
Icon如果使用别的地方的,可能需要稍微自行调一下样式。 | ||
|
||
## 类型 type | ||
|
||
<Preview> | ||
<Story name='Avatar'> | ||
<div> | ||
<Avatar><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
<Avatar type='primary'><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
<Avatar type='danger'><div>User</div></Avatar> | ||
<Avatar type='info'><div>U</div></Avatar> | ||
<Avatar type='success'><Icon icon="user" theme='warning' /></Avatar> | ||
<Avatar type='secondary'><Icon icon="coffee" /></Avatar> | ||
<Avatar type='light'><Icon icon="spinner" spin theme='danger' /></Avatar> | ||
<Avatar type='warning'><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
<Avatar type='dark'><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
</div> | ||
</Story> | ||
</Preview> | ||
|
||
## 圆形 round | ||
|
||
<Preview> | ||
<Story name='Avatarround'> | ||
<div> | ||
<Avatar round={true} ><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
<Avatar round={true} type='primary'><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
<Avatar round={true} type='danger'><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
<Avatar round={true} type='info'><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
<Avatar round={true} type='success'><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
<Avatar round={true} type='secondary'><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
<Avatar round={true} type='light'><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
<Avatar round={true} type='warning'><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
<Avatar round={true} type='dark'><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
</div> | ||
</Story> | ||
</Preview> | ||
|
||
## 大小 size | ||
|
||
|
||
<Preview> | ||
<Story name='Avatarsizelg'> | ||
<div> | ||
<Avatar size='lg'><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
<Avatar size='lg' type='primary'><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
<Avatar size='lg' type='danger'><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
<Avatar size='lg' type='info'><div>U</div></Avatar> | ||
<Avatar size='lg' type='success'><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
<Avatar size='lg' type='secondary'><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
<Avatar size='lg' type='light'><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
<Avatar size='lg' type='warning'><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
<Avatar size='lg' type='dark'><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
</div> | ||
</Story> | ||
</Preview> | ||
|
||
|
||
<Preview> | ||
<Story name='Avatarsizesm'> | ||
<div> | ||
<Avatar size='sm'><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
<Avatar size='sm' type='primary'><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
<Avatar size='sm' type='danger'><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
<Avatar size='sm' type='info'><div>U</div></Avatar> | ||
<Avatar size='sm' type='success'><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
<Avatar size='sm' type='secondary'><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
<Avatar size='sm' type='light'><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
<Avatar size='sm' type='warning'><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
<Avatar size='sm' type='dark'><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/></Avatar> | ||
</div> | ||
</Story> | ||
</Preview> | ||
|
||
|
||
## 属性详情 | ||
|
||
<Props of={Avatar}/> |
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,32 @@ | ||
import React, { FC } from 'react'; | ||
import classNames from 'classnames' | ||
|
||
|
||
interface AvatarProps{ | ||
/** 大小*/ | ||
size?:'lg'|'sm'|'default' | ||
/** 圆形 */ | ||
round?:boolean; | ||
/** 颜色 */ | ||
type?:"primary" | "default" | "danger" | "secondary" | "success" | "info" | "light" | "warning" | "dark"; | ||
} | ||
|
||
export const Avatar:FC<AvatarProps> = (props)=>{ | ||
const {size,round,type}=props; | ||
const cnames= classNames('bigbear-avatar',`bigbear-avatar-type-${type}`) | ||
const wrappernames = classNames(`bigbear-avatar-wrapper-${type} bigbear-avatar-size-${size}`,{ | ||
'isround':round | ||
}) | ||
return( | ||
<span className={wrappernames}> | ||
<span className={cnames}>{props.children?props.children:null}</span> | ||
</span> | ||
) | ||
} | ||
Avatar.defaultProps={ | ||
size:'default', | ||
round:false, | ||
type:'default' | ||
} | ||
|
||
export default Avatar; |
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 @@ | ||
import Avatar from "./avatar"; | ||
|
||
export default Avatar; |
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
Oops, something went wrong.