mirror of
https://github.com/hazemKrimi/personal-website.git
synced 2026-05-01 18:00:26 +00:00
37 lines
669 B
TypeScript
37 lines
669 B
TypeScript
import { useContext } from 'react';
|
|
import { ThemeContext } from '../../styles/theme';
|
|
import { Props } from './types';
|
|
import { Btn } from './styles';
|
|
|
|
const MDXButton = ({
|
|
variant = 'text',
|
|
type = 'button',
|
|
link,
|
|
target,
|
|
children,
|
|
disabled,
|
|
className
|
|
}: Props) => {
|
|
const { mode } = useContext(ThemeContext);
|
|
|
|
return link ? (
|
|
<Btn
|
|
href={link}
|
|
target={target}
|
|
variant={variant}
|
|
type={type}
|
|
mode={mode}
|
|
disabled={disabled}
|
|
className={className}
|
|
>
|
|
{children}
|
|
</Btn>
|
|
) : (
|
|
<Btn href="#" variant={variant} type={type} mode={mode} disabled={disabled} className={className}>
|
|
{children}
|
|
</Btn>
|
|
);
|
|
};
|
|
|
|
export default MDXButton;
|