import { VFC } from 'react';
import { useIntl } from 'react-intl';
import styles from './spinner.module.scss';

export type SpinnerProps = {
  /**
   * The loading message. Default: "Loading...".
   */
  message?: string;
};

/**
 * Spinner component
 *
 * Render a loading message with animation.
 */
const Spinner: VFC<SpinnerProps> = ({ message }) => {
  const intl = useIntl();

  return (
    <div className={styles.wrapper}>
      <div className={styles.ball}></div>
      <div className={styles.ball}></div>
      <div className={styles.ball}></div>
      <div className={styles.text}>
        {message ||
          intl.formatMessage({
            defaultMessage: 'Loading...',
            description: 'Spinner: loading text',
            id: 'q9cJQe',
          })}
      </div>
    </div>
  );
};

export default Spinner;
ain'><a href='/'>index</a> : <a href='/www.armandphilippot.com/'>www.armandphilippot.com</a></td><td class='form'><form method='get'>
<input type='hidden' name='id' value='9b445e635e2694c0d6095a1a2613fc59314dc595'/><select name='h' onchange='this.form.submit();'>
<option value='main'>main</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>The frontend of my personal website.</td><td class='sub right'>Armand Philippot</td></tr></table>
<table class='tabs'><tr><td>
<a href='/www.armandphilippot.com/?h=v1.1.0'>summary</a><a href='/www.armandphilippot.com/refs/?h=v1.1.0&amp;id=9b445e635e2694c0d6095a1a2613fc59314dc595'>refs</a><a href='/www.armandphilippot.com/log/src/components/SearchForm/SearchForm.module.scss?h=v1.1.0'>log</a><a class='active' href='/www.armandphilippot.com/tree/src/components/SearchForm/SearchForm.module.scss?h=v1.1.0&amp;id=9b445e635e2694c0d6095a1a2613fc59314dc595'>tree</a><a href='/www.armandphilippot.com/commit/src/components/SearchForm/SearchForm.module.scss?h=v1.1.0&amp;id=9b445e635e2694c0d6095a1a2613fc59314dc595'>commit</a><a href='/www.armandphilippot.com/diff/src/components/SearchForm/SearchForm.module.scss?h=v1.1.0&amp;id=9b445e635e2694c0d6095a1a2613fc59314dc595'>diff</a><a href='/www.armandphilippot.com/stats/src/components/SearchForm/SearchForm.module.scss?h=v1.1.0'>stats</a></td><td class='form'><form class='right' method='get' action='/www.armandphilippot.com/log/src/components/SearchForm/SearchForm.module.scss'>
<input type='hidden' name='h' value='v1.1.0'/><input type='hidden' name='id' value='9b445e635e2694c0d6095a1a2613fc59314dc595'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/www.armandphilippot.com/tree/?h=v1.1.0&amp;id=9b445e635e2694c0d6095a1a2613fc59314dc595'>root</a>/<a href='/www.armandphilippot.com/tree/src?h=v1.1.0&amp;id=9b445e635e2694c0d6095a1a2613fc59314dc595'>src</a>/<a href='/www.armandphilippot.com/tree/src/components?h=v1.1.0&amp;id=9b445e635e2694c0d6095a1a2613fc59314dc595'>components</a>/<a href='/www.armandphilippot.com/tree/src/components/SearchForm?h=v1.1.0&amp;id=9b445e635e2694c0d6095a1a2613fc59314dc595'>SearchForm</a>/<a href='/www.armandphilippot.com/tree/src/components/SearchForm/SearchForm.module.scss?h=v1.1.0&amp;id=9b445e635e2694c0d6095a1a2613fc59314dc595'>SearchForm.module.scss</a></div><div class='content'>blob: 4debfbb5fc6c49726a89c41f4b8717d3bf46ef52 (<a href='/www.armandphilippot.com/plain/src/components/SearchForm/SearchForm.module.scss?h=v1.1.0&amp;id=9b445e635e2694c0d6095a1a2613fc59314dc595'>plain</a>)
<table summary='blob content' class='blob'>
<tr><td class='linenumbers'><pre><a id='n1' href='#n1'>1</a>
<a id='n2' href='#n2'>2</a>
<a id='n3' href='#n3'>3</a>
<a id='n4' href='#n4'>4</a>
<a id='n5' href='#n5'>5</a>
<a id='n6' href='#n6'>6</a>
</pre></td>
<td class='lines'><pre><code>