| 1 |
/** |
| 2 |
* Set inline CSS class. |
| 3 |
* |
| 4 |
* @param {Object} props - The block object. |
| 5 |
* @return {Array} The inline CSS class. |
| 6 |
*/ |
| 7 |
|
| 8 |
import parseSVG from './parseIcon' |
| 9 |
|
| 10 |
function renderSVG ( svg ) { |
| 11 |
|
| 12 |
svg = parseSVG( svg ) |
| 13 |
|
| 14 |
const fontAwesome = uagb_blocks_info.uagb_svg_icons[ svg ]; |
| 15 |
|
| 16 |
if ( 'undefined' !== typeof fontAwesome ) { |
| 17 |
|
| 18 |
const viewbox_array = ( fontAwesome.svg.hasOwnProperty( 'brands' ) ) ? fontAwesome.svg.brands.viewBox : fontAwesome.svg.solid.viewBox |
| 19 |
const path = ( fontAwesome.svg.hasOwnProperty( 'brands' ) ) ? fontAwesome.svg.brands.path : fontAwesome.svg.solid.path |
| 20 |
const viewBox = viewbox_array.join( ' ' ) |
| 21 |
|
| 22 |
return ( |
| 23 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox={viewBox}><path d={path}></path></svg> |
| 24 |
) |
| 25 |
} |
| 26 |
|
| 27 |
} |
| 28 |
|
| 29 |
export default renderSVG |
| 30 |
|