mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-21 12:29:36 +02:00
Support for keyboard navigation for Apps. Small refactor to pinApp action
This commit is contained in:
parent
8813bf6181
commit
5c948e1a68
4 changed files with 43 additions and 10 deletions
|
@ -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}>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue