๐ ButtonAsLink should export its props
Closed this issue ยท 3 comments
Describe the bug
The current ButtonAsLink button is exported like this.
export const ButtonAsLink = slot("button", as(Button, "a"));
But the other component have the following line after
export type ButtonProps = ComponentProps<typeof Button>;
i'd like the ButtonAsLink button to export its property like this as well
Steps to reproduce
the current way we have to type is the following.
import { ButtonAsLink } from "@sharegate/orbit-ui
type ConnectTenantButton = Omit<ComponentProps<typeof ButtonAsLink>, "children">
function ConnectTenantButton(props: ConnectTenantButton) {
return (
<ButtonAsLink variant="secondary" {...props}>
<AddIcon />
<Text>Connect Tenant</Text>
</ButtonAsLink>
);
}
Expected results
the current way we have to type is the following.
import { ButtonAsLink, ButtonAsLinkProps } from "@sharegate/orbit-ui
type ConnectTenantButton = Omit<ButtonAsLinkProps, "children">
function ConnectTenantButton(props: ConnectTenantButton) {
return (
<ButtonAsLink variant="secondary" {...props}>
<AddIcon />
<Text>Connect Tenant</Text>
</ButtonAsLink>
);
}
In your example, you are comparing the export of a component with the export of props. This isnโt comparable.
The idea is that if a consumer want the ButtonAsLink props itโs supposed to use the ButtonProps as they are the same. ButtonAsLink is a regular button render as a โaโ element rather than a โbuttonโ element.
If you really want to export props specific to ButtonAsLink, you can do ButtonAsLinkProps = ButtonProps and export this.
ButtonAsLinkProps contains href, buttonProps does not. So they are not the same no!
Meh, you're right! Sorry.