@theguild/components
Version:
51 lines (48 loc) • 1.81 kB
text/typescript
import * as react_jsx_runtime from 'react/jsx-runtime';
import { HTMLAttributes } from 'react';
import { Anchor } from './anchor.mjs';
import 'url';
import '../types/components.mjs';
import 'next/image';
import 'next/link';
import 'react-player';
declare const variantStyles: {
primary: string;
'primary-inverted': string;
secondary: string;
'secondary-inverted': string;
tertiary: string;
};
declare namespace CallToActionProps {
type Variant = keyof typeof variantStyles;
interface BaseProps {
variant: Variant;
}
interface AnchorProps extends BaseProps, React.ComponentPropsWithoutRef<typeof Anchor> {
href: string;
as?: never;
}
interface ButtonProps extends BaseProps, React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement> {
href?: never;
as?: never;
}
/**
* Use inside `<summary>` or as visual part of bigger interactive element.
* Prefer using `href` prop using CallToAction as `<button>` in other cases.
*/
interface NonInteractiveProps extends BaseProps, React.DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement> {
href?: never;
as: 'span' | 'div';
}
}
type CallToActionProps = CallToActionProps.AnchorProps | CallToActionProps.ButtonProps | CallToActionProps.NonInteractiveProps;
/**
* This is called `Button` in Figma in the new Hive brand design system.
* It's a styled variant of {@link Anchor}. Based on the presence of the
* `href` prop or `as` prop, it renders a `button`, `a` or `props.as`
* (for non-interactive elements) element.
*
* // TODO: Consider renaming it to `Button`.
*/
declare function CallToAction(props: CallToActionProps): react_jsx_runtime.JSX.Element;
export { CallToAction, CallToActionProps };