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

feat(search): update demo for search #309

Merged
merged 1 commit into from
Nov 1, 2022
Merged
Show file tree
Hide file tree
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
19 changes: 10 additions & 9 deletions src/search/_example/base.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import React, { useState } from 'react';
import { SearchIcon } from 'tdesign-icons-react';
import { Search } from 'tdesign-mobile-react';
import { Search, CellGroup } from 'tdesign-mobile-react';

export default function Base() {
const [value, setValue] = useState('');

return (
<Search
focus={false}
placeholder="搜索预设文案"
value={value}
onChange={(value) => setValue(value)}
action="取消"
leftIcon={<SearchIcon />}
></Search>
<CellGroup title="基础搜索框">
<Search
placeholder="搜索预设文案"
value={value}
onChange={(value) => setValue(value)}
action="取消"
leftIcon={<SearchIcon />}
></Search>
</CellGroup>
);
}
18 changes: 0 additions & 18 deletions src/search/_example/click.jsx

This file was deleted.

18 changes: 0 additions & 18 deletions src/search/_example/color.jsx

This file was deleted.

18 changes: 0 additions & 18 deletions src/search/_example/default.jsx

This file was deleted.

17 changes: 5 additions & 12 deletions src/search/_example/index.jsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
import React from 'react';
import BaseDemo from './base';
import DefaultDemo from './default';
import ClickDemo from './click';
import StateDemo from './state';
import StatusDemo from './status';
import TDemoBlock from '../../../site/mobile/components/DemoBlock';
import TDemoHeader from '../../../site/mobile/components/DemoHeader';
import './style/index.less';

export default function RadioDemo() {
return (
<div className="tdesign-mobile-demo">
<TDemoHeader title="Search 搜索框" summary="用于用户输入搜索信息,并进行页面内容搜索" />
<TDemoBlock title="01 类型" summary="基础搜索框">
<TDemoBlock title="01 类型">
<BaseDemo />
</TDemoBlock>
<TDemoBlock title="02 状态" summary="默认状态">
<DefaultDemo />
</TDemoBlock>
<TDemoBlock title="" summary="点击状态">
<ClickDemo />
</TDemoBlock>
<TDemoBlock title="" summary="输入状态">
<StateDemo />
<TDemoBlock title="02 状态">
<StatusDemo />
</TDemoBlock>
</div>
);
Expand Down
18 changes: 0 additions & 18 deletions src/search/_example/state.jsx

This file was deleted.

43 changes: 43 additions & 0 deletions src/search/_example/status.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import React, { useState } from 'react';
import { SearchIcon } from 'tdesign-icons-react';
import { Search, CellGroup } from 'tdesign-mobile-react';

export default function Base() {
const [value1, setValue1] = useState('搜索预设文案');
const [value2, setValue2] = useState('搜索预设文案');
const [value3, setValue3] = useState('搜索预设文案');

return (
<>
<CellGroup title="默认状态">
<Search
placeholder="搜索预设文案"
value={value1}
onChange={(value) => setValue1(value)}
action="取消"
leftIcon={<SearchIcon />}
></Search>
</CellGroup>
<CellGroup title="点击状态">
<Search
focus={true}
placeholder="搜索预设文案"
value={value2}
onChange={(value) => setValue2(value)}
action="取消"
leftIcon={<SearchIcon />}
></Search>
</CellGroup>
<CellGroup title="输入状态">
<Search
focus={true}
placeholder="搜索预设文案"
value={value3}
onChange={(value) => setValue3(value)}
action="取消"
leftIcon={<SearchIcon />}
></Search>
</CellGroup>
</>
);
}
5 changes: 5 additions & 0 deletions src/search/_example/style/index.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.t-cell-group__title {
font-size: 12px;
line-height: 20px;
padding: 16px;
}
12 changes: 0 additions & 12 deletions src/search/search.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
:: BASE_DOC ::

### 默认状态

{{ default }}

### 点击状态

{{ click }}

### 输入状态

{{ state }}

## API
### Search Props

Expand Down