-
Notifications
You must be signed in to change notification settings - Fork 48
I think it would be good to add a react example #45
Copy link
Copy link
Open
Description
First of all, thank you for developing a good project.
I succeeded in applying joypixels in react, and I want to share components.
EmojiAsset.tsx
import joypixels from 'emoji-toolkit'
const EmojiAsset = (props: { emoji: string }) => {
const html = () => {
const styles = [
`width: 1.2em`,
`height: 1.2em`,
'top: -1px',
'position: relative'
]
const html: string = (joypixels.toImage(props.emoji) as string)
.split(`<img class="joypixels"`)
.join(`<img class="joypixels" style="${styles.join(';')}"`)
return { __html: html }
}
return (
<span
className="emojiAsset"
style={{ display: 'inline-block' }}
dangerouslySetInnerHTML={html()}
/>
)
}
export default EmojiAssetindex.tsx
const SomePage = () => {
return (
<EmojiAsset emoji="📦 Module" />
)
}
export default SomePageExample
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
