Elffuss BraidHub

kikocis/continue public

main · 1.0 KiBRawPermalink
1import { XMarkIcon } from "@heroicons/react/24/outline";
2import styled from "styled-components";
3import { CloseButton, defaultBorderRadius, vscInputBackground } from ".";
4
5const StyledCard = styled.div`
6 margin: auto;
7 border-radius: ${defaultBorderRadius};
8 background-color: ${vscInputBackground};
9 box-shadow:
10 0 20px 25px -5px rgb(0 0 0 / 0.1),
11 0 8px 10px -6px rgb(0 0 0 / 0.1);
12`;
13
14interface ReusableCardProps {
15 children: React.ReactNode;
16 showCloseButton?: boolean;
17 onClose?: () => void;
18 className?: string;
19 testId?: string;
20}
21
22export function ReusableCard({
23 children,
24 showCloseButton,
25 onClose,
26 className = "",
27 testId,
28}: ReusableCardProps) {
29 return (
30 <StyledCard
31 className={`xs:py-4 xs:px-4 relative px-2 py-3 ${className}`}
32 data-testid={testId}
33 >
34 {showCloseButton && (
35 <CloseButton onClick={onClose}>
36 <XMarkIcon className="flex h-5 w-5 hover:brightness-125" />
37 </CloseButton>
38 )}
39 <div className="content py-2">{children}</div>
40 </StyledCard>
41 );
42}