Skip to content
This repository was archived by the owner on Oct 25, 2021. It is now read-only.

Commit c66d566

Browse files
committed
Beef it up, add some docs, refine build process.
1 parent 11ee4d5 commit c66d566

File tree

13 files changed

+275
-566
lines changed

13 files changed

+275
-566
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
node_modules
2-
dist

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

README.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# TypeIt - React
2+
3+
The official React component for [TypeIt](https://github.com/alexmacarthur/typeit), the most versatile JavaScript animated typing utility on the planet. You can use it to bring dynamic typewriter effects to your React applications.
4+
5+
## License Options
6+
7+
Use this component in an open source or personal project for free. For commercial projects, the following licenses are available. A single license will cover use of this component, as well as TypeItJS itself.
8+
9+
- Single Commercial License - [Purchase Here](https://typeitjs.com/checkout/limited)
10+
- Extended Commercial License - [Purchase Here](https://typeitjs.com/checkout/unlimited)
11+
12+
## Usage
13+
14+
### The Simplest Example
15+
16+
In its simplest implementation, import the component and wrap some text to be typed.
17+
18+
```js
19+
import TypeIt from "typeit-react";
20+
21+
export default () => {
22+
return (
23+
<div className="App">
24+
<TypeIt>This will be typed in a `span` element!</TypeIt>
25+
</div>
26+
);
27+
};
28+
```
29+
30+
Note: This approach will cause the string to first be rendered in the markup and _then_ picked up by TypeIt, which might be desired if you're using it with a statically rendered application (ex: GatsbyJS). However, it may also cause a brief flash of text when the page loads. For an alternative way to define strings, see below.
31+
32+
### Customizing Your Options
33+
34+
To tweak the animation to your liking, pass an object as the `options` prop. All options supported by TypeIt can be used here. Using this prop, you can also set strings without passing them as children. To view all options, see [TypeIt's documentation](https://typeitjs.com/docs#options).
35+
36+
```javascript
37+
import TypeIt from "typeit-react";
38+
39+
export default () => {
40+
return (
41+
<div className="App">
42+
<TypeIt
43+
options={{
44+
strings: ["This will be typed!"],
45+
speed: 10,
46+
waitUntilVisible: true
47+
}}
48+
/>
49+
</div>
50+
);
51+
};
52+
```
53+
54+
### Choose Your Own Element
55+
56+
Out of the box, a `span` element is used to contain the typing animation. To choose your own element, use the `element` prop.
57+
58+
```javascript
59+
import TypeIt from "typeit-react";
60+
61+
export default () => {
62+
return (
63+
<div className="App">
64+
<TypeIt element={"h3"}>This will be typed in an H3 tag.</TypeIt>
65+
</div>
66+
);
67+
};
68+
```
69+
70+
## Need Help?
71+
72+
If you're working with a custom implementation of TypeIt and would like some help, I'm available for hire. [Get in touch!](https://macarthur.me/contact)
73+
74+
## License
75+
76+
[GPL-2.0](https://github.com/alexmacarthur/typeit/blob/master/LICENSE) © Alex MacArthur

babel.config.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
1-
const browsers = {
2-
default: ["> 2%", "Last 2 versions", "safari >=9", "not ie < 11"],
3-
modern: [
4-
"Edge >= 16",
5-
"Firefox >= 60",
6-
"Chrome >= 61",
7-
"Safari >= 11",
8-
"Opera >= 48"
9-
]
10-
};
11-
121
module.exports = {
132
presets: [
143
[
154
"@babel/preset-env",
165
{
176
targets: {
18-
browsers: browsers[process.env.BROWSER_TYPE]
7+
browsers: ["> 2%", "Last 2 versions"]
198
}
209
}
2110
],

dist/typeit-react.es.min.js

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)