Skip to content

Commit

Permalink
refactor(components): Update props in SharePanel and ContentWrap
Browse files Browse the repository at this point in the history
  • Loading branch information
dontry committed Nov 7, 2023
1 parent 7460251 commit eb08cde
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
6 changes: 4 additions & 2 deletions src/components/ContentWrap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1062,8 +1062,10 @@ export default class ContentWrap extends Component {
}
content={
<SharePanel
id={this.props.currentItem.id}
author={window.user ? window.user.displayName : 'author'}
title={
this.props.currentItem && this.props.currentItem.title
}
author={window.user && window.user.displayName}
image={this.state.image}
/>
}
Expand Down
17 changes: 11 additions & 6 deletions src/components/SharePanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class SharePanel extends Component {
};

render() {
const { image, author } = this.props;
const { image, author, title } = this.props;
const { link, isLoading } = this.state;

return (
Expand All @@ -45,7 +45,7 @@ export class SharePanel extends Component {
<h4 style="margin-bottom: 8px;">Preview</h4>
<div className="preview">
<PreviewCard
title="Test Sequence Diagram"
title={title}
author={author}
description="Click and check the latest diagram. Install our Confluence plugin for an enhanced expperience when viewing in Confluence."
image={image}
Expand Down Expand Up @@ -75,9 +75,14 @@ export class SharePanel extends Component {
}
}

SharePanel.defaultProps = {
title: '',
author: '',
image: '',
};

SharePanel.propTypes = {
id: PropTypes.string,
dsl: PropTypes.string,
author: PropTypes.string,
image: PropTypes.string,
title: PropTypes.string.isRequired,
author: PropTypes.string.isRequired,
image: PropTypes.string.isRequired,
};

0 comments on commit eb08cde

Please sign in to comment.