Skip to content

Commit ff7b99c

Browse files
committed
feat : added hairStyle "turban"
1 parent 76430a0 commit ff7b99c

File tree

5 files changed

+32
-3
lines changed

5 files changed

+32
-3
lines changed

demo/Single.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,11 @@ export default class Single extends Component {
225225
onClick={this.updateConfig.bind(this, "hairStyle", "womanShort")}>
226226
Woman Short
227227
</p>
228+
<p
229+
className={classnames("opt", { active: config.hairStyle === "turban" })}
230+
onClick={this.updateConfig.bind(this, "hairStyle", "turban")}>
231+
Turban
232+
</p>
228233
</div>
229234

230235
{/* Eyes */}

react-nice-avatar.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export interface AvatarConfig {
99
faceColor?: string,
1010
earSize?: 'small' | 'big',
1111
hairColor?: string,
12-
hairStyle?: 'normal' | 'thick' | 'mohawk' | 'womanLong' | 'womanShort',
12+
hairStyle?: 'normal' | 'thick' | 'mohawk' | 'womanLong' | 'womanShort' | 'turban',
1313
eyeStyle?: 'circle' | 'oval' | 'smile',
1414
glassesStyle?: 'round' | 'square' | 'none',
1515
noseStyle?: 'short' | 'long' | 'round',

src/hair/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Thick from "./thick";
55
import Mohawk from "./mohawk";
66
import WomanLong from "./womanLong";
77
import WomanShort from "./womanShort";
8+
import Turban from './turban';
89

910
export default function (props) {
1011
const { style, color, colorRandom } = props;
@@ -13,6 +14,7 @@ export default function (props) {
1314
case "mohawk": return <Mohawk color={color} colorRandom={colorRandom} />;
1415
case "womanLong": return <WomanLong color={color} />;
1516
case "womanShort": return <WomanShort color={color} />;
17+
case "turban" : return <Turban color={color}/>
1618
case "normal":
1719
default:
1820
return <Normal color={color} />;

src/hair/turban.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React from "react";
2+
3+
export default function (props) {
4+
const { color } = props;
5+
return (
6+
<svg
7+
style={{
8+
position: "absolute",
9+
bottom: "34%",
10+
left: "13.5%"
11+
}}
12+
width="240"
13+
height="212"
14+
viewBox="0 0 240 212"
15+
fill="none"
16+
xmlns="http://www.w3.org/2000/svg">
17+
<path d="M222.726 112.791C222.726 46.702 186.268 2.00007 141.859 2C84.9656 2 27 23.3414 27 124.255C27 149.223 37.6589 167.827 52.5644 181.54C51.0704 179.671 49.8666 177.996 49.0668 176.619C46.176 149.638 78.2326 128.929 109.601 108.665C126.254 97.907 142.712 87.2746 153.646 75.8956C163.24 81.3324 191.44 104.109 196.813 113.32C199.695 118.26 204.322 135.189 207.484 154.95C217.822 142.532 222.726 130.107 222.726 112.791Z"
18+
fill={color} stroke="rgba(0,0,0,0.1)" strokeWidth="4"/>
19+
<path d="M154.264 75.2457C167.438 63.3013 187.146 36.0399 185.881 18.334" stroke="rgba(0,0,0,0.1)" strokeWidth="4"/>
20+
</svg>
21+
);
22+
}

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const sex = ["man", "woman"];
1515
const faceColor = ["#F9C9B6", "#AC6651"];
1616
const earSize = ["small", "big"];
1717
const hairColor = ["#000", "#fff", "#77311D", "#FC909F", "#D2EFF3", "#506AF4", "#F48150"];
18-
const hairStyleMan = ["normal", "thick", "mohawk"];
18+
const hairStyleMan = ["normal", "thick", "mohawk","turban"];
1919
const hairStyleWoman = ["normal", "womanLong", "womanShort"];
2020
const eyeBrowWoman = ["up", "upWoman"];
2121
const eyeStyle = ["circle", "oval", "smile"];
@@ -46,7 +46,7 @@ export default class ReactNiceAvatar extends Component {
4646
faceColor: PropTypes.string,
4747
earSize: PropTypes.oneOf(["small", "big"]),
4848
hairColor: PropTypes.string,
49-
hairStyle: PropTypes.oneOf(["normal", "thick", "mohawk", "womanLong", "womanShort"]),
49+
hairStyle: PropTypes.oneOf(["normal", "thick", "mohawk", "womanLong", "womanShort","turban"]),
5050
hairColorRandom: PropTypes.bool,
5151
eyeStyle: PropTypes.oneOf(["circle", "oval", "smile"]),
5252
glassesStyle: PropTypes.oneOf(["round", "square", "none"]),

0 commit comments

Comments
 (0)