All files / buffer-web-components/ScheduleSetting/ScheduleTable/ScheduleTableHeader index.jsx

100% Statements 6/6
100% Branches 4/4
100% Functions 2/2
100% Lines 6/6
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            2x           2x             59x                 1x           2x           2x                  
import React from 'react';
import PropTypes from 'prop-types';
import { borderWidth } from '@bufferapp/components/style/border';
import { mystic } from '@bufferapp/components/style/color';
import { Text, Button } from '@bufferapp/components';
 
const headerStyle = {
  paddingTop: '1rem',
  paddingBottom: '1rem',
  borderBottom: `${borderWidth} solid ${mystic}`,
};
 
const ScheduleTableHeader = ({
  dayName,
  paused,
  onPauseToggleClick,
  profileId,
  disabled,
}) => (
  <div style={headerStyle}>
    <Text
      color={'outerSpace'}
      size={'small'}
    >
      {dayName}
    </Text>
 
    {!disabled &&
      <Button linkStyle onClick={() => onPauseToggleClick({ profileId, dayName, paused })}>
        {`Turn ${paused ? 'on' : 'off'}`}
      </Button>}
  </div>
);
 
ScheduleTableHeader.defaultProps = {
  paused: false,
  disabled: false,
};
 
 
ScheduleTableHeader.propTypes = {
  dayName: PropTypes.string.isRequired,
  paused: PropTypes.bool,
  onPauseToggleClick: PropTypes.func.isRequired,
  profileId: PropTypes.string.isRequired,
  disabled: PropTypes.bool,
};
 
export default ScheduleTableHeader;