Imported config files and start script from new create react app

This commit is contained in:
Alejandro Celaya
2019-01-05 22:54:54 +01:00
parent 835d54e90c
commit 08488e9bad
13 changed files with 767 additions and 810 deletions

View File

@@ -1,21 +1,35 @@
import React from 'react';
import PropTypes from 'prop-types';
import Paginator from './Paginator';
const ShortUrls = (SearchBar, ShortUrlsList) => (props) => {
const { match: { params }, shortUrlsList } = props;
const { page, serverId } = params;
const { data = [], pagination } = shortUrlsList;
const ShortUrls = (SearchBar, ShortUrlsList) => {
const propTypes = {
match: PropTypes.shape({
params: PropTypes.object,
}),
shortUrlsList: PropTypes.object,
};
// Using a key on a component makes react to create a new instance every time the key changes
const urlsListKey = `${serverId}_${page}`;
const ShortUrlsComponent = (props) => {
const { match: { params }, shortUrlsList } = props;
const { page, serverId } = params;
const { data = [], pagination } = shortUrlsList;
return (
<div className="shlink-container">
<div className="form-group"><SearchBar /></div>
<ShortUrlsList {...props} shortUrlsList={data} key={urlsListKey} />
<Paginator paginator={pagination} serverId={serverId} />
</div>
);
// Using a key on a component makes react to create a new instance every time the key changes
const urlsListKey = `${serverId}_${page}`;
return (
<div className="shlink-container">
<div className="form-group"><SearchBar /></div>
<ShortUrlsList {...props} shortUrlsList={data} key={urlsListKey} />
<Paginator paginator={pagination} serverId={serverId} />
</div>
);
};
ShortUrlsComponent.propTypes = propTypes;
return ShortUrlsComponent;
};
export default ShortUrls;

View File

@@ -10,6 +10,7 @@ const TagsSelector = (colorGenerator) => class TagsSelector extends React.Compon
static propTypes = {
tags: PropTypes.arrayOf(PropTypes.string).isRequired,
onChange: PropTypes.func.isRequired,
listTags: PropTypes.func,
placeholder: PropTypes.string,
tagsList: PropTypes.shape({
tags: PropTypes.arrayOf(PropTypes.string),