/********************************************************************* * © Copyright IBM Corp. 2024 *********************************************************************/ import React from 'react' import PropTypes from 'prop-types' import {IconsGeneralColor} from '@targetprocess/css-variables' const scopedAnimationName = 'loading-icon-spin' const inlineStyle = `@keyframes ${scopedAnimationName} {from {transform: rotate(0deg)} to {transform: rotate(360deg)}}` export class LoadingIcon extends React.Component<{color?: string}> { static category = 'Info' static propTypes = { color: PropTypes.string } componentDidMount() { const existingStyleTag = document.querySelector(`#${scopedAnimationName}`) if (existingStyleTag) { return } const styleTag = document.createElement('style') styleTag.setAttribute('id', scopedAnimationName) styleTag.type = 'text/css' styleTag.appendChild(document.createTextNode(inlineStyle)) document.head.appendChild(styleTag) } render() { const {color = IconsGeneralColor} = this.props return ( ) } }