mirror of
https://github.com/status-im/nimbus-gui.git
synced 2025-03-03 20:40:51 +00:00
fix: style of inputs
This commit is contained in:
parent
0777a599ec
commit
b25593f634
@ -3,12 +3,28 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.autocomplete-input, .suggestion-list {
|
.suggestion-list {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border: 1px solid #f7f8f9;
|
width: 100%;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 1000;
|
||||||
|
max-height: 260px;
|
||||||
|
overflow-y: scroll;
|
||||||
|
border: 1px solid #f9fafa;
|
||||||
|
border-radius: 24px;
|
||||||
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||||
|
background-color: #f9fafa;
|
||||||
|
padding: 10px;
|
||||||
|
scrollbar-width: thin;
|
||||||
|
scrollbar-color: #f9fafa transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.autocomplete-input {
|
||||||
|
box-sizing: border-box;
|
||||||
|
border: 2px solid #f7f8f9;
|
||||||
border-radius: 24px;
|
border-radius: 24px;
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
background-color: #f9f9f9;
|
background-color: #f7f8f9;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
@ -19,29 +35,13 @@
|
|||||||
|
|
||||||
.input-number {
|
.input-number {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 10px;
|
left: 15px;
|
||||||
top: 50%;
|
|
||||||
line-height: 50;
|
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
color: #0D162566;
|
color: #0D162566;
|
||||||
}
|
}
|
||||||
|
|
||||||
.suggestion-list {
|
|
||||||
position: absolute;
|
|
||||||
z-index: 1000;
|
|
||||||
max-height: 260px;
|
|
||||||
overflow-y: scroll;
|
|
||||||
border: 1px solid #f7f8f9;
|
|
||||||
border-radius: 24px;
|
|
||||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
||||||
background-color: #f7f8f9;
|
|
||||||
padding: 10px;
|
|
||||||
scrollbar-width: thin;
|
|
||||||
scrollbar-color: #f7f8f9 transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.suggestion-item {
|
.suggestion-item {
|
||||||
padding: 12px 16px;
|
padding: 12px 16px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
@ -6,6 +6,24 @@ import { RootState } from '../../../redux/store'
|
|||||||
import { setMnemonic, setWord } from '../../../redux/ValidatorOnboarding/KeyGeneration/slice'
|
import { setMnemonic, setWord } from '../../../redux/ValidatorOnboarding/KeyGeneration/slice'
|
||||||
import './AutocompleteInput.css'
|
import './AutocompleteInput.css'
|
||||||
|
|
||||||
|
const styleForInput = (index: number, isFocused: boolean) => {
|
||||||
|
const style = {
|
||||||
|
outline: 'none',
|
||||||
|
padding: `12px 16px 12px ${index + 1 < 10 ? '35px' : '45px'}`,
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isFocused) {
|
||||||
|
return {
|
||||||
|
...style,
|
||||||
|
border: '2px solid #4360DF',
|
||||||
|
marginBottom: '5px',
|
||||||
|
backgroundColor: '#f1f2f4',
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return style
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type AutocompleteInputProps = {
|
type AutocompleteInputProps = {
|
||||||
index: number
|
index: number
|
||||||
}
|
}
|
||||||
@ -42,6 +60,7 @@ const AutocompleteInput = ({ index }: AutocompleteInputProps) => {
|
|||||||
|
|
||||||
const handleSuggestionClick = (e: React.MouseEvent, suggestion: string) => {
|
const handleSuggestionClick = (e: React.MouseEvent, suggestion: string) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
setIsFocused(false)
|
setIsFocused(false)
|
||||||
dispatch(setWord({ index, word: suggestion }))
|
dispatch(setWord({ index, word: suggestion }))
|
||||||
}
|
}
|
||||||
@ -54,28 +73,20 @@ const AutocompleteInput = ({ index }: AutocompleteInputProps) => {
|
|||||||
setIsFocused(false)
|
setIsFocused(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
const styleForInput = () => {
|
|
||||||
const style = { outline: 'none', paddingLeft: index < 10 ? '30px' : '40px' }
|
|
||||||
|
|
||||||
if (isFocused) {
|
|
||||||
return { ...style, border: '2px solid #4360DF', marginBottom: '5px' }
|
|
||||||
} else {
|
|
||||||
return style
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="autocomplete-container">
|
<div className="autocomplete-container">
|
||||||
<div className={isFocused ? 'suggestion-list' : ''}>
|
<div className={isFocused ? 'suggestion-list' : ''}>
|
||||||
<div className="input-wrapper">
|
<div className="input-wrapper">
|
||||||
<span className="input-number">{index + 1}.</span>
|
<span className="input-number" style={{ top: isFocused ? '42%' : '48%' }}>
|
||||||
|
{index + 1}.
|
||||||
|
</span>
|
||||||
<input
|
<input
|
||||||
className="autocomplete-input"
|
className="autocomplete-input"
|
||||||
value={word}
|
value={word}
|
||||||
onChange={handleInputChange}
|
onChange={handleInputChange}
|
||||||
onFocus={handleInputFocus}
|
onFocus={handleInputFocus}
|
||||||
onBlur={handleInputBlur}
|
onBlur={handleInputBlur}
|
||||||
style={styleForInput()}
|
style={styleForInput(index, isFocused)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{isFocused &&
|
{isFocused &&
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { Stack, YStack } from 'tamagui'
|
import { Stack, YStack } from 'tamagui'
|
||||||
import AutocompleteInput from './AutocompleteInput'
|
|
||||||
import { Text } from '@status-im/components'
|
import { Text } from '@status-im/components'
|
||||||
|
|
||||||
|
import AutocompleteInput from './AutocompleteInput'
|
||||||
import KeyGenerationTitle from './KeyGenerationTitle'
|
import KeyGenerationTitle from './KeyGenerationTitle'
|
||||||
|
|
||||||
const ConfirmRecoveryPhrase = () => {
|
const ConfirmRecoveryPhrase = () => {
|
||||||
@ -14,7 +15,7 @@ const ConfirmRecoveryPhrase = () => {
|
|||||||
gridTemplateColumns: 'repeat(4, 1fr)',
|
gridTemplateColumns: 'repeat(4, 1fr)',
|
||||||
gap: '20px 40px',
|
gap: '20px 40px',
|
||||||
width: '70%',
|
width: '70%',
|
||||||
marginBottom: '20px',
|
marginBottom: '10px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{Array.from({ length: 24 }).map((_, index) => (
|
{Array.from({ length: 24 }).map((_, index) => (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user