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 ( -