Skip to content

Commit b0455ae

Browse files
author
Sergey Yuferev
committed
fix(mobile): menu review 2, #129
1 parent c6b0320 commit b0455ae

File tree

3 files changed

+22
-33
lines changed

3 files changed

+22
-33
lines changed

packages/mobile/src/horizontal-menu/HorizontalMenu.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {BaseMenuItem, styled, Flex, Card} from '@qiwi/pijma-core'
1+
import {BaseMenuItem, styled, Flex, Card, Box} from '@qiwi/pijma-core'
22
import React from 'react'
33

44
import {HorizontalMenuItem} from './HorizontalMenuItem'
@@ -42,13 +42,18 @@ export const HorizontalMenu = <Item extends BaseMenuItem>({
4242
wrap="nowrap"
4343
px={4}
4444
children={items.map((item, index) => (
45-
<HorizontalMenuItem
46-
id={`${id}-${item.id}`}
47-
active={selected === item.id}
45+
<Box
4846
key={item.id}
49-
isLast={index === items.length - 1}
50-
onClick={onSelect.bind(null, item)}
51-
children={item.title}
47+
id={`${id}-${item.id}-wrap`}
48+
mr={index === items.length - 1 ? 0 : 6}
49+
children={
50+
<HorizontalMenuItem
51+
id={`${id}-${item.id}`}
52+
active={selected === item.id}
53+
onClick={onSelect.bind(null, item)}
54+
children={item.title}
55+
/>
56+
}
5257
/>
5358
))}
5459
/>

packages/mobile/src/horizontal-menu/HorizontalMenuItem.tsx

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
import {Card, LinkControl, Lnk, Typo} from '@qiwi/pijma-core'
1+
import {Card, LinkControl, Lnk} from '@qiwi/pijma-core'
22
import React from 'react'
33

4+
import {Text} from '../typography'
5+
46
export interface HorizontalMenuItemProps {
57
active: boolean
68
id: string
79
href?: string
810
target?: string
911
reverse?: boolean
10-
isLast?: boolean
1112
onClick?: () => void
1213
}
1314

@@ -30,22 +31,12 @@ export const HorizontalMenuItem: React.FC<HorizontalMenuItemProps> = props => (
3031
onMouseUp={renderProps.onMouseUp}
3132
onMouseDown={renderProps.onMouseDown}
3233
cursor="pointer"
33-
mr={props.isLast ? 0 : 6}
34+
display="block"
3435
pb={1}
3536
bb={`4px solid ${
3637
renderProps.hover || props.active ? '#ff8c00' : 'transparent'
3738
}`}
38-
children={
39-
<Typo
40-
id={`${props.id}-text`}
41-
as="span"
42-
cursor="pointer"
43-
size={4}
44-
height={6}
45-
weight={500}
46-
children={props.children}
47-
/>
48-
}
39+
children={<Text bold size="m" children={props.children} />}
4940
/>
5041
)}
5142
/>

packages/mobile/src/select-menu/SelectMenuItem.tsx

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import {Card, LinkControl, Lnk, Typo} from '@qiwi/pijma-core'
1+
import {Card, LinkControl, Lnk} from '@qiwi/pijma-core'
22
import React from 'react'
33

4+
import {Text} from '../typography'
5+
46
export interface SelectMenuItemProps {
57
id: string
68
href?: string
@@ -28,20 +30,11 @@ export const SelectMenuItem: React.FC<SelectMenuItemProps> = props => (
2830
onMouseUp={renderProps.onMouseUp}
2931
onMouseDown={renderProps.onMouseDown}
3032
cursor="pointer"
33+
display="block"
3134
px={4}
3235
py={2}
3336
bg={`${renderProps.hover ? '#f5f5f5' : 'transparent'}`}
34-
children={
35-
<Typo
36-
id={`${props.id}-text`}
37-
weight={300}
38-
as="span"
39-
cursor="pointer"
40-
size={4}
41-
height={6}
42-
children={props.children}
43-
/>
44-
}
37+
children={<Text bold={false} size="m" children={props.children} />}
4538
/>
4639
)}
4740
/>

0 commit comments

Comments
 (0)