Codeminer42/cm42-central

View on GitHub
app/assets/javascripts/components/story/ExpandedStory/ExpandedStoryTitle.jsx

Summary

Maintainability
A
0 mins
Test Coverage
import React from 'react';
import PropTypes from 'prop-types';
import { editingStoryPropTypesShape } from '../../../models/beta/story';
import ExpandedStorySection from './ExpandedStorySection';

const ExpandedStoryTitle = ({ story, onEdit, titleRef, disabled }) => (
  <ExpandedStorySection title={I18n.t('activerecord.attributes.story.title')}>
    <input
      value={story._editing.title}
      ref={titleRef}
      className="form-control input-sm"
      readOnly={disabled}
      onChange={event => onEdit(event.target.value)}
    />
  </ExpandedStorySection>
);

ExpandedStoryTitle.propTypes = {
  story: editingStoryPropTypesShape.isRequired,
  onEdit: PropTypes.func.isRequired,
  disabled: PropTypes.bool.isRequired,
};

export default ExpandedStoryTitle;