1- import React from 'react'
1+ import React , { Component } from 'react'
22import { Link } from 'react-router-dom'
33import { Location , Markdown } from '../shared/Tools'
44import Stars from './Stars'
55
6+ class AnimateLink extends Component {
7+ constructor ( props ) {
8+ super ( props )
9+ this . state = { show : false }
10+ }
11+
12+ async componentDidMount ( ) {
13+ setTimeout ( ( ) => this . setState ( { show : true } ) , this . props . delay || 0 )
14+ }
15+
16+ render ( ) {
17+ const extra_classes = this . props . className ? this . props . className + ' ' : ''
18+ return (
19+ < Link to = { this . props . to } className = { extra_classes + 'tcs-animate-entry' + ( this . state . show ? ' show' : '' ) } >
20+ { this . props . children }
21+ </ Link >
22+ )
23+ }
24+ }
25+
626export const Grid = ( { contractors, root} ) => (
727 < div className = "tcs-flex" >
828 { contractors . map ( ( contractor , i ) => (
9- < div key = { i } className = "tcs-col" >
10- < Link to = { root . url ( contractor . link ) } className = "tcs-item tcs-box" >
29+ < AnimateLink key = { i } delay = { i * 50 } to = { root . url ( contractor . link ) } className = "tcs-col" >
30+ < div className = "tcs-item tcs-box" >
1131 < img src = { contractor . photo } alt = { contractor . name } className = "tcs-thumb" />
1232 < h3 className = "tcs-name" > { contractor . name } </ h3 >
13- </ Link >
14- </ div >
33+ </ div >
34+ </ AnimateLink >
1535 ) ) }
1636 </ div >
1737)
1838
1939export const List = ( { contractors, root} ) => (
2040 < div className = "tcs-list" >
2141 { contractors . map ( ( contractor , i ) => (
22- < Link key = { i } to = { root . url ( contractor . link ) } className = "tcs-item" >
42+ < AnimateLink key = { i } delay = { i * 80 } to = { root . url ( contractor . link ) } className = "tcs-item" >
2343 < div className = "tcs-image-col tcs-box" >
2444 < img src = { contractor . photo } alt = { contractor . name } className = "tcs-thumb" />
2545 < button className = "tcs-button" >
@@ -46,7 +66,7 @@ export const List = ({contractors, root}) => (
4666 < span > { contractor . town } </ span >
4767 </ div >
4868 </ div >
49- </ Link >
69+ </ AnimateLink >
5070 ) ) }
5171 </ div >
5272)
0 commit comments