Skip to content

Commit 78943d8

Browse files
committedFeb 18, 2024
feat: update menu style & fix scroll icon bg
1 parent 3e1775f commit 78943d8

File tree

6 files changed

+35
-19
lines changed

6 files changed

+35
-19
lines changed
 

‎apps/storybook/stories/menu/menu.stories.tsx

+11-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default {
1313
component: Menu,
1414
} as Meta
1515

16-
export const Vertical: StoryFn<MenuProps> = (args) => {
16+
const Vertical: StoryFn<MenuProps> = (args) => {
1717
return (
1818
<>
1919
<Menu
@@ -103,7 +103,7 @@ export const Vertical: StoryFn<MenuProps> = (args) => {
103103
)
104104
}
105105

106-
export const Horizontal: StoryFn<MenuProps> = (args) => {
106+
const Horizontal: StoryFn<MenuProps> = (args) => {
107107
return (
108108
<>
109109
<Menu
@@ -192,3 +192,12 @@ export const Horizontal: StoryFn<MenuProps> = (args) => {
192192
</>
193193
)
194194
}
195+
196+
export const Basic: StoryFn<MenuProps> = (props) => {
197+
return (
198+
<>
199+
<Vertical {...props} />
200+
<Horizontal {...props} />
201+
</>
202+
)
203+
}

‎packages/menu/src/horizontal/horizontal-menu.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ export const HorizontalMenu = forwardRef<HTMLDivElement, MenuProps>(
138138

139139
return (
140140
<HorizontalSubMenu
141-
ml={index !== 0 ? "16px" : "0"}
142141
key={subMenu.value}
143142
value={subMenu.value}
144143
icon={subMenu.icon}
@@ -216,7 +215,6 @@ export const HorizontalMenu = forwardRef<HTMLDivElement, MenuProps>(
216215
} else {
217216
return (
218217
<HorizontalMenuItem
219-
ml={index !== 0 ? "16px" : "0"}
220218
key={item.value}
221219
value={item.value}
222220
icon={item.icon}
@@ -309,7 +307,7 @@ export const HorizontalMenu = forwardRef<HTMLDivElement, MenuProps>(
309307
}
310308
}}
311309
>
312-
<PreviousIcon />
310+
<PreviousIcon size="12" />
313311
</motion.div>
314312
)}
315313
</AnimatePresence>
@@ -330,7 +328,7 @@ export const HorizontalMenu = forwardRef<HTMLDivElement, MenuProps>(
330328
}
331329
}}
332330
>
333-
<NextIcon />
331+
<NextIcon size="12" />
334332
</motion.div>
335333
)}
336334
</AnimatePresence>

‎packages/menu/src/horizontal/horizontal-sub-menu.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export const HorizontalSubMenu = forwardRef<HTMLDivElement, SubMenuProps>(
5656
{!onlyShowIcon && label && (
5757
<span css={horizontalSubMenuLabel}>{label}</span>
5858
)}
59-
{children && <DownIcon ml="8px" fs="14px" />}
59+
{children && <DownIcon ml="8px" fs="12px" />}
6060
<div
6161
css={applyHorizontalLine(colorScheme, selected, disabled)}
6262
className="horizontalLine"

‎packages/menu/src/horizontal/style.ts

+14-4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export function applyHorizontalMenuListContainerStyle(
1515
): SerializedStyles {
1616
return css`
1717
display: flex;
18+
gap: 16px;
1819
flex-direction: row;
1920
justify-content: ${isScroll ? "flex-start" : horizontalAlign};
2021
overflow-x: auto;
@@ -45,13 +46,22 @@ export function applyActionContainerStyle(
4546
const bgStyle =
4647
action === "left"
4748
? css`
48-
mask-image: linear-gradient(90deg, #000 0, transparent);
49+
background: linear-gradient(
50+
270deg,
51+
rgba(255, 255, 255, 0) 0%,
52+
#fff 100%
53+
);
54+
padding: 14px 12px 14px 4px;
4955
`
5056
: css`
51-
mask-image: linear-gradient(-90deg, #000 0, transparent);
57+
background: linear-gradient(
58+
270deg,
59+
#fff 0%,
60+
rgba(255, 255, 255, 0) 100%
61+
);
62+
padding: 14px 4px 14px 12px;
5263
`
5364
return css`
54-
background: transparent;
5565
color: ${getColor("grayBlue", "02")};
5666
position: absolute;
5767
width: 28px;
@@ -162,7 +172,7 @@ export function applyHorizontalSubMenuIcon(
162172
onlyShowIcon?: boolean,
163173
): SerializedStyles {
164174
return css`
165-
font-size: 14px;
175+
font-size: 16px;
166176
display: inline-flex;
167177
align-items: center;
168178
flex-shrink: 0;

‎packages/menu/src/vertical/style.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export function applyVerticalSubMenuContentContainer(
5555
align-items: center;
5656
width: 100%;
5757
height: 48px;
58-
padding: 0 24px;
58+
padding: 0 16px;
5959
flex-direction: row;
6060
${colorStyle};
6161
`
@@ -97,10 +97,10 @@ export function applyVerticalMenuItemContainer(
9797

9898
const paddingStyle = sub
9999
? css`
100-
padding: 0 24px 0 40px;
100+
padding: 0 16px 0 32px;
101101
`
102102
: css`
103-
padding: 0 24px 0 24px;
103+
padding: 0 16px;
104104
`
105105

106106
return css`
@@ -109,7 +109,6 @@ export function applyVerticalMenuItemContainer(
109109
box-sizing: border-box;
110110
align-items: center;
111111
width: 100%;
112-
padding: 0 24px 0 40px;
113112
height: 48px;
114113
flex-direction: row;
115114
${colorStyle};
@@ -122,12 +121,12 @@ export const verticalDivider = css`
122121
`
123122

124123
export const verticalSubMenuIcon = css`
125-
font-size: 14px;
124+
font-size: 16px;
126125
flex-shrink: 0;
127126
display: inline-flex;
128127
align-items: center;
129128
justify-content: center;
130-
margin-right: 8px;
129+
margin-right: 16px;
131130
`
132131

133132
export const verticalSubMenuLabel = css`

‎packages/menu/src/vertical/vertical-sub-menu.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ export const VerticalSubMenu = forwardRef<HTMLDivElement, SubMenuProps>(
5050
{label && <span css={verticalSubMenuLabel}>{label}</span>}
5151
<div css={verticalDivider} />
5252
{children && opened ? (
53-
<UpIcon flexShrink="0" ml="8px" fs="14px" />
53+
<UpIcon flexShrink="0" ml="8px" fs="12px" />
5454
) : (
55-
<DownIcon flexShrink="0" ml="8px" fs="14px" />
55+
<DownIcon flexShrink="0" ml="8px" fs="12px" />
5656
)}
5757
</div>
5858
<AnimatePresence>

0 commit comments

Comments
 (0)
Please sign in to comment.