Skip to content

Commit 5f6ab0b

Browse files
committed
switch to css variables.
1 parent 965c9e3 commit 5f6ab0b

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

src/pg/overlayMenu/README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Overlay Menu
22

3-
The `PgOverlayMenu` creates a menu creates an overlay menu above a source element. For standard menu lists use the `PgMenuItem` for the check.
3+
The `PgOverlayMenu` creates an overlay menu above a source element. For standard menu lists use the `PgMenuItem` for the check.
4+
5+
Components that use `PgOverlayMenu` include:
6+
7+
- `pg-input-select`
8+
9+
## Usage
410

511
```typescript
612
import PgMenuItem from '@pictogrammers/components/pg/menuItem';
@@ -24,4 +30,4 @@ handleSourceClick() {
2430
this.#isOpen = false;
2531
console.log(result);
2632
}
27-
```
33+
```

src/pg/overlayMenu/overlayMenu.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@
1212
top: anchor(top);
1313
left: anchor(left);
1414
min-width: calc(anchor-size(width) + calc(2 * var(--pg-menu-padding, 0.25rem)));
15+
translate: var(--pg-overlay-menu-_x, 0) var(--pg-overlay-menu-_y, 0);
1516
}

src/pg/overlayMenu/overlayMenu.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Component, Part, Prop } from '@pictogrammers/element';
2+
23
import PgMenu from '../menu/menu';
34
import PgOverlay from '../overlay/overlay';
45

@@ -70,7 +71,8 @@ export default class PgOverlayMenu extends PgOverlay {
7071
}
7172
}
7273
// ToDo: update to CSS Variables
73-
this.$overlay.style.translate = `${x}px ${y}px`;
74+
this.$overlay.style.setProperty('--pg-overlay-menu-_x', `${x}px`);
75+
this.$overlay.style.setProperty('--pg-overlay-menu-_y', `${y}px`);
7476
// Focus
7577
this.$menu.focus(index);
7678
}

0 commit comments

Comments
 (0)