use JSX.IntrinsicElements for pass-through props (#545)
				
					
				
			This commit is contained in:
		
							parent
							
								
									995f8eea26
								
							
						
					
					
						commit
						f63c9311e5
					
				
					 1 changed files with 6 additions and 8 deletions
				
			
		|  | @ -2,20 +2,18 @@ import classNames from "@lib/classNames"; | ||||||
| import Link, { LinkProps } from "next/link"; | import Link, { LinkProps } from "next/link"; | ||||||
| import React from "react"; | import React from "react"; | ||||||
| 
 | 
 | ||||||
| type HTMLAnchorProps = React.AnchorHTMLAttributes<HTMLAnchorElement>; |  | ||||||
| type HTMLButtonProps = React.ButtonHTMLAttributes<HTMLButtonProps>; |  | ||||||
| 
 |  | ||||||
| type SVGComponent = React.FunctionComponent<React.SVGProps<SVGSVGElement>>; |  | ||||||
| 
 |  | ||||||
| export type ButtonProps = { | export type ButtonProps = { | ||||||
|   color?: "primary" | "secondary" | "minimal"; |   color?: "primary" | "secondary" | "minimal"; | ||||||
|   size?: "base" | "sm" | "lg" | "fab"; |   size?: "base" | "sm" | "lg" | "fab"; | ||||||
|   loading?: boolean; |   loading?: boolean; | ||||||
|   disabled?: boolean; |   disabled?: boolean; | ||||||
|   onClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void; |   onClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void; | ||||||
|   StartIcon?: SVGComponent; |   StartIcon?: JSX.IntrinsicElements["svg"]; | ||||||
|   EndIcon?: SVGComponent; |   EndIcon?: JSX.IntrinsicElements["svg"]; | ||||||
| } & ((Omit<HTMLAnchorProps, "href"> & { href: LinkProps["href"] }) | (HTMLButtonProps & { href?: never })); | } & ( | ||||||
|  |   | (Omit<JSX.IntrinsicElements["a"], "href"> & { href: LinkProps["href"] }) | ||||||
|  |   | (JSX.IntrinsicElements["button"] & { href?: never }) | ||||||
|  | ); | ||||||
| 
 | 
 | ||||||
| export const Button = function Button(props: ButtonProps) { | export const Button = function Button(props: ButtonProps) { | ||||||
|   const { |   const { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Alex Johansson
						Alex Johansson