This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// InputField.js | |
import React from 'react'; | |
export const InputField = ({ | |
value, | |
name, | |
type, | |
style, | |
onChange |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Field.js | |
import React from 'react'; | |
const onHandleChange = (validate, onChange) => event => { | |
const { value } = event.target; | |
const isValid = validate(value); | |
onChange(value, isValid); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TextareaField.js | |
const onHandleChange = (validate, onChange) => event => { | |
const { value } = event.target; | |
const isValid = validate(value); | |
onChange(value, isValid); | |
} | |
export const TextareaField = ({ | |
value, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SelectField.js | |
const onHandleChange = (validate, onChange) => event => { | |
const { value } = event.target; | |
const isValid = validate(value); | |
onChange(value, isValid); | |
} | |
export const SelectField = ({ | |
value, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// InputField.js | |
const onHandleChange = (validate, onChange) => event => { | |
const { value } = event.target; | |
const isValid = validate(value); | |
onChange(value, isValid); | |
} | |
const getStyle = isValid => ({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const replaceKey = (filter, key, replace) => { | |
return Object.keys(filter).reduce((result, k) => { | |
if (k === key) { | |
result[replace] = filter[k]; | |
} else { | |
result[k] = filter[k]; | |
} | |
return result; | |
}, {}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class App extends React.Component { | |
constructor() { | |
super(); | |
this.state = { | |
active: true, | |
} | |
} | |
onClick(event) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Button = ({ description, onClick }) => { | |
return ( | |
<button onClick={onClick}>{description}</button> | |
); | |
} | |
class App extends React.Component { | |
constructor() { | |
super(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Button = ({ description }) => { | |
return React.createElement('button', null, description); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Button = ({ description }) => <button>{description}</button>; |