Skip to content

Commit de4eac4

Browse files
committed
Merge branch 'main' into deploy
2 parents 2703f02 + 15b2d25 commit de4eac4

5 files changed

Lines changed: 15 additions & 16 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "avatar",
33
"private": true,
4-
"version": "0.0.1",
4+
"version": "0.0.2",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

src/components/perfect-scrollbar/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ export default function PerfectScrollbar(props: IProps) {
8686
if (!sections) {
8787
return null;
8888
}
89-
// @ts-ignore
9089
return (
9190
<div ref={scrollWrapper} style={{ position: 'relative', overflowY: 'auto', overflowX: 'hidden' }} className='configurator-scroll'>
9291
<div className='configurator'>

src/components/react-color-avatar/index.tsx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { CSSProperties, RefObject, useEffect, useState } from 'react';
22
import { Background } from '@/components/widgets';
3-
import { WidgetType, WrapperShape } from '@/enums';
4-
import { AvatarOption } from '@/types';
3+
import { WidgetShape, WidgetType, WrapperShape } from '@/enums';
4+
import { AvatarOption, Widget } from '@/types';
55
import { AVATAR_LAYER, NONE } from '@/constants';
66
import { widgetData } from '@/utils/dynamic-data';
77
import './style.less';
@@ -20,24 +20,25 @@ export default function ReactColorAvatar(props: IReactColorAvatarProps) {
2020
(async () => {
2121
const sortedList = Object.entries(avatarOption.widgets).sort(
2222
([prevShape, prev], [nextShape, next]) => {
23-
// @ts-ignore
24-
const ix = prev.zIndex ?? AVATAR_LAYER[prevShape]?.zIndex ?? 0;
25-
// @ts-ignore
26-
const iix = next.zIndex ?? AVATAR_LAYER[nextShape]?.zIndex ?? 0;
27-
return ix - iix;
23+
const prevZIndex = prev.zIndex ?? AVATAR_LAYER[prevShape as WidgetType]?.zIndex ?? 0;
24+
const nextZIndex = next.zIndex ?? AVATAR_LAYER[nextShape as WidgetType]?.zIndex ?? 0;
25+
return prevZIndex - nextZIndex;
2826
}
2927
);
3028

31-
const promises = sortedList.map(async ([widgetType, opt]) => {
32-
// @ts-ignore
29+
const getWidgetSvg = async (widgetType: WidgetType, opt: Widget<WidgetShape>) => {
3330
if (opt.shape !== NONE && widgetData?.[widgetType]?.[opt.shape]) {
34-
// @ts-ignore
3531
return (await widgetData[widgetType][opt.shape]()).default;
3632
}
3733
return '';
34+
};
35+
36+
const promises = sortedList.map(async ([widgetType, opt]) => {
37+
return getWidgetSvg(widgetType as WidgetType, opt);
3838
});
3939

40-
let skinColor: any;
40+
41+
let skinColor: string | undefined;
4142

4243
const svgRawList = await Promise.all(promises).then((raw) =>
4344
raw.map((svgRaw, i) => {

src/layouts/container/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ export default function Container(props: IProps) {
4242
)
4343
if (avatarEle) {
4444
const html2canvas = (await import('html2canvas')).default
45-
// @ts-ignore
4645
const canvas = await html2canvas(avatarEle, {
4746
backgroundColor: null,
4847
})

src/types/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ import {
1818

1919
export type None = typeof NONE
2020

21-
interface Widget<Shape> {
21+
export interface Widget<Shape> {
2222
shape: Shape | None
2323
zIndex?: number
2424
fillColor?: string
2525
strokeColor?: string
2626
}
2727

28-
type AvatarWidgets = {
28+
export type AvatarWidgets = {
2929
face: Widget<FaceShape>
3030
tops: Widget<TopsShape>
3131
ear: Widget<EarShape>

0 commit comments

Comments
 (0)