Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import ContentNode from 'components/ContentNode';
import { dateRegex } from 'utils/regex';
import type { Post as PostType } from 'relay-wordpress';
import PostLink from './PostLink';
type PostProps = {
post: PostType,
};
/* eslint-disable react/no-danger */
class Post extends React.Component {
props: PostProps;
static contextTypes = {
router: routerShape.isRequired,
};
onEmbedClick = () => (e: Event) => {
e.preventDefault();
const { id, date } = this.props.post;
const [, year, month, day] = dateRegex.exec(date);
const url = `/${year}/${month}/${day}/${id}`;
this.context.router.push(url);
};
render() {
const { content: { data: content }, excerpt, featuredMedia } = this.props.post;
const isEmbed = content && content.length && content[0].__typename === 'Embed';
import Wrapper from './Wrapper'
import Bold from './Bold'
import Hint from './Hint'
import FormWraper from './FormWrapper'
import TextInput from '../../components/Input/FormsyText'
import Button from '../../components/Button'
import {
login as loginUser,
loginWithFacebookRoute,
} from '../../auth'
import { ERRORS } from '../../../config'
class LoginPage extends React.Component {
static propTypes = {
router: routerShape.isRequired,
viewer: PropTypes.shape({
isLoggedIn: PropTypes.bool,
}).isRequired,
}
setFormElement = (element) => {
this.formElement = element
}
login = ({ email, password }) => {
loginUser({ email, password })
.then((error) => {
if (error) {
console.error(ERRORS[error.name])
} else {
this.props.router.go(-1)
<ul>
Main
Other
</ul>
{children}
);
}
App.propTypes = appPropTypes;
const mainPropTypes = {
router: routerShape.isRequired,
};
class Main extends React.Component {
constructor(props) {
super(props);
this.state = {
transitionType: 'confirm',
showCustomConfirm: false,
};
this.removeTransitionHook = props.router.addTransitionHook(
this.onTransition,
);
this.resolveCustomConfirm = null;
import StateStorage from 'farce/lib/StateStorage';
import HttpError from 'found/lib/HttpError';
import { routerShape } from 'found/lib/PropTypes';
import PropTypes from 'prop-types';
import React from 'react';
import ScrollBehavior from 'scroll-behavior';
const STORAGE_NAMESPACE = '@@scroll';
const propTypes = {
shouldUpdateScroll: PropTypes.func,
createScrollBehavior: PropTypes.func.isRequired,
renderArgs: PropTypes.shape({
location: PropTypes.object.isRequired,
router: routerShape.isRequired,
elements: PropTypes.array,
error: PropTypes.instanceOf(HttpError),
}).isRequired,
children: PropTypes.node,
};
const defaultProps = {
createScrollBehavior: config => new ScrollBehavior(config),
};
class ScrollManager extends React.Component {
constructor(props, context) {
super(props, context);
const { createScrollBehavior, renderArgs } = props;
const { router } = renderArgs;
settings: Object,
navMenu: Object,
sidebar: Object,
},
children: any,
router: any,
};
@IntlProvider
class App extends React.Component {
static defaultProps = {
children: null,
};
static childContextTypes = {
router: routerShape.isRequired,
};
removeTransitionHook = () => null;
constructor(props: AppProps, context: any) {
super(props, context);
this.removeTransitionHook = props.router.addTransitionHook(this.onTransition);
}
componentWillUnmount() {
this.removeTransitionHook();
}
onTransition = () => {
if (typeof window !== 'undefined') {
return <div>
}
return (
<div>
</div>
)
}
UserPosts.propTypes = {
router: routerShape.isRequired,
permission: PropTypes.shape({
isLoggedIn: PropTypes.bool,
canPublish: PropTypes.bool,
}).isRequired,
posts: PropTypes.shape({
edges: PropTypes.array,
}).isRequired,
hasMore: PropTypes.bool.isRequired,
loadMore: PropTypes.func.isRequired,
}
const fragments = graphql`
fragment UserPosts on Query {
permission {
isLoggedIn
canPublish</div>
export default class Post extends Component {
static propTypes = {
post: PropTypes.shape({
id: PropTypes.string,
slug: PropTypes.string,
date: PropTypes.string,
title: PropTypes.object,
content: PropTypes.object,
excerpt: PropTypes.object,
featuredMedia: PropTypes.object,
}).isRequired,
};
static contextTypes = {
router: routerShape.isRequired,
};
content = null;
bindRef = node => {
this.content = node;
};
onEmbedClick = () => e => {
e.preventDefault();
const { id, date } = this.props.post;
const [, year, month, day] = dateRegex.exec(date);
const url = `/${year}/${month}/${day}/${id}`;
this.context.router.push(url);
};
sidebarID: 'U2lkZWJhcjpzaWRlYmFyLTE=',
},
},
})
@IntlProvider
export default class App extends Component {
static propTypes = {
data: PropTypes.shape({
viewer: PropTypes.shape({
settings: PropTypes.object,
navMenu: PropTypes.object,
sidebar: PropTypes.object,
}),
}).isRequired,
children: PropTypes.node,
router: routerShape.isRequired,
};
static defaultProps = {
children: null,
};
static childContextTypes = {
router: routerShape.isRequired,
};
constructor(props, context) {
super(props, context);
this.removeTransitionHook = props.router.addTransitionHook(this.onTransition);
}
viewer: PropTypes.shape({
settings: PropTypes.object,
navMenu: PropTypes.object,
sidebar: PropTypes.object,
}),
}).isRequired,
children: PropTypes.node,
router: routerShape.isRequired,
};
static defaultProps = {
children: null,
};
static childContextTypes = {
router: routerShape.isRequired,
};
constructor(props, context) {
super(props, context);
this.removeTransitionHook = props.router.addTransitionHook(this.onTransition);
}
componentWillUnmount() {
this.removeTransitionHook();
}
onTransition = () => {
if (typeof window !== 'undefined') {
window.scrollTo(0, 0);
}
import { createFragmentContainer, graphql } from 'react-relay'
import Formsy from 'formsy-react'
import Wrapper from './Wrapper'
import FormWrapper from './FormWrapper'
import TextInput from '../../components/Input/FormsyText'
import Button from '../../components/Button'
import {
register as registerUser,
loginWithFacebookRoute,
} from '../../auth'
import { ERRORS } from '../../../config'
class RegisterPage extends React.Component {
static propTypes = {
router: routerShape.isRequired,
viewer: PropTypes.shape({
isLoggedIn: PropTypes.bool,
}).isRequired,
}
constructor() {
super()
this.state = {
canSubmit: false,
}
}
setFormElement = (element) => {
this.formElement = element
}