Skip to content

Commit

Permalink
fix(comp:dropdown): style update and css variable support (#1301)
Browse files Browse the repository at this point in the history
  • Loading branch information
danranVm committed Nov 24, 2022
1 parent f1dde91 commit 0a59283
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 60 deletions.
6 changes: 3 additions & 3 deletions packages/components/dropdown/demo/Button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<IxButtonGroup>
<IxButton @click="onClick">Button</IxButton>
<IxDropdown>
<IxButton icon="ellipsis"></IxButton>
<IxButton icon="ellipsis" shape="square"></IxButton>
<template #overlay>
<IxMenu :dataSource="dataSource" :selectable="false"></IxMenu>
</template>
Expand All @@ -12,15 +12,15 @@
<IxButtonGroup>
<IxButton @click="onClick">Button</IxButton>
<IxDropdown>
<IxButton icon="setting"></IxButton>
<IxButton icon="setting" shape="square"></IxButton>
<template #overlay>
<IxMenu :dataSource="dataSource" :selectable="false"></IxMenu>
</template>
</IxDropdown>
</IxButtonGroup>

<IxDropdown>
<IxButton>Button <IxIcon name="down"></IxIcon></IxButton>
<IxButton>Button <IxIcon name="down" size="16px" style="margin-left: 4px"></IxIcon></IxButton>
<template #overlay>
<IxMenu :dataSource="dataSource" :selectable="false"></IxMenu>
</template>
Expand Down
2 changes: 1 addition & 1 deletion packages/components/dropdown/docs/Index.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ category: components
type: 导航
title: Dropdown
subtitle: 下拉菜单
order: 0
theme: true
---

11 changes: 4 additions & 7 deletions packages/components/dropdown/docs/Theme.zh.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
| 名称 | default | seer | 备注 |
| --- | --- | --- | --- |
| `@dropdown-menu-item-height` | `@height-md` | - | - |
| `@dropdown-menu-item-margin` | `0` | - | - |
| `@dropdown-overlay-arrow-color` | `@background-color-component` | - | - |
| `@dropdown-overlay-min-width` | `@menu-overlay-min-width` | - | - |
| `@dropdown-overlay-background-color` | `@menu-background-color` | - | - |
| `@dropdown-overlay-border-radius` | `@menu-overlay-border-radius` | - | - |
| `@dropdown-overlay-box-shadow` | `@menu-overlay-box-shadow` | - | - |
| `@dropdown-background-color` | `@menu-background-color` | - | - |
| `@dropdown-border-radius` | `@menu-overlay-border-radius` | - | - |
| `@dropdown-box-shadow` | `@menu-overlay-box-shadow` | - | - |
| `@dropdown-min-width` | `@menu-overlay-min-width` | - | - |
51 changes: 10 additions & 41 deletions packages/components/dropdown/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,25 @@
@import '../../style/motion/fade.less';

.@{dropdown-prefix} {
.reset-component();

z-index: 1000;
min-width: @dropdown-overlay-min-width;
background-color: @dropdown-overlay-background-color;
border-radius: @dropdown-overlay-border-radius;
box-shadow: @dropdown-overlay-box-shadow;
.reset-component-new();

&-trigger {
cursor: pointer;
}

.@{overlay-prefix}-arrow {
color: @dropdown-overlay-arrow-color;
color: @dropdown-background-color;
}
}

.@{menu-prefix} {
&&-dropdown {
&.@{menu-prefix}-vertical,
&.@{menu-prefix}-inline {
.@{menu-prefix}-item {
&-selected {
&::after {
transform: scaleY(0);
opacity: 0;
}
}
}
}

&.@{menu-prefix}-horizontal {
.@{menu-prefix}-item,
.@{menu-prefix}-sub {
&:hover,
&-expanded,
&-selected {
border-color: transparent;
}
}
}
&,
& .@{menu-prefix}-dropdown {
background-color: @dropdown-background-color;
border-radius: @dropdown-border-radius;
box-shadow: @dropdown-box-shadow;
min-width: @dropdown-min-width;
}
}

.@{menu-prefix}-dropdown {
.@{menu-prefix}-item,
.@{menu-prefix}-sub-title,
.@{menu-prefix}-item-group .@{menu-prefix}-item-group-title {
height: @dropdown-menu-item-height;
line-height: @dropdown-menu-item-height;
margin: @dropdown-menu-item-margin;
.@{menu-prefix}-dropdown {
border-right: 0;
}
}
12 changes: 4 additions & 8 deletions packages/components/dropdown/style/themes/default.variable.less
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
@dropdown-menu-item-height: @height-md;
@dropdown-menu-item-margin: 0;

@dropdown-overlay-arrow-color: @background-color-component;
@dropdown-overlay-min-width: @menu-overlay-min-width;
@dropdown-overlay-background-color: @menu-background-color;
@dropdown-overlay-border-radius: @menu-overlay-border-radius;
@dropdown-overlay-box-shadow: @menu-overlay-box-shadow;
@dropdown-background-color: @menu-background-color;
@dropdown-border-radius: @menu-overlay-border-radius;
@dropdown-box-shadow: @menu-overlay-box-shadow;
@dropdown-min-width: @menu-overlay-min-width;

0 comments on commit 0a59283

Please sign in to comment.