fix(#189): registration step micro bug fixes (#28)

Co-authored-by: mirlan.maksitaliev <mirlan.maksitaliev@instatsport.com>
keep-around/af30b88d367751c9e05a735e4a0467a96238ef47
Mirlan 6 years ago committed by GitHub
parent 140cd0d50d
commit 60ea64a577
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      src/features/Combobox/hooks/index.tsx
  2. 3
      src/features/Combobox/index.tsx
  3. 20
      src/features/Combobox/styled.tsx
  4. 1
      src/features/Combobox/types.tsx
  5. 2
      src/features/Login/index.tsx
  6. 1
      src/features/Register/components/RegistrationStep/index.tsx
  7. 2
      src/features/UserAccount/index.tsx

@ -3,7 +3,6 @@ import { useState, useCallback } from 'react'
import isUndefined from 'lodash/isUndefined' import isUndefined from 'lodash/isUndefined'
import toLower from 'lodash/toLower' import toLower from 'lodash/toLower'
import slice from 'lodash/slice'
import find from 'lodash/find' import find from 'lodash/find'
import trim from 'lodash/trim' import trim from 'lodash/trim'
@ -71,11 +70,7 @@ export const useCombobox = <T extends Option>(props: Props<T>) => {
onInputBlur, onInputBlur,
onOptionSelect, onOptionSelect,
onQueryChange, onQueryChange,
options: slice( options: results,
results,
0,
20,
),
query, query,
} }
} }

@ -29,6 +29,7 @@ export const Combobox = <T extends Option>(props: Props<T>) => {
pattern, pattern,
required, required,
title, title,
withArrow,
} = props } = props
const { const {
onInputBlur, onInputBlur,
@ -51,7 +52,7 @@ export const Combobox = <T extends Option>(props: Props<T>) => {
? <T9n t={labelLexic} /> ? <T9n t={labelLexic} />
: label : label
} }
<Arrow /> {withArrow && <Arrow />}
</Label> </Label>
<ComboboxInputStyled <ComboboxInputStyled
id={id} id={id}

@ -22,14 +22,19 @@ export const ComboboxInputStyled = styled(ComboboxInput)`
export const Arrow = styled.div` export const Arrow = styled.div`
position: absolute; position: absolute;
right: 20px; right: 16px;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
width: 12px; width: 20px;
height: 12px; height: 20px;
background-size: 12px 12px;
background-image: url(/images/arrowDown.svg); background-image: url(/images/arrowDown.svg);
background-position: center; background-position: center;
background-repeat: no-repeat; background-repeat: no-repeat;
:hover {
cursor: pointer;
}
` `
export const ComboboxPopoverStyled = styled(ComboboxPopover)` export const ComboboxPopoverStyled = styled(ComboboxPopover)`
@ -44,15 +49,14 @@ export const ComboboxListStyled = styled(ComboboxList)`
border-radius: 2px; border-radius: 2px;
box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.3); box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.3);
position: absolute; position: absolute;
top: 0; top: 9px;
left: 0; left: -164px;
transform: translate(-126px, 9px);
overflow: auto; overflow: auto;
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 8px; width: 8px;
} }
::-webkit-scrollbar-track { ::-webkit-scrollbar-track {
background: transparent; background: transparent;
} }
@ -76,7 +80,7 @@ export const ComboboxOptionStyled = styled(ComboboxOption)`
&[aria-selected="true"] { &[aria-selected="true"] {
background: #999; background: #999;
color: #fff; color: #fff;
} }
&:hover { &:hover {

@ -21,4 +21,5 @@ export type Props<T> = Pick<InputHTMLAttributes<HTMLInputElement>, (
openOnFocus?: boolean, openOnFocus?: boolean,
options: Array<T>, options: Array<T>,
value?: string, value?: string,
withArrow?: boolean,
} }

@ -17,7 +17,7 @@ import {
RegisterButton, RegisterButton,
} from './styled' } from './styled'
const labelWidth = 60 const labelWidth = 75
export const Login = () => { export const Login = () => {
const { handleSubmit } = useForm() const { handleSubmit } = useForm()

@ -85,6 +85,7 @@ export const RegistrationStep = () => {
<Combobox <Combobox
required required
openOnFocus openOnFocus
withArrow
id={formIds.country} id={formIds.country}
labelLexic='form_country' labelLexic='form_country'
labelWidth={labelWidth} labelWidth={labelWidth}

@ -52,6 +52,7 @@ export const UserAccount = () => (
labelWidth={labelWidth} labelWidth={labelWidth}
/> />
<Combobox <Combobox
withArrow
options={[ options={[
{ id: 1, name: 'Армения' }, { id: 1, name: 'Армения' },
{ id: 2, name: 'Латвия' }, { id: 2, name: 'Латвия' },
@ -139,6 +140,7 @@ export const UserAccount = () => (
labelWidth={labelWidth} labelWidth={labelWidth}
/> />
<Combobox <Combobox
withArrow
options={[ options={[
{ id: 1, name: 'Армения' }, { id: 1, name: 'Армения' },
{ id: 2, name: 'Латвия' }, { id: 2, name: 'Латвия' },

Loading…
Cancel
Save