@@ -6,6 +6,8 @@ import MoreShades from './Components/MoreShades';
66import CreatePalette from './Components/CreatePalette' ;
77import { generateColors } from './colorHelper' ;
88import { Route , Switch } from 'react-router-dom' ;
9+ import { CSSTransition , TransitionGroup } from 'react-transition-group' ;
10+ import './App.css' ;
911
1012class App extends Component {
1113 constructor ( props ) {
@@ -44,14 +46,60 @@ class App extends Component {
4446 }
4547 render ( ) {
4648 return (
47- < Switch >
48- < Route exact path = '/palette/create' render = { ( routeProps ) => < CreatePalette palettes = { this . state . palettes } savePalette = { this . savePalette } { ...routeProps } /> } />
49- < Route exact path = '/' render = { ( routeProps ) => < PaletteList palettes = { this . state . palettes } deletePalette = { this . deletePalette } { ...routeProps } /> } />
50- < Route exact path = '/palette/:id' render = { ( routeProps ) => < Palette palette = { generateColors ( this . findPalette ( routeProps . match . params . id ) , 10 ) } /> } />
51- < Route exact path = '/palette/:paletteId/:colorId' render = { ( routeProps ) =>
52- < MoreShades colorId = { routeProps . match . params . colorId } palette = { generateColors ( this . findPalette ( routeProps . match . params . paletteId ) , 10 ) } /> }
49+ < Route render = { ( { location} ) => (
50+ < TransitionGroup >
51+ < CSSTransition key = { location . key } classNames = 'fade' timeout = { 500 } >
52+ < Switch location = { location } >
53+ < Route exact
54+ path = '/palette/create'
55+ render = { ( routeProps ) =>
56+ < div className = "page" >
57+ < CreatePalette
58+ palettes = { this . state . palettes }
59+ savePalette = { this . savePalette }
60+ { ...routeProps }
61+ />
62+ </ div >
63+ }
64+ />
65+ < Route exact
66+ path = '/'
67+ render = { ( routeProps ) =>
68+ < div className = "page" >
69+ < PaletteList
70+ palettes = { this . state . palettes }
71+ deletePalette = { this . deletePalette }
72+ { ...routeProps }
73+ />
74+ </ div >
75+ }
76+ />
77+ < Route exact
78+ path = '/palette/:id'
79+ render = { ( routeProps ) =>
80+ < div className = "page" >
81+ < Palette
82+ palette = { generateColors ( this . findPalette ( routeProps . match . params . id ) , 10 ) }
83+ />
84+ </ div >
85+ }
86+ />
87+ < Route exact
88+ path = '/palette/:paletteId/:colorId'
89+ render = { ( routeProps ) =>
90+ < div className = "page" >
91+ < MoreShades
92+ colorId = { routeProps . match . params . colorId }
93+ palette = { generateColors ( this . findPalette ( routeProps . match . params . paletteId ) , 10 ) }
94+ />
95+ </ div >
96+ }
5397 />
5498 </ Switch >
99+ </ CSSTransition >
100+ </ TransitionGroup >
101+ ) } >
102+ </ Route >
55103
56104 // <div className="App">
57105 //<Palette palette={generateColors(seedPalettes[1], 10)}/>
0 commit comments