Skip to content

Commit

Permalink
fix(menu): 修复样式问题,去掉最后一个菜单下边距 (#2675)
Browse files Browse the repository at this point in the history
  • Loading branch information
zyprepare committed Nov 23, 2023
1 parent c715705 commit 7f8cfcc
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 39 deletions.
5 changes: 5 additions & 0 deletions .changeset/popular-rockets-cover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hi-ui/menu": patch
---

fix: 修复样式问题,去掉最后一个菜单下边距
5 changes: 5 additions & 0 deletions .changeset/spotty-rings-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hi-ui/hiui": patch
---

fix(menu): 修复样式问题,去掉最后一个菜单下边距
50 changes: 29 additions & 21 deletions packages/ui/menu/src/styles/menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ $disabled-color: use-color('gray', 400) !default;
height: 40px;
display: flex;
align-items: center;
margin-bottom: use-spacing(4);
padding: 0 use-spacing(4) 0 use-spacing(6);
border-radius: use-border-radius('normal');

Expand Down Expand Up @@ -267,6 +266,14 @@ $disabled-color: use-color('gray', 400) !default;
.#{$prefix}__wrapper {
flex: 1;
overflow: auto;

> .#{$prefix}-item {
&:last-child {
.#{$prefix}-item__inner {
margin-bottom: 0;
}
}
}
}

&.#{$prefix}--mini {
Expand All @@ -283,14 +290,15 @@ $disabled-color: use-color('gray', 400) !default;
}

.#{$prefix}__toggle {
width: 40px;
width: use-height-size(10);
height: use-height-size(10);
margin-top: use-spacing(4);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
border-radius: use-border-radius('normal');
color: use-color('gray', 500);
height: 40px;
flex-shrink: 0;

// @animation
Expand Down Expand Up @@ -346,31 +354,31 @@ $disabled-color: use-color('gray', 400) !default;
@include menu-item-disabled;
}
}
}

&--size-lg {
.#{$prefix}-item {
&__inner {
height: use-height-size(10);
margin-bottom: use-spacing(4);
&.#{$prefix}--size-lg {
.#{$prefix}-item {
&__inner {
height: use-height-size(10);
margin-bottom: use-spacing(4);
}
}
}
}

&--size-md {
.#{$prefix}-item {
&__inner {
height: use-height-size(9);
margin-bottom: use-spacing(2);
&.#{$prefix}--size-md {
.#{$prefix}-item {
&__inner {
height: use-height-size(9);
margin-bottom: use-spacing(2);
}
}
}
}

&--size-sm {
.#{$prefix}-item {
&__inner {
height: use-height-size(8);
margin-bottom: use-spacing(1);
&.#{$prefix}--size-sm {
.#{$prefix}-item {
&__inner {
height: use-height-size(8);
margin-bottom: use-spacing(1);
}
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions packages/ui/menu/stories/expand-all.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export const DefaultExpandAll = () => {
{
title: '小米8',
id: 'xiaomi8',
disabled: true,
},
{
title: '小米7',
Expand All @@ -53,7 +52,6 @@ export const DefaultExpandAll = () => {
},
{
title: '小米note',
disabled: true,
id: 'xiaominote',

children: [
Expand Down
2 changes: 0 additions & 2 deletions packages/ui/menu/stories/fat.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export const HorizontalFat = () => {
{
title: '小米8',
id: 'xiaomi8',
disabled: true,
},
{
title: '小米7',
Expand Down Expand Up @@ -71,7 +70,6 @@ export const HorizontalFat = () => {
},
{
title: '小米note',
disabled: true,
id: 'xiaominote',
children: [
{
Expand Down
4 changes: 1 addition & 3 deletions packages/ui/menu/stories/footer-render.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const FooterRender = () => {
}}
>
{collapseNode}
{collapsed ? null : <div style={{ paddingRight: 10 }}>我是谁</div>}
{collapsed ? null : <div style={{ margin: '8px 8px 0 0' }}>我是谁</div>}
</div>
)
}}
Expand All @@ -52,7 +52,6 @@ export const FooterRender = () => {
{
title: '小米8',
id: 'xiaomi8',
disabled: true,
},
{
title: '小米7',
Expand All @@ -66,7 +65,6 @@ export const FooterRender = () => {
},
{
title: '小米note',
disabled: true,
id: 'xiaominote',
children: [
{
Expand Down
2 changes: 0 additions & 2 deletions packages/ui/menu/stories/horizontal.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export const Horizontal = () => {
{
title: '小米8',
id: 'xiaomi8',
disabled: true,
},
{
title: '小米7',
Expand Down Expand Up @@ -84,7 +83,6 @@ export const Horizontal = () => {
},
{
title: '小米note',
disabled: true,
id: 'xiaominote',

children: [
Expand Down
2 changes: 0 additions & 2 deletions packages/ui/menu/stories/mini.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export const Mini = () => {
{
title: '小米8',
id: 'xiaomi8',
disabled: true,
},
{
title: '小米7',
Expand Down Expand Up @@ -65,7 +64,6 @@ export const Mini = () => {
},
{
title: '小米note',
disabled: true,
id: 'xiaominote',

children: [
Expand Down
2 changes: 0 additions & 2 deletions packages/ui/menu/stories/pop.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export const Pop = () => {
{
title: '小米8',
id: 'xiaomi8',
disabled: true,
},
{
title: '小米7',
Expand Down Expand Up @@ -67,7 +66,6 @@ export const Pop = () => {
},
{
title: '小米note',
disabled: true,
id: 'xiaominote',
children: [
{
Expand Down
3 changes: 0 additions & 3 deletions packages/ui/menu/stories/size.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export const Size = () => {
},
{
title: '小米note',
disabled: true,
id: 'xiaominote',
children: [
{
Expand Down Expand Up @@ -108,7 +107,6 @@ export const Size = () => {
},
{
title: '小米note',
disabled: true,
id: 'xiaominote',
children: [
{
Expand Down Expand Up @@ -172,7 +170,6 @@ export const Size = () => {
},
{
title: '小米note',
disabled: true,
id: 'xiaominote',
children: [
{
Expand Down
2 changes: 0 additions & 2 deletions packages/ui/menu/stories/vertical-fat.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export const VerticalFat = () => {
{
title: '小米8',
id: 'xiaomi8',
disabled: true,
},
{
title: '小米7',
Expand Down Expand Up @@ -71,7 +70,6 @@ export const VerticalFat = () => {
},
{
title: '小米note',
disabled: true,
id: 'xiaominote',
children: [
{
Expand Down

0 comments on commit 7f8cfcc

Please sign in to comment.