react-icons/bi#BiCloudDownload TypeScript Examples
The following examples show how to use
react-icons/bi#BiCloudDownload.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BlockCodeButtons.tsx From hub with Apache License 2.0 | 5 votes |
BlockCodeButtons = (props: Props) => {
const downloadFile = () => {
const blob = new Blob([props.content], {
type: 'text/yaml',
});
const link: HTMLAnchorElement = document.createElement('a');
link.download = props.filename;
link.href = window.URL.createObjectURL(blob);
link.style.display = 'none';
document.body.appendChild(link);
link.click();
};
const btnStyle: undefined | { [key: string]: string } = !isUndefined(props.boxShadowColor)
? {
boxShadow: `0px 0px 0px 8px ${props.boxShadowColor}`,
}
: {};
return (
<div className={`position-absolute d-flex flex-row ${styles.wrapper} ${props.className}`}>
{(isUndefined(props.hiddenCopyBtn) || !props.hiddenCopyBtn) && (
<ButtonCopyToClipboard
wrapperClassName="me-2"
text={props.content}
style={btnStyle}
tooltipType={props.tooltipType}
/>
)}
<button
className={`btn btn-sm btn-primary rounded-circle fs-5 ${styles.btn}`}
style={btnStyle}
onClick={downloadFile}
aria-label="Download"
>
<BiCloudDownload aria-hidden="true" />
</button>
</div>
);
}