Skip to content

Commit b43be26

Browse files
committed
feat: added hairStyle "beanie"
"Hooray, A Task!"
1 parent 76430a0 commit b43be26

File tree

6 files changed

+35
-5
lines changed

6 files changed

+35
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ The options can be passed into genConfig or as React props
6868
| `faceColor` | string | | | |
6969
| `earSize` | string | | small, big | |
7070
| `hairColor` | string | | | |
71-
| `hairStyle` | string | | normal, thick, mohawk, womanLong, womanShort | |
71+
| `hairStyle` | string | | normal, thick, mohawk, womanLong, womanShort, beanie | |
7272
| `hairColorRandom` | boolean | false | | thick,mohawk default only be black |
7373
| `eyeStyle` | string | | circle, oval, smile | |
7474
| `glassesStyle` | string | | none, round, square | Usually is none |

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 === "beanie" })}
230+
onClick={this.updateConfig.bind(this, "hairStyle", "beanie")}>
231+
Beanie
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' | 'beanie',
1313
eyeStyle?: 'circle' | 'oval' | 'smile',
1414
glassesStyle?: 'round' | 'square' | 'none',
1515
noseStyle?: 'short' | 'long' | 'round',

src/hair/beanie.js

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/hair/index.js

Lines changed: 3 additions & 1 deletion
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 Beanie from "./beanie";
89

910
export default function (props) {
1011
const { style, color, colorRandom } = props;
@@ -13,7 +14,8 @@ 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} />;
16-
case "normal":
17+
case 'beanie': return <Beanie color={color} />;
18+
case "normal":
1719
default:
1820
return <Normal color={color} />;
1921
}

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","beanie"];
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","beanie"]),
5050
hairColorRandom: PropTypes.bool,
5151
eyeStyle: PropTypes.oneOf(["circle", "oval", "smile"]),
5252
glassesStyle: PropTypes.oneOf(["round", "square", "none"]),

0 commit comments

Comments
 (0)