Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Commit

Permalink
Always show cookie alert for person visiting the site for the first t…
Browse files Browse the repository at this point in the history
…ime (#143)
  • Loading branch information
Fredrik Folkesson authored Jan 23, 2019
1 parent cda05ee commit b243fe8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 21 deletions.
25 changes: 11 additions & 14 deletions src/components/error-reporting.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,17 @@ export default function useErrorReporting({ GA }) {
};
}, [GA]);

if (GA) {
return (
<CookieConsent
buttonText="Got it!"
style={{ background: '#5F6062', color: '#D6D6D6', fontSize: '2rem' }}
buttonStyle={{ color: '#fff', background: '#3D8706', fontSize: '2rem' }}
>
This website uses cookies to ensure you get the best experience on our website.
{' '}
<a href="https://www.qlik.com/us/legal/cookies-and-privacy-policy" target="_blank" rel="noopener noreferrer" style={{ color: '#D6D6D6' }}>Learn more</a>
</CookieConsent>
);
}
return null;
return (
<CookieConsent
buttonText="Got it!"
style={{ background: '#5F6062', color: '#D6D6D6', fontSize: '2rem' }}
buttonStyle={{ color: '#fff', background: '#3D8706', fontSize: '2rem' }}
>
This website uses cookies to ensure you get the best experience on our website.
{' '}
<a href="https://www.qlik.com/us/legal/cookies-and-privacy-policy" target="_blank" rel="noopener noreferrer" style={{ color: '#D6D6D6' }}>Learn more</a>
</CookieConsent>
);
}

useErrorReporting.propTypes = {
Expand Down
7 changes: 0 additions & 7 deletions test/comp/error-reporting.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ import renderer from 'react-test-renderer';
import UseErrorReporting from '../../src/components/error-reporting';

describe('error-reporting', () => {
it('should return ´null´ if GA not set', () => {
const tree = renderer.create(<UseErrorReporting GA={null} />).toJSON();

expect(tree).toMatchSnapshot();
global.window.close();
});

it('should display cookie if not set', () => {
const sandbox = sinon.createSandbox();
sandbox.stub(ReactGA, 'initialize');
Expand Down

0 comments on commit b243fe8

Please sign in to comment.