More work in header and distanceslider

This commit is contained in:
vjrj 2017-12-12 00:38:40 +01:00
parent 29f9a2d476
commit 5bed310153
7 changed files with 64 additions and 48 deletions

2
.gitignore vendored
View file

@ -3,6 +3,6 @@ settings-demo.json
settings-staging.json settings-staging.json
settings-production.json settings-production.json
settings-development.json settings-development.json
imports/ui/stylesheets/.sass-cache/
private/GeoLite2-City.mmdb* private/GeoLite2-City.mmdb*
npm-debug.log npm-debug.log
**/.sass-cache

View file

@ -1,16 +1,24 @@
/* eslint-disable react/jsx-indent-props */
/* eslint-disable import/no-absolute-path */
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { Trans, translate } from 'react-i18next'; import { Trans, translate } from 'react-i18next';
import Tooltip from 'rc-tooltip'; import Tooltip from 'rc-tooltip';
import Slider from 'rc-slider'; import Slider from 'rc-slider';
import 'rc-slider/assets/index.css'; import 'rc-slider/assets/index.css';
import './DistanceSlider.scss';
// https://www.npmjs.com/package/rc-slider // https://www.npmjs.com/package/rc-slider
const createSliderWithTooltip = Slider.createSliderWithTooltip; const createSliderWithTooltip = Slider.createSliderWithTooltip;
const Handle = Slider.Handle; const Handle = Slider.Handle;
const handle = (props) => { const handle = (props) => {
const { value, dragging, index, ...restProps } = props; const {
value,
dragging,
index,
...restProps
} = props;
return ( return (
<Tooltip prefixCls="rc-slider-tooltip" overlay={value} visible={dragging} placement="top" key={index} > <Tooltip prefixCls="rc-slider-tooltip" overlay={value} visible={dragging} placement="top" key={index} >
<Handle value={value} {...restProps} /> <Handle value={value} {...restProps} />
@ -18,10 +26,7 @@ const handle = (props) => {
); );
}; };
const wrapperStyle = { width: 400, margin: 50 };
// https://github.com/react-component/slider/tree/master/examples // https://github.com/react-component/slider/tree/master/examples
class DistanceSlider extends React.Component { class DistanceSlider extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -48,39 +53,46 @@ class DistanceSlider extends React.Component {
render() { render() {
return ( return (
<div style={wrapperStyle}> <div className="dist-slider">
<p><Trans parent="span">¿A que distancia a la redonda quieres recibir notificaciones?</Trans></p> <p><Trans parent="span">¿A que distancia a la redonda quieres recibir notificaciones?</Trans></p>
<Slider min={5} <Slider
min={5}
max={105} max={105}
value={this.state.value} value={this.state.value}
trackStyle={{ backgroundColor: 'green', height: 8 }} trackStyle={{ backgroundColor: 'green', height: 8 }}
railStyle={{ backgroundColor: 'orange', height: 8 }} railStyle={{ backgroundColor: 'orange', height: 8 }}
dotStyle={{ top: 0, marginLeft: -1, width: 2, height: 8 }} dotStyle={{
top: 0,
marginLeft: -1,
width: 2,
height: 8
}}
marks={{ marks={{
10: {style: {}, label: "10км"}, 10: { label: '10км' },
20: {style: {}, label: "20"}, 20: { label: '20' },
30: {style: {}, label: "30"}, 30: { label: '30' },
40: {style: {}, label: "40"}, 40: { label: '40' },
50: {style: {}, label: "50"}, 50: { label: '50' },
60: {style: {}, label: "60"}, 60: { label: '60' },
70: {style: {}, label: "70"}, 70: { label: '70' },
80: {style: {}, label: "80"}, 80: { label: '80' },
90: {style: {}, label: "90"}, 90: { label: '90' },
100: {style: {}, label: "100км"} 100: { label: '100км' }
}} }}
handleStyle={{ handleStyle={{
borderColor: 'green', borderColor: 'green',
height: 20, height: 20,
width: 20, width: 20,
marginLeft: -10, marginLeft: -10,
marginTop: -6, marginTop: -6
/* backgroundColor: 'gray', */ /* backgroundColor: 'gray', */
}} }}
onAfterChange={this.onAfterChange} onAfterChange={this.onAfterChange}
onChange={this.onSliderChange} onChange={this.onSliderChange}
defaultValue={10} defaultValue={10}
step={5} step={5}
handle={handle} /> handle={handle}
/>
</div> </div>
); );
} }

View file

@ -0,0 +1,11 @@
.dist-slider {
width: 400px;
margin: 30px;
}
@media only screen and (max-width: 400px) {
.dist-slider {
width: 200px;
margin: 10px;
}
}

View file

@ -9,7 +9,7 @@ const Public = ({ loggingIn, authenticated, component, path, exact, ...rest }) =
render={props => ( render={props => (
!authenticated ? !authenticated ?
(React.createElement(component, { ...props, ...rest, loggingIn, authenticated })) : (React.createElement(component, { ...props, ...rest, loggingIn, authenticated })) :
(<Redirect to="/documents" />) (<Redirect to="/subscriptions" />)
)} )}
/> />
); );

View file

@ -75,7 +75,7 @@ const App = props => (
<Public path="/login" component={Login} {...props} /> <Public path="/login" component={Login} {...props} />
<Route path="/logout" component={Logout} {...props} /> <Route path="/logout" component={Logout} {...props} />
<Route path="/sandbox" component={Sandbox} {...props} /> <Route path="/sandbox" component={Sandbox} {...props} />
<Public path="/subscriptions" component={FireSubscription} focusInput {...props} /> <Route path="/subscriptions" render={props => <FireSubscription focusInput {...props} />} />
<Route name="verify-email" path="/verify-email/:token" component={VerifyEmail} /> <Route name="verify-email" path="/verify-email/:token" component={VerifyEmail} />
<Route name="recover-password" path="/recover-password" component={RecoverPassword} /> <Route name="recover-password" path="/recover-password" component={RecoverPassword} />
<Route name="reset-password" path="/reset-password/:token" component={ResetPassword} /> <Route name="reset-password" path="/reset-password/:token" component={ResetPassword} />
@ -87,7 +87,6 @@ const App = props => (
</Switch> </Switch>
</Grid> </Grid>
<Footer /> <Footer />
{/* <Reconnect /> */} {/* <Reconnect /> */}
<Blaze template="cookieConsent" /> <Blaze template="cookieConsent" />
{/* <Blaze template="cookieConsentImply" /> */} {/* <Blaze template="cookieConsentImply" /> */}

View file

@ -53,12 +53,6 @@ class Login extends React.Component {
Bert.alert(T9n.get(`error.accounts.${error.reason}`), 'danger'); Bert.alert(T9n.get(`error.accounts.${error.reason}`), 'danger');
} else { } else {
Bert.alert(this.t('Bienvenid@ de nuevo'), 'success'); Bert.alert(this.t('Bienvenid@ de nuevo'), 'success');
console.log(this.props.location.state);
if (this.props.location.state &&
this.props.location.state.center &&
this.props.location.state.distance) {
this.props.history.push('/subscriptions', this.props.location.state);
}
} }
}); });
} }

View file

@ -47,13 +47,13 @@ p {
margin-bottom: 20px; } margin-bottom: 20px; }
div.section.platf > div.container { div.section.platf > div.container {
padding: 100px 0; } padding: 70px 0; }
div.section h2 { div.section h2 {
font-size: 50px; } font-size: 50px; }
div.section.crowd > div.container { div.section.crowd > div.container {
position: relative; position: relative;
padding: 150px 0; } padding: 120px 0; }
div.section.crowd h2 { div.section.crowd h2 {
font-size: 50px; font-size: 50px;
margin-top: 20px; } margin-top: 20px; }