Skip to content

Commit 732ed6f

Browse files
authored
Merge pull request #7755 from vdusart/feat/convert-card-chakra
Feat/convert card chakra
2 parents e1a8044 + 2eebcb6 commit 732ed6f

File tree

2 files changed

+27
-34
lines changed

2 files changed

+27
-34
lines changed

src/components/Card.tsx

Lines changed: 26 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,6 @@
11
import React, { ReactNode } from "react"
2-
import styled from "@emotion/styled"
3-
import Emoji from "./OldEmoji"
4-
5-
const StyledCard = styled.div`
6-
display: flex;
7-
flex-direction: column;
8-
background: ${(props) => props.theme.colors.ednBackground};
9-
border-radius: 2px;
10-
border: 1px solid ${(props) => props.theme.colors.lightBorder};
11-
padding: 1.5rem;
12-
`
13-
14-
const Title = styled.h3`
15-
margin-top: 0;
16-
`
17-
18-
const Description = styled.p`
19-
opacity: 0.8;
20-
margin: 0;
21-
`
22-
23-
const StyledEmoji = styled(Emoji)`
24-
margin-bottom: 1rem;
25-
`
26-
27-
const TopContent = styled.div``
2+
import { Flex, Heading, Text } from "@chakra-ui/react"
3+
import Emoji from "./Emoji"
284

295
export interface IProps {
306
children?: React.ReactNode
@@ -41,14 +17,31 @@ const Card: React.FC<IProps> = ({
4117
children,
4218
className,
4319
}) => (
44-
<StyledCard className={className}>
45-
<TopContent>
46-
{emoji && <StyledEmoji size={3} text={emoji} />}
47-
{title && <Title>{title}</Title>}
48-
{description && <Description>{description}</Description>}
49-
</TopContent>
20+
<Flex
21+
direction="column"
22+
bg="ednBackground"
23+
borderRadius="sm"
24+
border="1px"
25+
borderStyle="solid"
26+
borderColor="lightBorder"
27+
p={6}
28+
className={className}
29+
>
30+
<div>
31+
{emoji && <Emoji fontSize="5xl" text={emoji} mb={4} />}
32+
{title && (
33+
<Heading as="h3" mt={0} fontSize="2xl" lineHeight={1.4}>
34+
{title}
35+
</Heading>
36+
)}
37+
{description && (
38+
<Text opacity={0.8} m={0}>
39+
{description}
40+
</Text>
41+
)}
42+
</div>
5043
{children}
51-
</StyledCard>
44+
</Flex>
5245
)
5346

5447
export default Card

src/components/Emoji.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const Emoji = (props: IProps) => {
2424
// avoid differences in SSR
2525
options={{ protocol: IS_DEV ? "http" : "https" }}
2626
svg
27-
d="inline-block"
27+
display="inline-block"
2828
{...props}
2929
/>
3030
)

0 commit comments

Comments
 (0)