-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #657 from oceanbase/dengfuping-dev
chore(design): Add icon and dropdown button demo
- Loading branch information
Showing
3 changed files
with
88 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React from 'react'; | ||
import { Dropdown, Space } from '@oceanbase/design'; | ||
import { DownOutlined } from '@oceanbase/icons'; | ||
|
||
const items = [ | ||
{ | ||
key: '1', | ||
label: '1st item', | ||
}, | ||
{ | ||
key: '2', | ||
label: '2nd item', | ||
}, | ||
{ | ||
key: '3', | ||
label: '3rd item', | ||
}, | ||
]; | ||
|
||
const App: React.FC = () => ( | ||
<Space> | ||
<Dropdown.Button | ||
menu={{ | ||
items, | ||
onClick: e => { | ||
console.log('click', e); | ||
}, | ||
}} | ||
> | ||
Dropdown | ||
</Dropdown.Button> | ||
<Dropdown.Button | ||
menu={{ | ||
items, | ||
onClick: e => { | ||
console.log('click', e); | ||
}, | ||
}} | ||
icon={<DownOutlined />} | ||
> | ||
Dropdown | ||
</Dropdown.Button> | ||
</Space> | ||
); | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React, { useState } from 'react'; | ||
import { PlusOutlined } from '@oceanbase/icons'; | ||
import { Button, Divider, Radio, Space } from '@oceanbase/design'; | ||
|
||
const App: React.FC = () => { | ||
const [position, setPosition] = useState<'start' | 'end'>('end'); | ||
|
||
return ( | ||
<> | ||
<Space> | ||
<Radio.Group value={position} onChange={e => setPosition(e.target.value)}> | ||
<Radio.Button value="start">start</Radio.Button> | ||
<Radio.Button value="end">end</Radio.Button> | ||
</Radio.Group> | ||
</Space> | ||
<Divider orientation="left" plain> | ||
Preview | ||
</Divider> | ||
<Space> | ||
<Button type="primary" icon={<PlusOutlined />} iconPosition={position}> | ||
Primary | ||
</Button> | ||
<Button icon={<PlusOutlined />} iconPosition={position}> | ||
Default | ||
</Button> | ||
<Button type="dashed" icon={<PlusOutlined />} iconPosition={position}> | ||
Dashed | ||
</Button> | ||
<Button icon={<PlusOutlined />} iconPosition={position} /> | ||
</Space> | ||
</> | ||
); | ||
}; | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters