Skip to content

Commit

Permalink
Make sharelink component asynchronous
Browse files Browse the repository at this point in the history
  • Loading branch information
hamsterbacke23 committed Apr 27, 2018
1 parent f384af2 commit 7853171
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 19 deletions.
6 changes: 1 addition & 5 deletions src/components/shareLink/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ export class ShareLink extends Component {
};

static propTypes = {
activeVideo: PropTypes.object,
show: PropTypes.bool
activeVideo: PropTypes.object
};

togglePanel = () => {
Expand Down Expand Up @@ -51,9 +50,6 @@ export class ShareLink extends Component {
};

render(props, state) {
if (!this.props.show) {
return null;
}
return (
<div className={style.shareContainer}>
<Copy
Expand Down
11 changes: 0 additions & 11 deletions src/components/shareLink/tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,6 @@ const activeVideoTest = {
};

describe('Test of the link sharing component', () => {
test('At least some div should be displayed when component is shown', () => {
const context = shallow(<ShareLink show activeVideo={activeVideoTest} />);
expect(context.find('div').length).toBeGreaterThan(0);
});
test('Should not display when show is set false', () => {
const context = shallow(
<ShareLink show={false} activeVideo={activeVideoTest} />
);
expect(context.find('div').length).toBe(0);
});

test('Sharelink should be with timestamp when time sharing is on', () => {
const context = shallow(<ShareLink show activeVideo={activeVideoTest} />);
context.find('input').simulate('change');
Expand Down
5 changes: 2 additions & 3 deletions src/components/videoPlayer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import style from './style.scss';
import { connect } from 'unistore/preact';
import PropTypes from 'prop-types';
import actions from './actions';
import ShareLink from '../shareLink';
import ShareLink from 'async!../../components/shareLink';

export class VideoPlayer extends Component {
state = {
Expand Down Expand Up @@ -119,8 +119,7 @@ export class VideoPlayer extends Component {
) : (
<div className={style.poster} style={bgImageStyle} />
)}

<ShareLink show={this.state.isPaused} className={style.shareButton} />
{this.state.isPaused && <ShareLink className={style.shareButton} />}
</div>
</div>
);
Expand Down

0 comments on commit 7853171

Please sign in to comment.