fixing issue with IE11

This commit is contained in:
Jason Salzman
2017-01-23 19:28:39 -08:00
parent a718d883a7
commit b4a1337142
5 changed files with 14982 additions and 14929 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2016 Jason Salzman Copyright (c) 2016-2017 Jason Salzman
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
+1 -1
View File
@@ -88,4 +88,4 @@ The examples are hosted within the docs folder and are ran in the simple add tha
## License ## License
Copyright (c) 2016 Jason Salzman. Licensed under MIT license, see [LICENSE](LICENSE) for the full license. Copyright (c) 2016-2017 Jason Salzman. Licensed under MIT license, see [LICENSE](LICENSE) for the full license.
+3900 -3848
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -2,7 +2,7 @@
"author": "Jason Salzman", "author": "Jason Salzman",
"name": "react-add-to-calendar", "name": "react-add-to-calendar",
"description": "A simple and reusable add to calendar button component for React", "description": "A simple and reusable add to calendar button component for React",
"version": "0.0.6", "version": "0.0.7",
"license": "MIT", "license": "MIT",
"homepage": "https://github.com/jasonsalzman/react-add-to-calendar", "homepage": "https://github.com/jasonsalzman/react-add-to-calendar",
"repository": { "repository": {
+30 -29
View File
@@ -1,6 +1,4 @@
import React, { import React, {Component} from 'react';
Component,
} from 'react';
import helpersClass from './helpers'; import helpersClass from './helpers';
const helpers = new helpersClass(); const helpers = new helpersClass();
@@ -43,8 +41,7 @@ export default class ReactAddToCalendar extends React.Component {
e.preventDefault(); e.preventDefault();
let url = e.currentTarget.getAttribute('href'); let url = e.currentTarget.getAttribute('href');
if (this.state.isCrappyIE && (e.currentTarget.getAttribute('class') === 'ical-link' || if (this.state.isCrappyIE) {
e.currentTarget.getAttribute('class') === 'outlook-calendar-link')) {
let blob = new Blob([url], {type: 'text/calendar'}); let blob = new Blob([url], {type: 'text/calendar'});
window.navigator.msSaveOrOpenBlob(blob, 'download.ics'); window.navigator.msSaveOrOpenBlob(blob, 'download.ics');
} else { } else {
@@ -63,15 +60,15 @@ export default class ReactAddToCalendar extends React.Component {
let icon = null; let icon = null;
if (self.props.displayItemIcons) { if (self.props.displayItemIcons) {
let currentIcon = (currentItem === 'outlook') ? 'windows' : currentItem; let currentIcon = (currentItem === 'outlook')
? 'windows'
: currentItem;
icon = <i className={'fa fa-' + currentIcon}/>; icon = <i className={'fa fa-' + currentIcon}/>;
} }
return ( return (
<li key={helpers.getRandomKey()}> <li key={helpers.getRandomKey()}>
<a className={currentItem + '-link'} onClick={self.handleDropdownLinkClick} <a className={currentItem + '-link'} onClick={self.handleDropdownLinkClick} href={helpers.buildUrl(self.props.event, currentItem, self.state.isCrappyIE)} target="_blank">
href={helpers.buildUrl(self.props.event, currentItem, self.state.isCrappyIE)}
target="_blank">
{icon} {icon}
{currentLabel}</a> {currentLabel}</a>
</li> </li>
@@ -97,20 +94,22 @@ export default class ReactAddToCalendar extends React.Component {
let buttonIconClass = 'react-add-to-calendar__icon--' + iconPlacement + ' fa fa-'; let buttonIconClass = 'react-add-to-calendar__icon--' + iconPlacement + ' fa fa-';
if (template[0] === 'caret') { if (template[0] === 'caret') {
buttonIconClass += (this.state.optionsOpen) ? 'caret-up' : 'caret-down'; buttonIconClass += (this.state.optionsOpen)
? 'caret-up'
: 'caret-down';
} else { } else {
buttonIconClass += template[0]; buttonIconClass += template[0];
} }
buttonIcon = <i className={buttonIconClass}/>; buttonIcon = <i className={buttonIconClass}/>;
buttonLabel = (iconPlacement === 'right') ? buttonLabel = (iconPlacement === 'right')
( ? (
<span> <span>
{buttonLabel + ' '} {buttonLabel + ' '}
{buttonIcon} {buttonIcon}
</span> </span>
) : )
( : (
<span> <span>
{buttonIcon} {buttonIcon}
{' ' + buttonLabel} {' ' + buttonLabel}
@@ -118,12 +117,13 @@ export default class ReactAddToCalendar extends React.Component {
); );
} }
let buttonClass = (this.state.optionsOpen) ? this.props.buttonClassClosed + ' ' + this.props.buttonClassOpen : this.props.buttonClassClosed; let buttonClass = (this.state.optionsOpen)
? this.props.buttonClassClosed + ' ' + this.props.buttonClassOpen
: this.props.buttonClassClosed;
return ( return (
<div className={this.props.buttonWrapperClass}> <div className={this.props.buttonWrapperClass}>
<a className={buttonClass} <a className={buttonClass} onClick={this.toggleCalendarDropdown}>{buttonLabel}</a>
onClick={this.toggleCalendarDropdown}>{buttonLabel}</a>
</div> </div>
); );
} }
@@ -158,13 +158,7 @@ ReactAddToCalendar.propTypes = {
buttonWrapperClass: React.PropTypes.string, buttonWrapperClass: React.PropTypes.string,
displayItemIcons: React.PropTypes.bool, displayItemIcons: React.PropTypes.bool,
dropdownClass: React.PropTypes.string, dropdownClass: React.PropTypes.string,
event: React.PropTypes.shape({ event: React.PropTypes.shape({title: React.PropTypes.string, description: React.PropTypes.string, location: React.PropTypes.string, startTime: React.PropTypes.string, endTime: React.PropTypes.string}).isRequired,
title: React.PropTypes.string,
description: React.PropTypes.string,
location: React.PropTypes.string,
startTime: React.PropTypes.string,
endTime: React.PropTypes.string
}).isRequired,
listItems: React.PropTypes.arrayOf(React.PropTypes.object), listItems: React.PropTypes.arrayOf(React.PropTypes.object),
rootClass: React.PropTypes.string rootClass: React.PropTypes.string
}; };
@@ -173,7 +167,9 @@ ReactAddToCalendar.defaultProps = {
buttonClassClosed: 'react-add-to-calendar__button', buttonClassClosed: 'react-add-to-calendar__button',
buttonClassOpen: 'react-add-to-calendar__button--light', buttonClassOpen: 'react-add-to-calendar__button--light',
buttonLabel: 'Add to My Calendar', buttonLabel: 'Add to My Calendar',
buttonTemplate: { caret: 'right' }, buttonTemplate: {
caret: 'right'
},
buttonWrapperClass: 'react-add-to-calendar__wrapper', buttonWrapperClass: 'react-add-to-calendar__wrapper',
displayItemIcons: true, displayItemIcons: true,
dropdownClass: 'react-add-to-calendar__dropdown', dropdownClass: 'react-add-to-calendar__dropdown',
@@ -185,10 +181,15 @@ ReactAddToCalendar.defaultProps = {
endTime: '2016-09-16T21:45:00-04:00' endTime: '2016-09-16T21:45:00-04:00'
}, },
listItems: [ listItems: [
{ apple: 'Apple Calendar' }, {
{ google: 'Google' }, apple: 'Apple Calendar'
{ outlook: 'Outlook' }, }, {
{ yahoo: 'Yahoo' } google: 'Google'
}, {
outlook: 'Outlook'
}, {
yahoo: 'Yahoo'
}
], ],
rootClass: 'react-add-to-calendar' rootClass: 'react-add-to-calendar'
}; };