mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-30 07:25:10 -05:00
2f803292b4
[web] Clickable share modal buttons GitOrigin-RevId: db6bef9b63e98007741d88b291a282d6ea4a68c5
19 lines
513 B
TypeScript
19 lines
513 B
TypeScript
import { MergeAndOverride } from '../../../../types/utils'
|
|
|
|
type PolymorphicComponentOwnProps<E extends React.ElementType> = {
|
|
as?: E
|
|
}
|
|
|
|
export type PolymorphicComponentProps<E extends React.ElementType> =
|
|
MergeAndOverride<React.ComponentProps<E>, PolymorphicComponentOwnProps<E>>
|
|
|
|
function PolymorphicComponent<E extends React.ElementType = 'div'>({
|
|
as,
|
|
...props
|
|
}: PolymorphicComponentProps<E>) {
|
|
const Component = as || 'div'
|
|
|
|
return <Component {...props} />
|
|
}
|
|
|
|
export default PolymorphicComponent
|