Skip to content

Commit

Permalink
Rename Inputs/Fields components. (refinedev#19)
Browse files Browse the repository at this point in the history
* Rename Input -> TextInput.

* Rename Select -> SelectInput

* Rename examples.

* Fixed Select input usage.

* Rename Autocomplete -> AutocompleteInput.
  • Loading branch information
yildirayunlu committed Feb 3, 2021
1 parent e76e03d commit 68770b9
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 27 deletions.
6 changes: 3 additions & 3 deletions example/src/category.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
Edit,
Form,
FormItem,
Input,
TextInput,
} from "readmin";

export const CategoryList = (props: any) => {
Expand All @@ -34,7 +34,7 @@ export const CategoryCreate = (props: any) => {
},
]}
>
<Input />
<TextInput />
</FormItem>
</Form>
</Create>
Expand All @@ -54,7 +54,7 @@ export const CategoryEdit = (props: any) => {
},
]}
>
<Input />
<TextInput />
</FormItem>
</Form>
</Edit>
Expand Down
23 changes: 12 additions & 11 deletions example/src/post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {
Edit,
Form,
FormItem,
Input,
Textarea,
Select,
TextInput,
TextareaInput,
SelectInput,
ReferenceInput,
} from "readmin";

Expand Down Expand Up @@ -43,7 +43,7 @@ export const PostCreate = (props: any) => {
},
]}
>
<Input />
<TextInput />
</FormItem>
<FormItem
label="Url"
Expand All @@ -54,7 +54,7 @@ export const PostCreate = (props: any) => {
},
]}
>
<Input />
<TextInput />
</FormItem>
<FormItem
label="Content"
Expand All @@ -65,7 +65,7 @@ export const PostCreate = (props: any) => {
},
]}
>
<Textarea />
<TextareaInput />
</FormItem>
<FormItem
label="Status"
Expand All @@ -76,7 +76,8 @@ export const PostCreate = (props: any) => {
},
]}
>
<Select
<SelectInput
defaultValue="active"
options={[
{
label: "Active",
Expand Down Expand Up @@ -137,7 +138,7 @@ export const PostEdit = (props: any) => {
},
]}
>
<Input />
<TextInput />
</FormItem>
<FormItem
label="Url"
Expand All @@ -148,7 +149,7 @@ export const PostEdit = (props: any) => {
},
]}
>
<Input />
<TextInput />
</FormItem>
<FormItem
label="Content"
Expand All @@ -159,7 +160,7 @@ export const PostEdit = (props: any) => {
},
]}
>
<Textarea />
<TextareaInput />
</FormItem>
<FormItem
label="Status"
Expand All @@ -170,7 +171,7 @@ export const PostEdit = (props: any) => {
},
]}
>
<Select
<SelectInput
defaultValue="active"
options={[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import React from "react";
import { AutoComplete as AntdAutoComplete } from "antd";
import { AutoCompleteProps } from "antd/lib/auto-complete";

export const AutoComplete: React.FC<AutoCompleteProps> = ({ ...rest }) => {
export const AutoCompleteInput: React.FC<AutoCompleteProps> = ({ ...rest }) => {
return <AntdAutoComplete {...rest} />;
};
6 changes: 3 additions & 3 deletions src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export { Column } from "./column";
export { Create } from "./create";
export { Edit } from "./edit";
export { Form, FormItem } from "./form";
export { Input, Textarea } from "./input";
export { AutoComplete } from "./autocomplete";
export { Select } from "./select";
export { TextInput, TextareaInput } from "./textInput";
export { SelectInput } from "./selectInput";
export { AutoCompleteInput } from "./autocompleteInput";
export { ReferenceInput } from "./referenceInput";
4 changes: 2 additions & 2 deletions src/components/referenceInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useContext } from "react";
import { useQuery } from "react-query";
import { SelectProps } from "antd/lib/select";

import { Select } from "@components";
import { SelectInput } from "@components";
import { DataContext } from "@contexts/data";
import { GetListResponse, IDataContext } from "@interfaces";

Expand Down Expand Up @@ -58,7 +58,7 @@ export const ReferenceInput: React.FC<ReferenceInputProps> = ({
};

return (
<Select
<SelectInput
optionFilterProp="label"
showSearch={showSearch}
onSearch={onSearch}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import React from "react";
import { Select as AntdSelect } from "antd";
import { SelectProps } from "antd/lib/select";

export const Select: React.FC<SelectProps<any>> = ({ ...rest }) => {
export const SelectInput: React.FC<SelectProps<any>> = ({ ...rest }) => {
return <AntdSelect {...rest} />;
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import React from "react";
import { Input as AntdInput } from "antd";
import { InputProps, TextAreaProps } from "antd/lib/input";

export const Input: React.FC<InputProps> = ({ ...rest }) => {
export const TextInput: React.FC<InputProps> = ({ ...rest }) => {
return <AntdInput {...rest} />;
};

export const Textarea: React.FC<TextAreaProps> = ({ ...rest }) => {
export const TextareaInput: React.FC<TextAreaProps> = ({ ...rest }) => {
return <AntdInput.TextArea {...rest} />;
};
8 changes: 4 additions & 4 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ export {
FormItem,
Create,
Edit,
Input,
Textarea,
AutoComplete,
Select,
TextInput,
TextareaInput,
SelectInput,
AutoCompleteInput,
ReferenceInput,
} from "./components";

Expand Down

0 comments on commit 68770b9

Please sign in to comment.