diff --git a/app/components/Tip.js b/app/components/Tip.js new file mode 100644 index 000000000..89e5d79d1 --- /dev/null +++ b/app/components/Tip.js @@ -0,0 +1,59 @@ +// @flow +import * as React from 'react'; +import styled from 'styled-components'; +import { CloseIcon } from 'outline-icons'; +import Button from './Button'; +import Tooltip from './Tooltip'; +import Flex from 'shared/components/Flex'; + +type Props = { + id: string, + children: React.Node, +}; + +type State = { + isHidden: boolean, +}; + +class Tip extends React.Component { + state = { + isHidden: window.localStorage.getItem(this.storageId) === 'hidden', + }; + + get storageId() { + return `tip-${this.props.id}`; + } + + hide = () => { + window.localStorage.setItem(this.storageId, 'hidden'); + this.setState({ isHidden: true }); + }; + + render() { + const { children } = this.props; + if (this.state.isHidden) return null; + + return ( + + {children} + + +