@fortawesome/free-solid-svg-icons#faInbox TypeScript Examples

The following examples show how to use @fortawesome/free-solid-svg-icons#faInbox. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Register.tsx    From MagicUI with Apache License 2.0 5 votes vote down vote up
export default function Register() {
  const [email, setEmail] = useState('');
  const [nickname, setNickname] = useState('');
  const [password, setPassword] = useState('');
  const [error, setError] = useState(false);
  const [source, setSource] = useState('');

  useEffect(() => {
    ipcRenderer.on('avatar-data', (event, args) => {
      setSource(args.source);
    });
  }, []);

  const handleSelectAvatar = () => {
    Bridge.open(WidgetType.AVATAR);
  };

  const handleRegister = () => {
    if (email && nickname && password) {
      registerUser(source || defaultAvatar, email, nickname, password).then(res => {
        if (res.err) {
          setError(true);
        }
        history.push('/');
      });
    }
  };

  return (
    <div className={style.register}>
      <div className={style.avatar_wrapper}>
        <EditableAvatar size={100} src={source || defaultAvatar} onClick={handleSelectAvatar}/>
      </div>
      <div className={style.input_wrapper}>
        <div className={cls(style.input, style.email, error && style.error)}>
          <span>
            <FontAwesomeIcon icon={faInbox}/>
          </span>
          <input value={email} onChange={e => setEmail(e.target.value)} placeholder="email..."/>
        </div>
        <div className={cls(style.input, style.nickname)}>
          <span>
            <FontAwesomeIcon icon={faUser}/>
          </span>
          <input value={nickname} onChange={e => setNickname(e.target.value)} placeholder="nickname..."/>
        </div>
        <div className={cls(style.input, style.password)}>
          <span>
            <FontAwesomeIcon icon={faLock}/>
          </span>
          <input value={password} onChange={e => setPassword(e.target.value)} placeholder="password..."/>
        </div>
      </div>
      <div className={style.register_btn}>
        <button onClick={handleRegister}>
          Register
        </button>
      </div>
      <div className={style.login_btn}>
        <button onClick={() => history.push('/')}>
          <FontAwesomeIcon icon={faArrowLeft}/>
        </button>
      </div>
    </div>
  );
}