// import React, { useState, useEffect } from 'react';
import React from 'react';
// import { timer } from 'rxjs';
import { SBox } from '../../common/s-components/layout/s-box';
import { SRow } from '../../common/s-components/layout/s-row';
import { SCol } from '../../common/s-components/layout/s-col';
import { AnimatedGradient } from '../../common/components/animated-gradient';
import { TRACK_CARD_HEIGHT, TRACK_CARD_MARGIN } from '../../common/constants';

export const Skeleton: React.FC = () => {
  // const [loaded, setLoaded] = useState(false);
  //
  // useEffect(() => {
  //   const timer$ = timer(500).subscribe(() => {
  //     setLoaded(true);
  //   });
  //   return () => timer$.unsubscribe();
  // }, []);
  //
  // if (!loaded) {
  //   return null;
  // }
  const imgHeight = TRACK_CARD_HEIGHT;
  const imgWidth = imgHeight;
  const trackMargin = TRACK_CARD_MARGIN;

  return (
    <SBox px={16} position="relative" mt={110}>
      <SRow mb={trackMargin}>
        <SBox
          bg="eastBay"
          width={imgWidth}
          height={imgHeight}
          borderRadius={10}
          mr={16}
        />
        <SCol>
          <SBox width={128} height={16} mt={18} mb={12} bg="eastBay" />
          <SBox width={192} height={16} bg="eastBay" />
        </SCol>
      </SRow>
      <SRow mb={trackMargin}>
        <SBox
          bg="eastBay"
          width={imgWidth}
          height={imgHeight}
          borderRadius={10}
          mr={16}
        />
        <SCol>
          <SBox width={128} height={16} mt={18} mb={12} bg="eastBay" />
          <SBox width={192} height={16} bg="eastBay" />
        </SCol>
      </SRow>
      <SRow mb={trackMargin}>
        <SBox
          bg="eastBay"
          width={imgWidth}
          height={imgHeight}
          borderRadius={10}
          mr={16}
        />
        <SCol>
          <SBox width={128} height={16} mt={18} mb={12} bg="eastBay" />
          <SBox width={192} height={16} bg="eastBay" />
        </SCol>
      </SRow>
      <SBox position="absolute" top={0} left={0} height="100%" flex={1}>
        <AnimatedGradient angle={8} gradientWidth={160} />
      </SBox>
    </SBox>
  );
};
