-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(empty): actions add support for events
- Loading branch information
1 parent
601b5d1
commit fb9e2f0
Showing
12 changed files
with
177 additions
and
16 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
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
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,22 @@ | ||
import React from 'react' | ||
import { Empty, Toast } from '@nutui/nutui-react' | ||
|
||
const Demo7 = () => { | ||
return ( | ||
<Empty | ||
status="error" | ||
description="加载失败" | ||
style={{ marginBottom: '20px' }} | ||
actions={[ | ||
{ | ||
text: 'Action', | ||
type: 'info', | ||
onClick: () => { | ||
Toast.show({ title: 'Action Click!' }) | ||
}, | ||
}, | ||
]} | ||
/> | ||
) | ||
} | ||
export default Demo7 |
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,22 @@ | ||
import React from 'react' | ||
import { Empty, Toast } from '@nutui/nutui-react' | ||
|
||
const Demo7 = () => { | ||
return ( | ||
<Empty | ||
status="error" | ||
description="加载失败" | ||
style={{ marginBottom: '20px' }} | ||
actions={[ | ||
{ | ||
text: 'Action', | ||
type: 'info', | ||
onClick: () => { | ||
Toast.show({ title: 'Action Click!' }) | ||
}, | ||
}, | ||
]} | ||
/> | ||
) | ||
} | ||
export default Demo7 |
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
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
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
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
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
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
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 |
---|---|---|
@@ -1,3 +1,13 @@ | ||
import React from 'react' | ||
import { ButtonFill, ButtonSize, ButtonType } from '@/packages/button' | ||
|
||
export interface EmptyAction { | ||
text: string | ||
text: React.ReactNode | ||
className?: string | ||
style?: React.CSSProperties | ||
type?: ButtonType | ||
size?: ButtonSize | ||
fill?: ButtonFill | ||
disabled?: boolean | ||
onClick?: () => void | ||
} |
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,6 @@ | ||
export const getButtonType = (actions, index) => { | ||
const action = actions[index] | ||
if (!actions || actions.length === 0) return 'default' | ||
if (action.type) return action.type | ||
actions.length > 1 && index === 0 ? 'default' : 'primary' | ||
} |