Skip to content

Commit cc84a77

Browse files
authored
Merge pull request #7167 from Mousticke/ts-migrate-selectablecard
Ts migrate selectablecard
2 parents 125e4ce + 0077cda commit cc84a77

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/components/SelectableCard.js renamed to src/components/SelectableCard.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from "react"
22
import styled from "styled-components"
3-
import Emoji from "../components/Emoji"
3+
import Emoji from "./Emoji"
44

55
import Checkbox from "./Checkbox"
66

@@ -27,27 +27,32 @@ const Description = styled.p`
2727
const TopContent = styled.div`
2828
position: relative;
2929
`
30+
export interface IProps {
31+
emoji: string
32+
title: string
33+
description: string
34+
className?: string
35+
onSelect: (val: string) => void
36+
value: string
37+
isSelected?: boolean
38+
}
3039

31-
const Card = ({
40+
const Card: React.FC<IProps> = ({
3241
emoji,
3342
title,
3443
description,
3544
children,
3645
className,
3746
onSelect,
3847
value,
39-
isSelected,
48+
isSelected = false,
4049
}) => {
4150
const handleSelect = () => {
4251
onSelect(value)
4352
}
4453

4554
return (
46-
<StyledCard
47-
isSelected={isSelected}
48-
className={className}
49-
onClick={handleSelect}
50-
>
55+
<StyledCard className={className} onClick={handleSelect}>
5156
<TopContent>
5257
<Emoji text={emoji} size={3} mb={`1em`} />
5358
<StyledCheckbox checked={isSelected} aria-label={title} />

0 commit comments

Comments
 (0)