addd keyboard feature

This commit is contained in:
2022-11-27 17:45:32 +03:00
parent fae84d065c
commit 57d1e02559
6 changed files with 98 additions and 19 deletions

View File

@@ -1,8 +1,11 @@
import React, { useState, useCallback } from 'react';
import { getFeatures } from '@ijl/cli';
import logo from '../assets/logo-white.svg';
import arrow from '../assets/36-arrow-right.svg';
import { Keyboard } from '../components/keyboard';
import {
MainWrapper,
InputElement,
@@ -17,8 +20,11 @@ import {
StartLabel,
} from './style';
const keyboardFeature = getFeatures('hub-video-start')?.keyboard;
const Input = ({ onStart }) => {
const [value, setValue] = useState('');
const [inFocuse, setInfocuse] = useState(false);
const handleChange = useCallback(event => {
setValue(event.target.value.toUpperCase())
}, [setValue]);
@@ -31,24 +37,30 @@ const Input = ({ onStart }) => {
}, [value])
return (
<form onSubmit={handleSubmit}>
<InputWrapper>
<InputLabel
htmlFor='input'
>
Ввод:
</InputLabel>
<InputElement
value={value}
onChange={handleChange}
id="input"
autoComplete="off"
/>
<IconButton type="submit">
<ArrowImg src={arrow} />
</IconButton>
</InputWrapper>
</form>
<>
<form onSubmit={handleSubmit}>
<InputWrapper>
<InputLabel
htmlFor='input'
>
Ввод:
</InputLabel>
<InputElement
value={value}
onChange={handleChange}
onFocus={() => setInfocuse(true)}
id="input"
autoComplete="off"
/>
<IconButton type="submit">
<ArrowImg src={arrow} />
</IconButton>
</InputWrapper>
</form>
{keyboardFeature && inFocuse && (
<Keyboard onChange={setValue} />
)}
</>
)
}

View File

@@ -1,5 +1,5 @@
import styled from '@emotion/styled';
import { keyframes } from '@emotion/react'
import { keyframes } from '@emotion/react';
export const MainWrapper = styled.main`
display: flex;