RELEASE 🚒 : 1.0.2

Ability of specifying the "filename" of the downloaded CSV file .

```
 <CSVLink filename={"persons.csv"} data={data}>Click here</CSVLink>
```
This commit is contained in:
abdennour 2017-02-17 21:29:18 +03:00
commit d4544e117e
9 changed files with 4259 additions and 27 deletions

View file

@ -19,9 +19,9 @@ class CSVLink extends React.Component {
}
render(){
const {data, headers, separator, children , ...rest} = this.props;
const {data, headers, separator, filename, children , ...rest} = this.props;
return (
<a {...rest}
<a download={filename} {...rest}
href={this.buildURI(data, headers, separator)}>
{children}
</a>

View file

@ -8,11 +8,13 @@ export const propTypes = {
]).isRequired,
headers: React.PropTypes.array,
target: React.PropTypes.string,
separator: React.PropTypes.string
separator: React.PropTypes.string,
filename: React.PropTypes.string
};
export const defaultProps = {
separator: ','
separator: ',',
filename: 'generatedBy_react-csv.csv'
};
export const PropsNotForwarded = [