-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
integrate new csv export/download library (#110)
- Loading branch information
Showing
9 changed files
with
1,745 additions
and
4,393 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React from 'react'; | ||
import { useCSVDownloader } from 'react-papaparse'; | ||
|
||
import { classArray } from 'utils.js'; | ||
|
||
const ExportButton = ({ | ||
size = '', | ||
variant = 'primary', | ||
icon = null, | ||
isOutline = false, | ||
isDisabled = false, | ||
filename, | ||
data, | ||
className | ||
}) => { | ||
const { CSVDownloader, Type } = useCSVDownloader(); | ||
|
||
const classes = classArray([ | ||
'btn', | ||
size && size === 'small' ? 'btn-sm' : size === 'large' ? 'btn-lg' : '', | ||
`btn-${isOutline ? 'outline-' : ''}${variant}`, | ||
isDisabled && 'disabled not-allowed', | ||
'pb-2', | ||
className, | ||
]); | ||
|
||
return ( | ||
<CSVDownloader | ||
role='button' | ||
type={Type?.Button} | ||
filename={filename} | ||
bom={true} | ||
data={data} | ||
className={classes} | ||
title='Export as CSV' | ||
disabled={isDisabled} | ||
aria-disabled={isDisabled} | ||
> | ||
{icon} | ||
<> </> | ||
Export as CSV | ||
</CSVDownloader> | ||
); | ||
}; | ||
|
||
export default ExportButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.