Elements promoting the survey inside Maputnik
This commit is contained in:
Gregory Wolanski 2018-06-25 19:52:48 +02:00
parent 9208115981
commit b7a97cf8ee
10 changed files with 3314 additions and 3158 deletions

6326
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -49,6 +49,7 @@
"react-codemirror2": "^4.2.1", "react-codemirror2": "^4.2.1",
"react-collapse": "^4.0.3", "react-collapse": "^4.0.3",
"react-color": "^2.14.1", "react-color": "^2.14.1",
"react-cookie": "^2.1.6",
"react-copy-to-clipboard": "^5.0.1", "react-copy-to-clipboard": "^5.0.1",
"react-dom": "^16.3.2", "react-dom": "^16.3.2",
"react-file-reader-input": "^1.1.4", "react-file-reader-input": "^1.1.4",

View file

@ -1,8 +1,10 @@
import React from 'react' import React from 'react'
import {instanceOf} from 'prop-types';
import Mousetrap from 'mousetrap' import Mousetrap from 'mousetrap'
import cloneDeep from 'lodash.clonedeep' import cloneDeep from 'lodash.clonedeep'
import clamp from 'lodash.clamp' import clamp from 'lodash.clamp'
import {arrayMove} from 'react-sortable-hoc'; import {arrayMove} from 'react-sortable-hoc';
import {withCookies, Cookies} from 'react-cookie'
import url from 'url' import url from 'url'
import MapboxGlMap from './map/MapboxGlMap' import MapboxGlMap from './map/MapboxGlMap'
@ -18,6 +20,7 @@ import ExportModal from './modals/ExportModal'
import SourcesModal from './modals/SourcesModal' import SourcesModal from './modals/SourcesModal'
import OpenModal from './modals/OpenModal' import OpenModal from './modals/OpenModal'
import ShortcutsModal from './modals/ShortcutsModal' import ShortcutsModal from './modals/ShortcutsModal'
import SurveyModal from './modals/SurveyModal'
import { downloadGlyphsMetadata, downloadSpriteMetadata } from '../libs/metadata' import { downloadGlyphsMetadata, downloadSpriteMetadata } from '../libs/metadata'
import * as styleSpec from '@mapbox/mapbox-gl-style-spec/style-spec' import * as styleSpec from '@mapbox/mapbox-gl-style-spec/style-spec'
@ -50,7 +53,11 @@ function updateRootSpec(spec, fieldName, newValues) {
} }
} }
export default class App extends React.Component { class App extends React.Component {
static propTypes = {
cookies: instanceOf(Cookies).isRequired
}
constructor(props) { constructor(props) {
super(props) super(props)
this.revisionStore = new RevisionStore() this.revisionStore = new RevisionStore()
@ -172,6 +179,7 @@ export default class App extends React.Component {
open: false, open: false,
shortcuts: false, shortcuts: false,
export: false, export: false,
survey: this.props.cookies.get('survey') ? false : true
}, },
mapOptions: { mapOptions: {
showTileBoundaries: queryUtil.asBool(queryObj, "show-tile-boundaries") showTileBoundaries: queryUtil.asBool(queryObj, "show-tile-boundaries")
@ -449,6 +457,10 @@ export default class App extends React.Component {
[modalName]: !this.state.isOpen[modalName] [modalName]: !this.state.isOpen[modalName]
} }
}) })
if(modalName === 'survey') {
this.props.cookies.set('survey');
}
} }
render() { render() {
@ -528,6 +540,10 @@ export default class App extends React.Component {
isOpen={this.state.isOpen.sources} isOpen={this.state.isOpen.sources}
onOpenToggle={this.toggleModal.bind(this, 'sources')} onOpenToggle={this.toggleModal.bind(this, 'sources')}
/> />
<SurveyModal
isOpen={this.state.isOpen.survey}
onOpenToggle={this.toggleModal.bind(this, 'survey')}
/>
</div> </div>
return <AppLayout return <AppLayout
@ -540,3 +556,5 @@ export default class App extends React.Component {
/> />
} }
} }
export default withCookies(App)

View file

@ -16,6 +16,7 @@ import MdInsertEmoticon from 'react-icons/lib/md/insert-emoticon'
import MdFontDownload from 'react-icons/lib/md/font-download' import MdFontDownload from 'react-icons/lib/md/font-download'
import HelpIcon from 'react-icons/lib/md/help-outline' import HelpIcon from 'react-icons/lib/md/help-outline'
import InspectionIcon from 'react-icons/lib/md/find-in-page' import InspectionIcon from 'react-icons/lib/md/find-in-page'
import SurveyIcon from 'react-icons/lib/md/assignment-turned-in'
import logoImage from 'maputnik-design/logos/logo-color.svg' import logoImage from 'maputnik-design/logos/logo-color.svg'
import pkgJson from '../../package.json' import pkgJson from '../../package.json'
@ -52,6 +53,28 @@ class ToolbarLink extends React.Component {
} }
} }
class ToolbarLinkHighlighted extends React.Component {
static propTypes = {
className: PropTypes.string,
children: PropTypes.node,
href: PropTypes.string,
onToggleModal: PropTypes.func
}
render() {
return <a
className={classnames('maputnik-toolbar-link', "maputnik-toolbar-link--highlighted2", this.props.className)}
href={this.props.href}
rel="noopener noreferrer"
target="_blank"
>
<span className="maputnik-toolbar-link-wrapper">
{this.props.children}
</span>
</a>
}
}
class ToolbarAction extends React.Component { class ToolbarAction extends React.Component {
static propTypes = { static propTypes = {
children: PropTypes.node, children: PropTypes.node,
@ -146,6 +169,10 @@ export default class Toolbar extends React.Component {
<HelpIcon /> <HelpIcon />
<IconText>Help</IconText> <IconText>Help</IconText>
</ToolbarLink> </ToolbarLink>
<ToolbarLinkHighlighted href={"https://gregorywolanski.typeform.com/to/cPgaSY"}>
<SurveyIcon />
<IconText>Take the Maputnik Survey</IconText>
</ToolbarLinkHighlighted>
</div> </div>
</div> </div>
</div> </div>

View file

@ -0,0 +1,36 @@
import React from 'react'
import PropTypes from 'prop-types'
import Button from '../Button'
import Modal from './Modal'
import Logo from './../../img/maputnik.png'
class SurveyModal extends React.Component {
static propTypes = {
isOpen: PropTypes.bool.isRequired,
onOpenToggle: PropTypes.func.isRequired,
}
constructor(props) { super(props); }
render() {
return <Modal
data-wd-key="modal-survey"
isOpen={this.props.isOpen}
onOpenToggle={this.props.onOpenToggle}
title={'Maputnik Survey'}
>
<div style={{width: 372, paddingBottom: "0"}}>
<img src="./../../img/maputnik.png" alt="" width="128" style={{display:"block",margin:"0 auto"}} />
<h1>You + Maputnik = Maputnik better for you</h1>
<p style={{lineHeight:1.5}}>We dont track you, so we dont know how you use Maputnik. Help us make Maputnik better for you by completing a 7minute survey carried out by our contributing designer.
</p>
<a href="https://gregorywolanski.typeform.com/to/cPgaSY" target="_blank" rel="noopener noreferrer" className="maputnik-button maputnik-big-button maputnik-white-button maputnik-green-hover-button maputnik-wide-button">Take the Maputnik Survey</a>
<p className="green" style={{margin:"16px 0 0"}}>It takes 7 minutes, tops! Every question is optional.</p>
</div>
</Modal>
}
}
export default SurveyModal

View file

@ -1,8 +1,10 @@
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import { CookiesProvider } from 'react-cookie'
import './favicon.ico' import './favicon.ico'
import './styles/index.scss' import './styles/index.scss'
import App from './components/App'; import App from './components/App';
ReactDOM.render(<App/>, document.querySelector("#app")); ReactDOM.render(<CookiesProvider><App/></CookiesProvider>, document.querySelector("#app"));

View file

@ -80,3 +80,7 @@ a {
.hide { .hide {
display: none !important; display: none !important;
} }
.green {
color: $color-green;
}

View file

@ -56,6 +56,7 @@
border-width: 0; border-width: 0;
border-radius: 2px; border-radius: 2px;
box-sizing: border-box; box-sizing: border-box;
text-decoration: none;
&:hover { &:hover {
background-color: lighten($color-midgray, 12); background-color: lighten($color-midgray, 12);
@ -70,6 +71,25 @@
font-size: $font-size-5; font-size: $font-size-5;
} }
.maputnik-wide-button {
padding: $margin-2 $margin-3;
}
.maputnik-green-button {
background-color: $color-green;
color: $color-black;
}
.maputnik-green-hover-button:hover, .maputnik-green-hover-button:focus {
background-color: $color-green;
color: $color-white;
}
.maputnik-white-button {
background-color: $color-white;
color: $color-black;
}
.maputnik-icon-button { .maputnik-icon-button {
background-color: transparent; background-color: transparent;
@ -135,9 +155,3 @@
color: $color-red; color: $color-red;
} }
} }
.maputnik-dialog {
&__buttons {
text-align: right;
}
}

View file

@ -57,6 +57,33 @@
} }
} }
.maputnik-toolbar-link--highlighted {
color: $color-green;
}
.maputnik-toolbar-link--highlighted2 {
line-height: 1;
padding: $margin-2 $margin-3;
.maputnik-toolbar-link-wrapper {
background-color: $color-white;
border-radius: 2px;
padding: $margin-2;
margin-top: $margin-1;
color: $color-black;
display: block;
}
&:hover {
background-color: $color-black;
}
&:hover .maputnik-toolbar-link-wrapper {
background-color: $color-green;
color: $color-white;
}
}
.maputnik-toolbar-version { .maputnik-toolbar-version {
font-size: 10px; font-size: 10px;
margin-left: 4px; margin-left: 4px;

View file

@ -4,6 +4,7 @@ $color-midgray: #36383e;
$color-lowgray: #8e8e8e; $color-lowgray: #8e8e8e;
$color-white: #f0f0f0; $color-white: #f0f0f0;
$color-red: #cf4a4a; $color-red: #cf4a4a;
$color-green: #53b972;
$margin-1: 3px; $margin-1: 3px;
$margin-2: 5px; $margin-2: 5px;
$margin-3: 10px; $margin-3: 10px;