klarna / ui

[Archived] 🔩 Klarna's UI components library
https://klarna.github.io/ui/
Other
210 stars 26 forks source link

Add custom html2react that builds html to the @klarna/ui #287

Closed xaviervia closed 7 years ago

xaviervia commented 7 years ago

For example:

import React from 'react'
import {render} from 'react-dom'
import fromHtml from '@klarna/ui/fromHtml'

const html = `<div>
  <h1>Hello</h1>
  <p>Lorem ipsum dolor sit amet</p>
</div>`

render(
  <main>
    {fromHtml(html)}
  </main>,
  document.getElementById('root')
)

The main benefit is for copy that comes from translations and such that needs to be used do that <strong> becomes <Strong> and so on.

xaviervia commented 7 years ago

Being done in #332