# All files / components/TimeScrubber/components TimeScrubberNudgeButton.js

0% Statements 0/19
0% Branches 0/6
0% Functions 0/2
0% Lines 0/8

    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

     import React from 'react';
    import styled from 'styled-components';
    import themeGet from 'extensions/themeGet';
    import Icon from '../../Icon';

    const NudgeButtonBorder = styled.button`
      padding: ${themeGet('spacing.medium')} ${themeGet('spacing.small')};
      border: ${themeGet('thicknesses.wide')} solid
        ${themeGet('colors.border.light')};
      background: ${themeGet('colors.background.default')};
      color: ${themeGet('colors.gray.default')};
      outline: none;
      cursor: pointer;
      transition: 0.2s ease all;

      &:focus,
      &:active {
        outline: none;
      }

      &:focus {
        border-color: ${themeGet('colors.primary.default')};
      }

      &:disabled {
        background: ${themeGet('colors.background.disabled')};
        border-color: ${themeGet('colors.border.disabled')};
        cursor: default;
      }
    `;

    /**
     * A simple button which moves the time scrubber value forward or backward
     */
    const NudgeButton = ({ direction, ...rest }) => (
      <NudgeButtonBorder {...rest}>
        <Icon name={direction === 'left' ? 'back' : 'forward'} />
      </NudgeButtonBorder>
    );

    NudgeButton.defaultProps = {
      direction: 'left',
    };

    export default NudgeButton;