-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathindex.tsx
More file actions
42 lines (42 loc) · 988 Bytes
/
index.tsx
File metadata and controls
42 lines (42 loc) · 988 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright 2023 Datafuse Labs.
import React from "react";
import { type FC, type ReactElement } from "react";
import styles from "./styles.module.scss";
import clsx from "clsx";
import { type ICommonProps } from "@site/src/types";
import Link from "@docusaurus/Link";
interface IProps extends ICommonProps {
href?: string;
isDownload?: boolean;
padding?: number[];
onClick?: () => void;
}
const Card: FC<IProps> = ({
children,
padding = [28, 24],
className,
href,
isDownload = false,
style,
onClick,
}): ReactElement => {
const p = padding || [28, 24];
const props = {
style: { padding: `${p[0]}px ${p[1]}px`, ...style },
className: clsx(styles.wrap, className),
};
return (
<>
{href ? (
<Link onClick={onClick} download={isDownload} to={href} {...props}>
{children}
</Link>
) : (
<div onClick={onClick} {...props}>
{children}
</div>
)}
</>
);
};
export default Card;