Skip to content
This repository has been archived by the owner on Feb 24, 2022. It is now read-only.

Commit

Permalink
fix: grid options initializer
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremydw committed Dec 31, 2021
1 parent f5d393e commit a1966f0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/ui/grid-inspector.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {LitElement, css, html, unsafeCSS} from 'lit';
import {customElement, property} from 'lit/decorators.js';
import {customElement, property, state} from 'lit/decorators.js';

interface Breakpoint {
min?: number;
Expand All @@ -22,7 +22,8 @@ export class GridInspector extends LitElement {
@property({type: Array, attribute: 'grid'})
options?: GridOptions[];

grid: GridOptions[];
@state()
private grid: GridOptions[];

static DEFAULT_OPTIONS = [{
breakpoint: {
Expand Down Expand Up @@ -57,11 +58,13 @@ export class GridInspector extends LitElement {

constructor() {
super();
this.grid = this.options ?? GridInspector.DEFAULT_OPTIONS;
this.grid = GridInspector.DEFAULT_OPTIONS;
}

connectedCallback() {
super.connectedCallback();
this.grid = this.options ?? this.grid;

// Enable toggling the grid overlay using `ctrl+g` (similar to Figma).
document.addEventListener('keydown', (e: KeyboardEvent) => {
if (e.ctrlKey && e.key === 'g') {
Expand Down

0 comments on commit a1966f0

Please sign in to comment.