Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
feat: add cookie notice (#795)
Browse files Browse the repository at this point in the history
* feat: add cookie notice

* fix: remove wrong text

* fix: prevent flickering of cookie notice

* fix: move display logic
  • Loading branch information
tilmx authored and yuzl committed May 20, 2019
1 parent 5711b86 commit 1eb9b71
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"dependencies": {
"@emotion/styled": "^10.0.6",
"@meetalva/alva-design": "^1.4.4",
"@meetalva/alva-design": "^1.6.2",
"@types/react": "16.4.11",
"@types/react-helmet": "5.0.6",
"react": "16.4.2",
Expand Down
26 changes: 26 additions & 0 deletions packages/site/src/cookie-notice.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import * as React from 'react';
import * as D from '@meetalva/alva-design';

export class CookieNotice extends React.Component {
public state = {
display:
typeof document !== 'undefined' && document.cookie.indexOf('hidecookienotice=1') === -1
};

public render() {
return (
this.state.display === true && (
<D.CookieNotice
text="This website uses cookies to ensure you get the best experience on our website."
linkText="Learn more"
linkHref="doc/docs/privacypolicy"
buttonText="Got it"
buttonOnClick={() => {
document.cookie = 'hidecookienotice=1;path=/';
this.setState({ display: false });
}}
/>
)
);
}
}
9 changes: 2 additions & 7 deletions packages/site/src/site.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as React from 'react';
import { Helmet } from 'react-helmet';
import * as D from '@meetalva/alva-design';
import { Releases } from './releases';
import { CookieNotice } from './cookie-notice';

export * from './render';

Expand Down Expand Up @@ -155,13 +156,6 @@ const Page: React.StatelessComponent<void> = (): JSX.Element => {
}
/>
<D.Space size={D.SpaceSize.XL} />
<D.Feature
featureLevel={D.FeatureLevel.Medium}
headline="Sketch Integration (coming soon)"
copy="Integrate Sketch into your prototyping workflow and seamlessly export code to Sketch and import your design drafts to the prototype. Coming later this year."
layout={D.FeatureLayout.Center}
/>
<D.Space size={D.SpaceSize.XL} />
<D.Space size={D.SpaceSize.XL} />

<D.Teaser
Expand Down Expand Up @@ -334,6 +328,7 @@ const Page: React.StatelessComponent<void> = (): JSX.Element => {
href="./doc/docs/privacypolicy?guides-enabled=true"
/>
</D.Footer>
<CookieNotice />
</div>
);
};
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1013,10 +1013,10 @@
mkdirp "^0.5.1"
rimraf "^2.5.2"

"@meetalva/alva-design@^1.4.4":
version "1.4.4"
resolved "https://registry.yarnpkg.com/@meetalva/alva-design/-/alva-design-1.4.4.tgz#e48d307e5927453f790d8d651bb8bb8c6e3b7e06"
integrity sha512-rc22upg5LUMx8r1MW+tHUjh3kajiA4PhI/jFxG4K+30r8OmR6hlD8C9FunN2yldMO7oFhnLdHwJLhTM3ymV4RQ==
"@meetalva/alva-design@^1.6.2":
version "1.6.2"
resolved "https://registry.yarnpkg.com/@meetalva/alva-design/-/alva-design-1.6.2.tgz#c9890817b8cfa443e99bcb72994a7d6d50babd64"
integrity sha512-XnpY/WA/TYluWftDoKybhFPzWViRFQg83aYDEbU7uILLgrWYe1zPWVf+nJztrpr+1PYR5r6iisWpDoqhcIhm5g==
dependencies:
"@emotion/core" "^10.0.6"
"@emotion/styled" "^10.0.6"
Expand Down

1 comment on commit 1eb9b71

@marionebl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.