import { useContext } from 'react' import * as React from 'react' export type LinkProps = { /** * リンクのURL */ to: string } & Omit, 'href'> export const DefaultLink = React.forwardRef( function DefaultLink({ to, children, ...rest }, ref) { return ( {children} ) }, ) type DefaultLinkProps = LinkProps & React.RefAttributes export interface Components { Link: React.ComponentType> } const DefaultValue: Components = { Link: DefaultLink, } const ComponentAbstractionContext = React.createContext(DefaultValue) interface Props { children: React.ReactNode components: Partial } export default function ComponentAbstraction({ children, components }: Props) { return ( {children} ) } export function useComponentAbstraction() { return useContext(ComponentAbstractionContext) }