mirror of
https://github.com/pawelmalak/flame.git
synced 2026-02-28 01:13:11 +08:00
Support for keyboard navigation for Apps. Small refactor to pinApp action
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useState, useEffect, ChangeEvent, SyntheticEvent } from 'react';
|
||||
import { useState, useEffect, useRef, ChangeEvent, SyntheticEvent } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { addApp, updateApp } from '../../../store/actions';
|
||||
import { App, NewApp } from '../../../interfaces/App';
|
||||
@@ -20,6 +20,14 @@ const AppForm = (props: ComponentProps): JSX.Element => {
|
||||
icon: ''
|
||||
});
|
||||
|
||||
const inputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (inputRef.current) {
|
||||
inputRef.current.focus();
|
||||
}
|
||||
}, [inputRef])
|
||||
|
||||
useEffect(() => {
|
||||
if (props.app) {
|
||||
console.log('app');
|
||||
@@ -75,6 +83,7 @@ const AppForm = (props: ComponentProps): JSX.Element => {
|
||||
required
|
||||
value={formData.name}
|
||||
onChange={(e) => inputChangeHandler(e)}
|
||||
ref={inputRef}
|
||||
/>
|
||||
</div>
|
||||
<div className={classes.InputGroup}>
|
||||
|
||||
Reference in New Issue
Block a user