-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: migrate components/Callout.js to ts #6540
Changes from 4 commits
4efc65e
994c084
448293a
ff1622e
f3f7917
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,9 +1,14 @@ | ||||||
import React from "react" | ||||||
import { Twemoji } from "react-emoji-render" | ||||||
import styled from "styled-components" | ||||||
import { margin } from "styled-system" | ||||||
import { margin, MarginProps } from "styled-system" | ||||||
|
||||||
const StyledEmoji = styled(Twemoji)` | ||||||
interface IProp extends MarginProps { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cool, updated |
||||||
size: number | ||||||
text: string | ||||||
} | ||||||
|
||||||
const StyledEmoji = styled(Twemoji)<{ size: number }>` | ||||||
& > img { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Twemoji's prop has no There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can extend the styled component by doing something like this: const StyledEmoji = styled(Twemoji)<{ size: number }>`
...
` |
||||||
width: ${(props) => props.size}em !important; | ||||||
height: ${(props) => props.size}em !important; | ||||||
|
@@ -13,7 +18,7 @@ const StyledEmoji = styled(Twemoji)` | |||||
${margin} | ||||||
` | ||||||
|
||||||
const Emoji = ({ size = 1.5, text, ...props }) => { | ||||||
const Emoji: React.FC<IProp> = ({ size = 1.5, text, ...props }) => { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||||||
return <StyledEmoji size={size} text={text} svg {...props} /> | ||||||
} | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for convention
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
base props exported