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

Add 'fillCircle' prop #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/avatar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export enum AvatarStyle {

export interface Props {
avatarStyle: AvatarStyle
fillCircle?: string
className?: string;
style?: React.CSSProperties
}
Expand All @@ -27,8 +28,9 @@ export default class Avatar extends React.Component<Props> {
private mask3 = uniqueId('react-mask-')

render() {
console.log('fillCircle', this.props)
const { path1, path2, path3, mask1, mask2, mask3 } = this
const { avatarStyle } = this.props
const { avatarStyle, fillCircle = '#65C9FF' } = this.props
const circle = avatarStyle === AvatarStyle.Circle
return (
<svg
Expand Down Expand Up @@ -79,7 +81,7 @@ export default class Avatar extends React.Component<Props> {
<g
id="Color/Palette/Blue-01"
mask={'url(#' + mask1 + ')'}
fill="#65C9FF">
fill={fillCircle}>
<rect id="🖍Color" x="0" y="0" width="240" height="240" />
</g>
</g>
Expand Down
5 changes: 3 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {default as PieceComponent} from './avatar/piece';

export interface Props {
avatarStyle: string
fillCircle?: string
className?: string;
style?: React.CSSProperties
topType?: string
Expand Down Expand Up @@ -49,8 +50,8 @@ export default class AvatarComponent extends React.Component<Props> {
}

render () {
const { avatarStyle, style, className } = this.props
return <Avatar avatarStyle={avatarStyle as AvatarStyle} style={style} className={className} />
const { avatarStyle, fillCircle, style, className } = this.props
return <Avatar avatarStyle={avatarStyle as AvatarStyle} fillCircle={fillCircle} style={style} className={className} />
}

private updateOptionContext (props: Props) {
Expand Down