agroptima-design-system 0.31.2-beta.2 → 0.31.2-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@ import type { AnchorHTMLAttributes, ButtonHTMLAttributes } from 'react'
|
|
|
4
4
|
interface CommonProps {
|
|
5
5
|
disabled?: boolean
|
|
6
6
|
visible?: boolean
|
|
7
|
+
prefetch?: boolean
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
type HtmlButtonProps = ButtonHTMLAttributes<HTMLButtonElement>
|
|
@@ -20,18 +21,18 @@ const hasHref = (props: HtmlButtonProps | AnchorProps): props is AnchorProps =>
|
|
|
20
21
|
export function BaseButton({
|
|
21
22
|
children,
|
|
22
23
|
visible = true,
|
|
24
|
+
prefetch = false,
|
|
23
25
|
...props
|
|
24
26
|
}: BaseButtonProps) {
|
|
25
27
|
if (!visible) return null
|
|
26
28
|
const isLink = !props.disabled && hasHref(props)
|
|
27
29
|
if (isLink) {
|
|
28
|
-
const { href,
|
|
30
|
+
const { href, ...restProps } = props
|
|
29
31
|
return (
|
|
30
32
|
<NextLink href={href} {...restProps} prefetch={prefetch}>
|
|
31
33
|
{children}
|
|
32
34
|
</NextLink>
|
|
33
35
|
)
|
|
34
36
|
}
|
|
35
|
-
|
|
36
37
|
return <button {...(props as HtmlButtonProps)}>{children}</button>
|
|
37
38
|
}
|