Skip to content

Commit

Permalink
🚀 feat: 검색 옵션, 검색창, 검색 버튼 #4
Browse files Browse the repository at this point in the history
  • Loading branch information
kongnayeon committed Aug 2, 2022
1 parent f25bcef commit 194191b
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 10 deletions.
3 changes: 3 additions & 0 deletions src/apis/users/UsersApi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const { default: axios } = require('axios');

const { default: InstanceSetting } = require('../common/instance.api');
11 changes: 1 addition & 10 deletions src/components/Tables/UsersPage/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ function UsersPageTable() {
};

useEffect(() => {
setPage(page + 1);
dispatch(
usersPage({
requestPage: page
requestPage: 1
})
);
}, [dispatch]);
Expand All @@ -52,14 +51,6 @@ function UsersPageTable() {
}}
key="id"
rowKey="id"
// onRow={(record, rowIndex) => {
// return {
// onClick: event => {
// console.log(event, record);
// onStopClickHandler(record);
// } // click row
// };
// }}
pageSize={10}
dataSource={data ? data.userList : []}
>
Expand Down
43 changes: 43 additions & 0 deletions src/components/Tables/UsersPage/UserSearch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { Button, Input, Select } from 'antd';
import React, { useState } from 'react';
const { Option } = Select;

function UserSearch() {
const [searchOption, setSearchOption] = useState('입금자명');

const onOptionChange = e => {
console.log(e);
if (e === '1') {
setSearchOption('입금자명');
} else {
setSearchOption('전화번호');
}
};

return (
<>
<div className="site-input-group-wrapper">
<Input.Group compact>
<Select defaultValue="입금자명" onChange={onOptionChange}>
<Option key="1" value="1">
입금자명
</Option>
<Option key="2" value="2">
전화번호
</Option>
</Select>
<Input
style={{
width: 'calc(100% - 200px)'
}}
placeholder={`${searchOption} 입력`}
/>
<Button type="primary">검색</Button>
</Input.Group>
<br />
</div>
</>
);
}

export default UserSearch;
2 changes: 2 additions & 0 deletions src/components/Tables/UsersPage/UsersPage.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import React from 'react';
import UsersPageTable from './Table';
import UserSearch from './UserSearch';

function UsersPage() {
return (
<div>
<UserSearch />
<UsersPageTable />
</div>
);
Expand Down

0 comments on commit 194191b

Please sign in to comment.