-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor and adaptive progress bar #47
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very small and easy fix :)
useEffect(() => { | ||
if (offsetWidth !== width) { | ||
setWidth(offsetWidth); | ||
} | ||
}, [ ref ]); | ||
}, [ offsetWidth ]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to use Layout Effect. useEffect does not work very well with ref changes, as objects make it more difficult to detect changes.
const secondsToHHMMSSFormat = (seconds) => { | ||
return new Date(seconds * 1000).toISOString().substr(11, 8); | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving it out of main component as it's a very generic function. Could be moved to a util file.
@@ -1,71 +1,66 @@ | |||
import React, { Component } from 'react'; | |||
import PropTypes from 'prop-types'; | |||
import React from 'react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General refactor to move to a function based component.
ProgrammeScriptEditor.propTypes = { | ||
handleDelete: PropTypes.any, | ||
handleEdit: PropTypes.any, | ||
handleReorder: PropTypes.any, | ||
items: PropTypes.any, | ||
playlist: PropTypes.any, | ||
title: PropTypes.any | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added propTypes.
|
||
export default ProgramScript; | ||
export default ProgrammeScriptEditor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed, as it was being imported as ProgrammeScriptEditor
@@ -3,7 +3,6 @@ import React from 'react'; | |||
import { storiesOf } from '@storybook/react'; | |||
import { action } from '@storybook/addon-actions'; | |||
import ProgrammeScriptEditor from '../index.js'; | |||
import PreviewCanvas from '../../PreviewCanvas'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused import
Is your Pull Request request related to another issue in this repository ?
Fixes #40
Describe what the PR does
See below in comments:
State whether the PR is ready for review or whether it needs extra work
Ready
Additional context
Post review tasks
release