Skip to content

Commit 16c3cc8

Browse files
authored
Merge pull request #1 from Just-Feeshy/master
Modernized the Haxe React Route Lib
2 parents 07d617c + 8cd121b commit 16c3cc8

10 files changed

+47
-11
lines changed

src/react/router/IndexLink.hx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
package react.router;
22

3-
@:jsRequire('react-router', 'IndexLink')
3+
#if (jsImport)
4+
@:js.import('react-router-dom', 'IndexLink')
5+
#else
6+
@:jsRequire('react-router-dom', 'IndexLink')
7+
#end
48
extern class IndexLink extends react.ReactComponent {}

src/react/router/IndexRedirect.hx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
package react.router;
22

3-
@:jsRequire('react-router', 'IndexRedirect')
3+
#if (jsImport)
4+
@:js.import('react-router-dom', 'IndexRedirect')
5+
#else
6+
@:jsRequire('react-router-dom', 'IndexRedirect')
7+
#end
48
extern class IndexRedirect extends react.ReactComponent {}

src/react/router/IndexRoute.hx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
package react.router;
22

3-
@:jsRequire('react-router', 'IndexRoute')
3+
#if (jsImport)
4+
@:js.import('react-router-dom', 'IndexRoute')
5+
#else
6+
@:jsRequire('react-router-dom', 'IndexRoute')
7+
#end
48
extern class IndexRoute extends react.ReactComponent {}

src/react/router/Link.hx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
package react.router;
22

3-
@:jsRequire('react-router','Link')
3+
#if (jsImport)
4+
@:js.import('react-router-dom', 'Link')
5+
#else
6+
@:jsRequire('react-router-dom', 'Link')
7+
#end
48
extern class Link extends react.ReactComponent {}

src/react/router/Redirect.hx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
package react.router;
22

3-
@:jsRequire('react-router', 'Redirect')
3+
#if (jsImport)
4+
@:js.import('react-router-dom', 'Redirect')
5+
#else
6+
@:jsRequire('react-router-dom', 'Redirect')
7+
#end
48
extern class Redirect extends react.ReactComponent {}

src/react/router/Route.hx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
package react.router;
22

3-
@:jsRequire('react-router', 'Route')
3+
#if (jsImport)
4+
@:js.import('react-router-dom', 'Route')
5+
#else
6+
@:jsRequire('react-router-dom', 'Route')
7+
#end
48
extern class Route extends react.ReactComponent {}

src/react/router/Router.hx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
package react.router;
22

3-
@:jsRequire('react-router', 'Router')
3+
#if (jsImport)
4+
@:js.import('react-router-dom', 'Router')
5+
#else
6+
@:jsRequire('react-router-dom', 'Router')
7+
#end
48
extern class Router extends react.ReactComponent {}

src/react/router/RouterContext.hx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
package react.router;
22

3-
@:jsRequire('react-router', 'RouterContext')
3+
#if (jsImport)
4+
@:js.import('react-router-dom', 'RouterContext')
5+
#else
6+
@:jsRequire('react-router-dom', 'RouterContext')
7+
#end
48
extern class RouterContext extends react.ReactComponent {}

src/react/router/Statics.hx

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ package react.router;
22

33
import react.router.Types;
44

5-
@:jsRequire('react-router')
5+
#if (jsImport)
6+
@:js.import(@default 'react-router-dom')
7+
#else
8+
@:jsRequire('react-router-dom')
9+
#end
610
extern class Statics {
711
static public var hashHistory:HashHistory;
812
static public var browserHistory:BrowserHistory;

src/react/router/Types.hx

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ typedef Any = Dynamic;
1111
typedef HashHistory = Router<Any, Any>;
1212
typedef BrowserHistory = Router<Any, Any>;
1313
typedef RouteProps = RoutePropsOf<Any, Any>;
14-
typedef RoutePropsOfParams<P> = RoutePropsOf<P, Any>;
15-
typedef RoutePropsOfQuery<Q> = RoutePropsOf<Any, Q>;
14+
typedef RoutePropsOfParams<P> = RoutePropsOf<P, Any>;
15+
typedef RoutePropsOfQuery<Q> = RoutePropsOf<Any, Q>;
1616

1717
typedef RoutePropsOf<P, Q> = {
1818
route:Route<P, Q>,

0 commit comments

Comments
 (0)