Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: migrate HiddenControl component from jsx to tsx #17315

Merged
merged 4 commits into from
Nov 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,14 @@
* under the License.
*/
import React from 'react';
import PropTypes from 'prop-types';
import { Input } from 'src/common/components';

const propTypes = {
onChange: PropTypes.func,
value: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
PropTypes.object,
PropTypes.bool,
PropTypes.array,
PropTypes.func,
]),
};

const defaultProps = {
onChange: () => {},
};
interface HiddenControlsProps {
onChange: () => void;
value: string | number | readonly string[] | undefined;
}

export default function HiddenControl(props) {
export default function HiddenControl(props: HiddenControlsProps) {
// This wouldn't be necessary but might as well
return <Input type="hidden" value={props.value} />;
}

HiddenControl.propTypes = propTypes;
HiddenControl.defaultProps = defaultProps;