import React from 'react';
/* !- Constants */
import {
ICON_WIDTH,
} from './const';
/* !- Types */
export enum IconTypes {
COMPLETE = 'complete',
WARNING = 'warning',
ERROR = 'error',
END = 'end',
START = 'start',
}
interface PropTypes
{
status?: IconTypes | 0 | 1,
iconWidth?: number,
index?: number,
}
export const Icon = (
{
iconWidth = ICON_WIDTH,
status,
index = 0,
}: PropTypes) =>
{
const width = iconWidth / 2;
const widthRatio = iconWidth / ICON_WIDTH;
const proportions = (value: number) =>
widthRatio * value;
const proportionsPoints = (points: string) =>
points
.split(' ')
.map(value => proportions(parseFloat(value)))
.join(' ');
const proportionsPath = (points: string) =>
points
.split(' ')
.map(value =>
value
.split(',')
.map(value =>
[...value.matchAll(/[A-Z]|[0-9.]+/g)]
.map(i => isNaN(i[0] as any) ? i[0] : proportions(parseFloat(i[0])))
.join('')
)
.join(',')
)
.join(' ');
console.log(widthRatio, proportions(3));
switch (status)
{
case IconTypes.COMPLETE:
return (
);
case IconTypes.WARNING:
return (
);
case IconTypes.ERROR:
return (
);
case 1:
case IconTypes.END:
return (
);
case IconTypes.START:
default:
return (
)
}
}
export default Icon;