Skip to content

Commit

Permalink
Update imports from TextField to ProxyTextField component
Browse files Browse the repository at this point in the history
  • Loading branch information
Viktor Riabkov committed Apr 9, 2024
1 parent ae037db commit a234306
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/entities/activity/ui/AdditionalTextResponse.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import TextField from '@mui/material/TextField';
import { BaseTextInput } from '~/shared/ui';

type AdditionalTextResponseProps = {
type Props = {
value: string;
onValueChange: (value: string) => void;
};

export const AdditionalTextResponse = ({ value, onValueChange }: AdditionalTextResponseProps) => {
export const AdditionalTextResponse = ({ value, onValueChange }: Props) => {
return (
<TextField
<BaseTextInput
fullWidth
size="small"
value={value}
Expand Down
23 changes: 23 additions & 0 deletions src/shared/ui/BaseTextInput/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import TextField, { TextFieldProps } from '@mui/material/TextField';

/**
* Common proxy component of the TextField component by MaterialUI.
*
* @component
* @example
* return (
* <TextField
* fullWidth
* size="small"
* value={value}
* onChange={(e) => onValueChange(e.target.value)}
* disabled={false}
* />
* )
*/

function BaseTextInput(props: TextFieldProps) {
return <TextField {...props} />;
}

export default BaseTextInput;
8 changes: 4 additions & 4 deletions src/shared/ui/Items/Text/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import TextField from '@mui/material/TextField';
import { BaseTextInput } from '~/shared/ui';

type TextItemProps = {
type Props = {
value: string | undefined;
onValueChange: (value: string) => void;
disabled: boolean;
};

export const TextItem = ({ value = '', onValueChange, disabled }: TextItemProps) => {
export const TextItem = ({ value = '', onValueChange, disabled }: Props) => {
return (
<TextField
<BaseTextInput
fullWidth
size="small"
value={value}
Expand Down
1 change: 1 addition & 0 deletions src/shared/ui/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ export * from './MuiModal';
// Common - UI
export * from './Container';
export { default as Box } from './Box';
export { default as BaseTextInput } from './BaseTextInput';

0 comments on commit a234306

Please sign in to comment.