Skip to content
Snippets Groups Projects
Select Git revision
  • fd26955f2ef54bccbaefe34ac4264a9438c52977
  • dev default protected
  • renovate/devdependencies-(non-major)
  • renovate/cozy-realtime-5.x
  • renovate/copy-webpack-plugin-13.x
  • renovate/major-react-monorepo
  • renovate/couchdb-3.x
  • renovate/cozy-device-helper-3.x
  • renovate/cozy-flags-4.x
  • renovate/eslint-config-prettier-10.x
  • renovate/major-react-router-monorepo
  • renovate/major-typescript-eslint-monorepo
  • renovate/sass-loader-16.x
  • renovate/eslint-plugin-testing-library-7.x
  • renovate/cozy-scripts-8.x
  • renovate/cozy-harvest-lib-9.x
  • renovate/cozy-client-49.x
  • build-test protected
  • build-dev protected
  • lint/testing-libraby-plugin
  • build protected
  • v3.1.1
  • v3.1.0
  • v3.0.0
  • v2.8.0
  • v2.7.2
  • v2.7.1
  • v2.7.0
  • v2.6.0
  • v2.5.1
  • v2.5.0
  • v2.4.0
  • v2.3.1
  • v2.3.0
  • v2.2.2
  • v2.2.1
  • v2.2.0
  • v2.1.1
  • v2.1.0
  • v2.0.2
  • v2.0.1
41 results

DateConsumptionVisualizer.tsx

Blame
  • DateConsumptionVisualizer.tsx 1.92 KiB
    import React from 'react'
    import { DateTime } from 'luxon'
    import { TimeStep } from 'services/dataConsumptionContracts'
    
    import DateFormatConsumptionVisualizer from 'components/ContentComponents/ConsumptionVisualizer/DateFormatConsumptionVisualizer'
    import StyledIconbutton from 'components/CommonKit/IconButton/StyledIconButton'
    import LeftArrowIcon from 'assets/icons/ico/left-arrow.svg'
    import RigthArrowIcon from 'assets/icons/ico/right-arrow.svg'
    import DoubleRightArrowIcon from 'assets/icons/ico/double-right-arrow.svg'
    import DoubleLeftArrowIcon from 'assets/icons/ico/double-left-arrow.svg'
    
    interface DateConsumptionVisualizerProps {
      timeStep: TimeStep
      date: DateTime
      indexDisplayed: number
      handleClickMove(increment: number): void
      handleChangeIndex: (index: number) => void
    }
    
    const DateConsumptionVisualizer = ({
      timeStep,
      date,
      indexDisplayed,
      handleClickMove,
      handleChangeIndex,
    }: DateConsumptionVisualizerProps) => {
      return (
        <div className="cv-content-date">
          <div>
            <StyledIconbutton
              className="cv-button-double"
              onClick={() => handleChangeIndex(indexDisplayed + 1)}
              icon={DoubleLeftArrowIcon}
              size={16}
            />
          </div>
          <div>
            <StyledIconbutton
              className="cv-button"
              onClick={() => handleClickMove(-1)}
              icon={LeftArrowIcon}
              size={16}
            />
          </div>
          <DateFormatConsumptionVisualizer timeStep={timeStep} date={date} />
          <div>
            <StyledIconbutton
              className="cv-button"
              onClick={() => handleClickMove(1)}
              icon={RigthArrowIcon}
              size={16}
            />
          </div>
          <div>
            <StyledIconbutton
              className="cv-button-double"
              onClick={() => handleChangeIndex(indexDisplayed - 1)}
              icon={DoubleRightArrowIcon}
              size={16}
            />
          </div>
        </div>
      )
    }
    
    export default DateConsumptionVisualizer