feat(link): add default status

This commit is contained in:
xzdry 2022-05-16 09:52:38 +08:00
parent 6c8b1b678d
commit 40e5af4f06
2 changed files with 13 additions and 7 deletions

View File

@ -11,12 +11,20 @@ const LinkStateSpec = Type.Object({});
const exampleProperties: Static<typeof LinkPropsSpec> = {
disabled: false,
hoverable: true,
status: 'warning',
status: 'default',
href: 'https://www.smartx.com/',
content: 'Link',
};
const options = {
const statusMap = {
default: undefined,
success: 'success',
error: 'error',
warning: 'warning',
} as const;
export const Link = implementRuntimeComponent({
version: 'arco/v1',
metadata: {
...FALLBACK_METADATA,
@ -35,16 +43,14 @@ const options = {
styleSlots: ['content'],
events: [],
},
};
export const Link = implementRuntimeComponent(options)(props => {
})(props => {
const { content, status, ...cProps } = getComponentProps(props);
const { elementRef, customStyle } = props;
return (
<BaseLink
ref={elementRef}
status={status}
status={statusMap[status]}
className={css(customStyle?.content)}
{...cProps}
>

View File

@ -18,7 +18,7 @@ export const LinkPropsSpec = {
category: Category.Style,
description: 'Whether to hide background when hover'
}),
status: StringUnion(['success', 'warning', 'error'], {
status: StringUnion(['default','success', 'warning', 'error'], {
title: 'Status',
category: Category.Style,
}),