@@ -11,44 +11,18 @@ import { downloadPath, introductionPath } from "app/routes"
1111
1212import pkg from "projectRoot/package.json"
1313import { StatusBadges , InstallNpm , InstallAssets } from "./markdownContent"
14+ import { ANIMATION_DATA } from "./animations"
1415
1516import "./styles.scss"
1617
1718export default class Home extends React . Component {
18- ANIMATION_DATA = [
19- {
20- title : "Tiny" ,
21- subtitle :
22- "CSS and JS under 12kb minified + gzipped; you can be assured performance isn’t an issue." ,
23- animation : null ,
24- } ,
25- {
26- title : "Modular" ,
27- subtitle :
28- "Include only the pieces you need, or even namespace the components for existing projects." ,
29- animation : null ,
30- } ,
31- {
32- title : "Configurable" ,
33- subtitle :
34- "Built for a great developer experience, you can customize and extend the library with ease." ,
35- animation : null ,
36- } ,
37- {
38- title : "Accessible" ,
39- subtitle :
40- "Interactive components are designed with WAI-ARIA guidelines in mind to ensure your HTML is accessible." ,
41- animation : null ,
42- } ,
43- ]
44-
4519 componentDidMount ( ) {
4620 Prism . highlightAll ( )
4721 this . loadAnimations ( )
4822 }
4923
5024 loadAnimations ( ) {
51- this . ANIMATION_DATA . forEach ( data => {
25+ ANIMATION_DATA . forEach ( data => {
5226 const name = data . title . toLowerCase ( )
5327
5428 const loadedAnimation = lottie . loadAnimation ( {
@@ -64,28 +38,24 @@ export default class Home extends React.Component {
6438 } )
6539
6640 window . setTimeout ( ( ) => {
67- this . ANIMATION_DATA . forEach ( lottieInstance => lottieInstance . animation . play ( ) )
41+ ANIMATION_DATA . forEach ( instance => instance . animation . play ( ) )
6842 } , 1500 )
6943 }
7044
7145 componentWillUnmount ( ) {
72- this . ANIMATION_DATA . forEach ( lottieInstance => lottieInstance . animation . destroy ( ) )
73- }
74-
75- renderAnimatedIcon ( name ) {
76- return < div className = "animated-icon" id = { `animated-${ name } ` } />
46+ ANIMATION_DATA . forEach ( instance => instance . animation . destroy ( ) )
7747 }
7848
7949 renderAnimations ( ) {
80- return this . ANIMATION_DATA . map ( animation => {
50+ return ANIMATION_DATA . map ( animation => {
8151 const animationName = animation . title . toLowerCase ( )
8252
8353 return (
8454 < li
8555 className = "large-3 small-6 xsmall-12 columns has-center-text has-no-padding-bottom"
8656 key = { animation . title }
8757 >
88- { this . renderAnimatedIcon ( animationName ) }
58+ < div className = "animated-icon" id = { `animated- ${ animationName } ` } />
8959 < h2 className = "h6 has-white-text" > { animation . title } </ h2 >
9060 < p className = "has-white-text" > { animation . subtitle } </ p >
9161 </ li >
0 commit comments