Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 7x 6x 2x 6x 2x 3x 2x 7x 2x 5x 4x | /* * List of string constants to represent different props */ const LOADING: string = "loading"; const COLOR: string = "color"; const CSS: string = "css"; const SIZE: string = "size"; const SIZE_UNIT: string = "sizeUnit"; const WIDTH: string = "width"; const WIDTH_UNIT: string = "widthUnit"; const HEIGHT: string = "height"; const HEIGHT_UNIT: string = "heightUnit"; const RADIUS: string = "radius"; const RADIUS_UNIT: string = "radiusUnit"; const MARGIN: string = "margin"; /* * Array for onlyUpdateForKeys function */ const commonStrings: string[] = [LOADING, COLOR, CSS]; const sizeStrings: string[] = [SIZE, SIZE_UNIT]; const heightWidthString: string[] = [HEIGHT, HEIGHT_UNIT, WIDTH, WIDTH_UNIT]; export const sizeKeys: string[] = commonStrings.concat(sizeStrings); export const sizeMarginKeys: string[] = sizeKeys.concat([MARGIN]); export const heightWidthKeys: string[] = commonStrings.concat(heightWidthString); export const heightWidthRadiusKeys: string[] = heightWidthKeys.concat([ RADIUS, RADIUS_UNIT, MARGIN ]); /* * DefaultProps object for different loaders */ export interface DefaultProps { [key: string]: boolean | string | {} | number; } type HeightWidthFunction = (height: number, width: number) => DefaultProps; type HeightWidthRadiusFunction = (height: number, width: number, radius?: number) => DefaultProps; type SizeFunction = (size: number) => DefaultProps; const commonValues: DefaultProps = { [LOADING]: true, [COLOR]: "#000000", [CSS]: {} }; const heightWidthValues: HeightWidthFunction = (height: number, width: number): DefaultProps => ({ [HEIGHT]: height, [HEIGHT_UNIT]: "px", [WIDTH]: width, [WIDTH_UNIT]: "px" }); const sizeValues: SizeFunction = (sizeValue: number): DefaultProps => ({ [SIZE]: sizeValue, [SIZE_UNIT]: "px" }); export const sizeDefaults: SizeFunction = (sizeValue: number): DefaultProps => { return Object.assign({}, commonValues, sizeValues(sizeValue)); }; export const sizeMarginDefaults: SizeFunction = (sizeValue: number): DefaultProps => { return Object.assign({}, sizeDefaults(sizeValue), { [MARGIN]: "2px" }); }; export const heightWidthDefaults: HeightWidthFunction = ( height: number, width: number ): DefaultProps => { return Object.assign({}, commonValues, heightWidthValues(height, width)); }; export const heightWidthRadiusDefaults: HeightWidthRadiusFunction = ( height: number, width: number, radius: number = 2 ): DefaultProps => { return Object.assign({}, heightWidthDefaults(height, width), { [RADIUS]: radius, [RADIUS_UNIT]: "px", [MARGIN]: "2px" }); }; |