Skip to content
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

likhith/migrate read-more to tsx #28

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ReadMore from './read-more.jsx';
import ReadMore from './read-more';
import './read-more.scss';

export default ReadMore;
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import React from 'react';
import classNames from 'classnames';
import PropTypes from 'prop-types';

const ReadMore = ({ className, collapse_length, expand_text, openDialog, show_dialog, text }) => {
type TReadMore = {
className?: string;
collapse_length: number;
expand_text: string;
openDialog: () => void;
show_dialog?: boolean;
text: string;
};

const ReadMore = ({ className, collapse_length, expand_text, openDialog, show_dialog, text }: TReadMore) => {
const [content, updateContent] = React.useState('');
const [is_collapsed, setIsCollapsed] = React.useState(true);

Expand Down Expand Up @@ -41,14 +49,5 @@ const ReadMore = ({ className, collapse_length, expand_text, openDialog, show_di
</React.Fragment>
);
};
ReadMore.propTypes = {
className: PropTypes.string,
collapse_length: PropTypes.number,
collapse_text: PropTypes.string,
expand_text: PropTypes.string,
openDialog: PropTypes.func,
show_dialog: PropTypes.bool,
text: PropTypes.string,
};

export default ReadMore;