diff --git a/package.json b/package.json index 577274f..9d9c860 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "gatsby-transformer-sharp": "^2.1.8", "geolib": "^2.0.24", "highland": "^2.13.0", + "js-cookie": "^2.2.1", "lodash.isequal": "^4.5.0", "mapbox-gl": "^0.53.0-beta.1", "prop-types": "^15.6.2", diff --git a/src/components/Navbar.js b/src/components/Navbar.js index e98d8a3..80442a2 100644 --- a/src/components/Navbar.js +++ b/src/components/Navbar.js @@ -15,6 +15,7 @@ import BarsIcon from '../images/icons/bars.svg' import ExclamationTriangleIcon from '../images/icons/exclamation-triangle.svg' import { Link } from 'gatsby' import theme from 'utils/theme' +import Cookies from 'js-cookie'; const responsiveWidth = '1100px' const Brand = styled(Link)` @@ -230,6 +231,8 @@ const MobileNavShortcut = styled('div')` transition: background .2s; ` class AppNavbar extends Component { + + constructor(props) { super(props); this.toggle = this.toggle.bind(this); @@ -246,12 +249,23 @@ const MobileNavShortcut = styled('div')` window.dispatchEvent(new Event('resize')); } } + + componentDidMount(){ + if(Cookies.get('didUserHideBanner')==='true'){ + this.setState({ + banner: false + }) + } + } + toggle() { this.setState({ isOpen: !this.state.isOpen }); } + hideBanner = () => { + Cookies.set('didUserHideBanner', 'true', { expires: 1 }) this.setState({ banner:false }) diff --git a/yarn.lock b/yarn.lock index d907738..79097f4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6886,6 +6886,11 @@ jpeg-js@^0.2.0: resolved "https://registry.yarnpkg.com/jpeg-js/-/jpeg-js-0.2.0.tgz#53e448ec9d263e683266467e9442d2c5a2ef5482" integrity sha1-U+RI7J0mPmgyZkZ+lELSxaLvVII= +js-cookie@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/js-cookie/-/js-cookie-2.2.1.tgz#69e106dc5d5806894562902aa5baec3744e9b2b8" + integrity sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ== + js-levenshtein@^1.1.3: version "1.1.6" resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.6.tgz#c6cee58eb3550372df8deb85fad5ce66ce01d59d"