Skip to content

Commit ddfb2ee

Browse files
committed
feat(context menu): Eva style (#1423)
BREAKING CHANGE: 'context-menu-border' split into 'context-menu-border-color', 'context-menu-border-style' and 'context-menu-border-width'. Following theme properties were removed: context-menu-fg context-menu-bg context-menu-active-fg context-menu-active-bg context-menu-arrow-size
1 parent 0e032b6 commit ddfb2ee

File tree

5 files changed

+26
-141
lines changed

5 files changed

+26
-141
lines changed

src/framework/theme/components/context-menu/_context-menu.component.theme.scss

Lines changed: 10 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -7,76 +7,19 @@
77

88
@mixin nb-context-menu-theme() {
99
nb-context-menu {
10-
$arrow-size: nb-theme(context-menu-arrow-size);
11-
$arrow-content-size: #{$arrow-size} - 2px;
12-
13-
border: 2px solid nb-theme(context-menu-border);
10+
background-color: nb-theme(context-menu-background-color);
11+
border-color: nb-theme(context-menu-border-color);
12+
border-style: nb-theme(context-menu-border-style);
13+
border-width: nb-theme(context-menu-border-width);
1414
border-radius: nb-theme(context-menu-border-radius);
15-
background: nb-theme(context-menu-bg);
1615
box-shadow: nb-theme(context-menu-shadow);
16+
min-width: nb-theme(context-menu-min-width);
17+
max-width: nb-theme(context-menu-max-width);
1718

18-
.primitive-overlay {
19-
color: nb-theme(context-menu-fg);
20-
}
21-
22-
.arrow {
23-
border-left: $arrow-size solid transparent;
24-
border-right: $arrow-size solid transparent;
25-
border-bottom: $arrow-size solid nb-theme(context-menu-border);
26-
27-
&::after {
28-
position: absolute;
29-
content: ' ';
30-
width: 0;
31-
height: 0;
32-
top: 3px;
33-
left: calc(50% - (#{$arrow-content-size}));
34-
border-left: calc(#{$arrow-content-size}) solid transparent;
35-
border-right: calc(#{$arrow-content-size}) solid transparent;
36-
border-bottom: calc(#{$arrow-content-size}) solid nb-theme(context-menu-bg);
37-
}
38-
}
39-
40-
&.nb-overlay-bottom .arrow {
41-
top: calc(-1 * #{$arrow-size} + 1px);
42-
left: calc(50% - #{$arrow-size});
43-
}
44-
45-
&.nb-overlay-left .arrow {
46-
right: calc(-1 * #{$arrow-size} - #{$arrow-size} / 2 + 2px);
47-
top: calc(50% - #{$arrow-size / 2});
48-
transform: rotate(90deg);
49-
}
50-
51-
&.nb-overlay-top .arrow {
52-
bottom: calc(-1 * #{$arrow-size} + 1px);
53-
left: calc(50% - #{$arrow-size});
54-
transform: rotate(180deg);
55-
}
56-
57-
&.nb-overlay-right .arrow {
58-
left: calc(-1 * #{$arrow-size} - #{$arrow-size} / 2 + 2px);
59-
top: calc(50% - #{$arrow-size / 2});
60-
transform: rotate(270deg);
61-
}
62-
}
63-
64-
nb-menu.context-menu .menu-items .menu-item a {
65-
color: nb-theme(context-menu-fg);
66-
font-weight: nb-theme(font-weight-normal);
67-
68-
.menu-icon {
69-
color: nb-theme(context-menu-fg);
70-
}
71-
72-
@include hover-focus-active {
73-
color: nb-theme(context-menu-active-fg);
74-
background: nb-theme(context-menu-active-bg);
75-
font-weight: nb-theme(font-weight-normal);
76-
77-
.menu-icon {
78-
color: nb-theme(context-menu-active-fg);
79-
}
19+
nb-menu {
20+
border-radius: nb-theme(context-menu-border-radius);
21+
overflow: hidden;
22+
text-align: center;
8023
}
8124
}
8225
}

src/framework/theme/components/context-menu/context-menu.component.scss

Lines changed: 0 additions & 61 deletions
This file was deleted.

src/framework/theme/components/context-menu/context-menu.component.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,18 @@ import { NbPositionedContainer, NbRenderableContainer } from '../cdk';
1414
*
1515
* @styles
1616
*
17-
* context-menu-fg
18-
* context-menu-active-fg
19-
* context-menu-active-bg
17+
* context-menu-background-color
18+
* context-menu-border-color
19+
* context-menu-border-style
20+
* context-menu-border-width
21+
* context-menu-border-radius
22+
* context-menu-min-width
23+
* context-menu-max-width
24+
* context-menu-shadow
2025
* */
2126
@Component({
2227
selector: 'nb-context-menu',
23-
styleUrls: ['./context-menu.component.scss'],
2428
template: `
25-
<span class="arrow"></span>
2629
<nb-menu class="context-menu" [items]="context.items" [tag]="context.tag"></nb-menu>
2730
`,
2831
})

src/framework/theme/components/context-menu/context-menu.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import { NbMenuItem, NbMenuService } from '../menu/menu.service';
4747
* ```ts
4848
* @NgModule({
4949
* imports: [
50-
* // ...
50+
* // ...
5151
* NbContextMenuModule,
5252
* ],
5353
* })

src/framework/theme/styles/themes/_default.scss

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -583,14 +583,14 @@ $theme: (
583583
popover-arrow-size: 0.6875rem,
584584
popover-padding: 0.75rem 1rem,
585585

586-
context-menu-fg: color-fg-heading,
587-
context-menu-bg: color-bg,
588-
context-menu-active-fg: color-white,
589-
context-menu-active-bg: color-success,
590-
context-menu-border: color-success,
591-
context-menu-border-radius: radius,
586+
context-menu-background-color: color-white,
587+
context-menu-border-color: transparent,
588+
context-menu-border-style: solid,
589+
context-menu-border-width: 0,
590+
context-menu-border-radius: 0.75rem,
591+
context-menu-min-width: 10rem,
592+
context-menu-max-width: 15rem,
592593
context-menu-shadow: none,
593-
context-menu-arrow-size: 11px,
594594

595595
actions-background-color: transparent,
596596
actions-divider-color: divider-color,

0 commit comments

Comments
 (0)