import * as React from 'react' ; import { SpinkitProps , DEFAULT_SIZE , DEFAULT_COLOR } from '../types' ; import { roundTo } from '../util' ; import { Child , StyledCubeGrid } from './styles' ; const CubeGrid = ( { size = DEFAULT_SIZE , color = DEFAULT_COLOR , className , } ) => { const range = 0.4 ; const cubes = [ 0.5 , 0.75 , 1 , 0.25 , 0.5 , 0.75 , 0 , 0.25 , 0.5 ] . map ( ( v ) => roundTo ( range * v , 2 ) ) . map ( ( v , k ) => < Child key = { k } delay = { v } / > ) ; return ( < StyledCubeGrid className = { className } size = { size } color = { color } > { cubes } < /StyledCubeGrid>); } ; export default CubeGrid ;