diff --git a/modules/client/autoIndex.js b/modules/client/autoIndex.js index b26b150..d706adb 100644 --- a/modules/client/autoIndex.js +++ b/modules/client/autoIndex.js @@ -1,7 +1,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import App from './autoIndex/App'; +import App from './autoIndex/App.js'; const props = window.__DATA__ || {}; diff --git a/modules/client/autoIndex/App.js b/modules/client/autoIndex/App.js index c70a7f5..6459d1a 100644 --- a/modules/client/autoIndex/App.js +++ b/modules/client/autoIndex/App.js @@ -1,9 +1,8 @@ /** @jsx jsx */ -import React from 'react'; import PropTypes from 'prop-types'; import { Global, css, jsx } from '@emotion/core'; -import DirectoryListing from './DirectoryListing'; +import DirectoryListing from './DirectoryListing.js'; const globalStyles = css` body { @@ -16,69 +15,66 @@ const globalStyles = css` } `; -export default class App extends React.Component { - static defaultProps = { - availableVersions: [] - }; - - handleChange = event => { +export default function App({ + packageName, + packageVersion, + availableVersions = [], + filename, + entry, + entries +}) { + function handleChange(event) { window.location.href = window.location.href.replace( - '@' + this.props.packageVersion, + '@' + packageVersion, '@' + event.target.value ); - }; - - render() { - return ( -
- - -
-

- Index of /{this.props.packageName}@{this.props.packageVersion} - {this.props.filename} -

- -
- Version:{' '} - -
-
- -
- - - -
- -
- {this.props.packageName}@{this.props.packageVersion} -
-
- ); } + + return ( +
+ + +
+

+ Index of /{packageName}@{packageVersion} + {filename} +

+ +
+ Version:{' '} + +
+
+ +
+ + + +
+ +
+ {packageName}@{packageVersion} +
+
+ ); } if (process.env.NODE_ENV !== 'production') { diff --git a/modules/client/main.js b/modules/client/main.js index d2a4dcc..fc643c3 100644 --- a/modules/client/main.js +++ b/modules/client/main.js @@ -1,6 +1,6 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import App from './main/App'; +import App from './main/App.js'; ReactDOM.render(, document.getElementById('root')); diff --git a/modules/client/main/App.js b/modules/client/main/App.js index 7dcf010..c6ceabb 100644 --- a/modules/client/main/App.js +++ b/modules/client/main/App.js @@ -6,8 +6,8 @@ import formatBytes from 'pretty-bytes'; import formatDate from 'date-fns/format'; import parseDate from 'date-fns/parse'; -import formatNumber from '../utils/formatNumber'; -import formatPercent from '../utils/formatPercent'; +import formatNumber from '../utils/formatNumber.js'; +import formatPercent from '../utils/formatPercent.js'; import cloudflareLogo from './CloudflareLogo.png'; import angularLogo from './AngularLogo.png';