Skip to content
Open
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
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"version": "2.0.4",
"description": "Typing animations with React",
"main": "dist/Typist.js",
"files": ["dist", "src"],
"files": [
"dist",
"src"
],
"scripts": {
"dist": "webpack --config webpack.dist.config.js",
"standalone": "webpack --config webpack.standalone.config.js",
Expand Down
9 changes: 6 additions & 3 deletions src/Typist.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default class Typist extends Component {
static propTypes = {
children: PropTypes.node,
className: PropTypes.string,
container: PropTypes.string,
avgTypingDelay: PropTypes.number,
stdTypingDelay: PropTypes.number,
startDelay: PropTypes.number,
Expand All @@ -24,6 +25,7 @@ export default class Typist extends Component {
}

static defaultProps = {
container: 'div',
className: '',
avgTypingDelay: 70,
stdTypingDelay: 25,
Expand Down Expand Up @@ -182,18 +184,19 @@ export default class Typist extends Component {
}

render() {
const { className, cursor } = this.props;
const { className, cursor, container } = this.props;
const { isDone } = this.state;
const ContainerTag = container;
const innerTree = utils.cloneElementWithSpecifiedText({
element: this.props.children,
textLines: this.state.textLines,
});

return (
<div className={`Typist ${className}`}>
<ContainerTag className={`Typist ${className}`}>
{innerTree}
<Cursor isDone={isDone} {...cursor} />
</div>
</ContainerTag>
);
}

Expand Down