Commit 7261b0b5 authored by Jeff Avallone's avatar Jeff Avallone

Making propTypes static

parent bf44bce9
Pipeline #43203535 (#48) passed with stages
in 3 minutes and 52 seconds
......@@ -9,13 +9,7 @@ import Loader from 'components/Loader';
import Message from 'components/Message';
class App extends React.PureComponent {
state = {
loading: false,
loadingError: null,
render: {}
}
propTypes = {
static propTypes = {
syntax: PropTypes.string,
expr: PropTypes.string,
permalinkUrl: PropTypes.string,
......@@ -25,6 +19,12 @@ class App extends React.PureComponent {
}))
}
state = {
loading: false,
loadingError: null,
render: {}
}
componentDidMount() {
if (this.props.expr) {
this.handleRender();
......
......@@ -6,12 +6,7 @@ import ExpandIcon from 'react-feather/dist/icons/chevrons-down';
import style from './style.module.css';
class Form extends React.PureComponent {
state = {
expr: this.props.expr,
syntax: this.props.syntax
}
propTypes = {
static propTypes = {
expr: PropTypes.string,
syntax: PropTypes.string,
syntaxList: PropTypes.arrayOf(PropTypes.shape({
......@@ -25,6 +20,11 @@ class Form extends React.PureComponent {
])
}
state = {
expr: this.props.expr,
syntax: this.props.syntax
}
handleSubmit = event => {
event.preventDefault();
......
......@@ -9,12 +9,7 @@ import style from './style.module.css';
import { createPngLink, createSvgLink } from './links';
class FormActions extends React.PureComponent {
state = {
svgLink: null,
pngLink: null
}
propTypes = {
static propTypes = {
permalinkUrl: PropTypes.string,
imageDetails: PropTypes.shape({
svg: PropTypes.string,
......@@ -23,6 +18,11 @@ class FormActions extends React.PureComponent {
})
}
state = {
svgLink: null,
pngLink: null
}
componentDidMount() {
const { imageDetails } = this.props;
......
......@@ -6,7 +6,7 @@ import PlaceholderIcon from 'react-feather/dist/icons/file-text';
import style from './style.module.css';
class Render extends React.PureComponent {
propTypes = {
static propTypes = {
expr: PropTypes.string,
onRender: PropTypes.func.isRequired
}
......
......@@ -5,17 +5,17 @@ import * as Sentry from '@sentry/browser';
import SentryError from 'components/SentryError';
class SentryBoundary extends React.Component {
state = {
hasError: false
}
propTypes = {
static propTypes = {
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node
]).isRequired
}
state = {
hasError: false
}
static getDerivedStateFromError() {
return { hasError: true };
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment