- implement gengar template

This commit is contained in:
Amruth Pillai
2020-07-12 19:31:22 +05:30
parent 5ccc360345
commit 41e708e302
24 changed files with 677 additions and 550 deletions

View File

@ -30,6 +30,19 @@ export const getFieldProps = (formik, schema, name) => ({
...formik.getFieldProps(name),
});
export const hexToRgb = (hex) => {
const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
hex = hex.replace(shorthandRegex, (m, r, g, b) => r + r + g + g + b + b);
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result
? {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16),
}
: null;
};
export const reorder = (list, startIndex, endIndex) => {
const result = Array.from(list);
const [removed] = result.splice(startIndex, 1);