blob: 9aac6b2b6799550bfacfbc2b6a0112127bf4b4db (
plain) (
blame)
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
|
import styled from 'styled-components';
const CardContainer = styled.div`
border: 3px solid ${({ theme }) => theme.borderColor};
padding: 16px;
position: relative;
background-color: ${({ theme }) => theme.cardBackgroundColor};
text-align: left;
box-shadow: 10px 10px 0 ${({ theme }) => theme.cardShadow};
`;
const CardTitle = styled.div`
position: absolute;
top: -16px;
left: 16px;
background-color: ${({ theme }) => theme.cardBackgroundColor};
background: linear-gradient(0deg, ${({ theme }) => theme.cardBackgroundColor} 0%, ${({ theme }) => theme.cardBackgroundColor} 45%, ${({ theme }) => theme.backgroundColor} 45%);
padding: 0 8px;
font-weight: bold;
z-index: 1;
font-size: 1.2em;
`;
interface CardProps {
title: string;
children: React.ReactNode;
}
const Card: React.FC<CardProps> = ({ title, children }) => {
return (
<CardContainer>
<CardTitle>{title}</CardTitle>
{children}
</CardContainer>
);
};
export default Card;
|