File size: 954 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
 * Source: https://github.com/Automattic/wp-calypso/blob/HEAD/client/components/spinner/index.jsx
 */

import clsx from 'clsx';
import PropTypes from 'prop-types';
import { PureComponent } from 'react';

export default class Spinner extends PureComponent {
	static propTypes = {
		className: PropTypes.string,
		size: PropTypes.number,
	};

	static defaultProps = {
		size: 20,
	};

	render() {
		const className = clsx( 'wpnc__spinner', this.props.className );

		const style = {
			width: this.props.size,
			height: this.props.size,
			fontSize: this.props.size, // allows border-width to be specified in em units
		};

		return (
			<div className={ className }>
				{ /* eslint-disable-next-line wpcalypso/jsx-classname-namespace */ }
				<div className="wpnc__spinner__outer" style={ style }>
					{ /* eslint-disable-next-line wpcalypso/jsx-classname-namespace */ }
					<div className="wpnc__spinner__inner" />
				</div>
			</div>
		);
	}
}