Moving supported syntax list to gatsby-config
This commit is contained in:
@@ -93,7 +93,8 @@ class App extends React.PureComponent {
|
||||
const {
|
||||
syntax,
|
||||
expr,
|
||||
permalinkUrl
|
||||
permalinkUrl,
|
||||
syntaxList
|
||||
} = this.props;
|
||||
const {
|
||||
loading,
|
||||
@@ -105,7 +106,8 @@ class App extends React.PureComponent {
|
||||
const formProps = {
|
||||
onSubmit: this.handleSubmit,
|
||||
syntax,
|
||||
expr
|
||||
expr,
|
||||
syntaxList
|
||||
};
|
||||
const actionProps = {
|
||||
imageDetails,
|
||||
@@ -137,7 +139,11 @@ class App extends React.PureComponent {
|
||||
App.propTypes = {
|
||||
syntax: PropTypes.string,
|
||||
expr: PropTypes.string,
|
||||
permalinkUrl: PropTypes.string
|
||||
permalinkUrl: PropTypes.string,
|
||||
syntaxList: PropTypes.arrayOf(PropTypes.shape({
|
||||
id: PropTypes.string,
|
||||
label: PropTypes.string
|
||||
}))
|
||||
};
|
||||
|
||||
export default App;
|
||||
|
||||
@@ -5,11 +5,6 @@ import ExpandIcon from 'react-feather/dist/icons/chevrons-down';
|
||||
|
||||
import style from './style.module.css';
|
||||
|
||||
const syntaxList = [
|
||||
{ id: 'js', label: 'JavaScript' },
|
||||
{ id: 'pcre', label: 'PCRE' }
|
||||
];
|
||||
|
||||
class Form extends React.PureComponent {
|
||||
state = {
|
||||
expr: this.props.expr,
|
||||
@@ -36,6 +31,7 @@ class Form extends React.PureComponent {
|
||||
|
||||
render() {
|
||||
const {
|
||||
syntaxList,
|
||||
children
|
||||
} = this.props;
|
||||
const { expr, syntax } = this.state;
|
||||
@@ -70,6 +66,10 @@ class Form extends React.PureComponent {
|
||||
Form.propTypes = {
|
||||
expr: PropTypes.string,
|
||||
syntax: PropTypes.string,
|
||||
syntaxList: PropTypes.arrayOf(PropTypes.shape({
|
||||
id: PropTypes.string,
|
||||
label: PropTypes.string
|
||||
})),
|
||||
onSubmit: PropTypes.func.isRequired,
|
||||
children: PropTypes.oneOfType([
|
||||
PropTypes.arrayOf(PropTypes.node),
|
||||
|
||||
Reference in New Issue
Block a user