Skip to content

Commit 6b1266a

Browse files
committed
Update canvas code
1 parent b24cce3 commit 6b1266a

File tree

6 files changed

+27
-41
lines changed

6 files changed

+27
-41
lines changed

Diff for: example/index.html

+13-16
Original file line numberDiff line numberDiff line change
@@ -115,22 +115,6 @@ <h1>Icons</h1>
115115
</js-tablebody>
116116
</js-content>
117117

118-
<js-content>
119-
<js-tag texttransform="uppercase"><js-icon size="small">compass</js-icon> Map</js-tag>
120-
<div style="height: 500px;">
121-
<js-map id="map"
122-
accessToken="pk.eyJ1IjoiZGp0aG9ycGUiLCJhIjoiY2x5ZnJhZjAzMDJsYTJqcjd6eWQ3cjRvcSJ9.LvoT_wihG5VQtv008P-MPw">
123-
<!-- add a source from the array (must currently be an array of GeoJSON features) -->
124-
<js-mapsource id="area" type="geojson" data="#array"></js-mapsource>
125-
126-
<!-- display the source on the map as polygons -->
127-
<js-maplayer id="points" source="#area" type="fill"
128-
paint='{ "fill-opacity": 0.2, "fill-color": "#aa0000" }'></js-maplayer>
129-
</js-map>
130-
</div>
131-
</js-content>
132-
133-
134118
</js-canvas>
135119

136120
<!-- toast which persists on the screen for 10 seconds -->
@@ -145,6 +129,19 @@ <h1>Icons</h1>
145129
<js-close></js-close>
146130
</js-navitem>
147131
</js-nav>
132+
133+
<js-content>
134+
<js-map id="map"
135+
accessToken="pk.eyJ1IjoiZGp0aG9ycGUiLCJhIjoiY2x5ZnJhZjAzMDJsYTJqcjd6eWQ3cjRvcSJ9.LvoT_wihG5VQtv008P-MPw">
136+
<!-- add a source from the array (must currently be an array of GeoJSON features) -->
137+
<js-mapsource id="area" type="geojson" data="#array"></js-mapsource>
138+
139+
<!-- display the source on the map as polygons -->
140+
<js-maplayer id="points" source="#area" type="fill"
141+
paint='{ "fill-opacity": 0.2, "fill-color": "#aa0000" }'></js-maplayer>
142+
</js-map>
143+
</js-content>
144+
148145
</js-modal>
149146

150147
</body>

Diff for: src/canvas/CanvasElement.js

-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ export class CanvasElement extends LitElement {
3636
flex-direction: row;
3737
}
3838
}
39-
::slotted(test) {
40-
border: 0.05rem solid red;
41-
}
4239
`;
4340
}
4441

Diff for: src/canvas/ContentElement.js

+5-12
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,15 @@ export class ContentElement extends LitElement {
2121

2222
static get styles() {
2323
return css`
24-
div {
25-
display: block;
26-
padding: var(--content-padding);
27-
}
28-
`;
24+
:host {
25+
flex: 1;
26+
}
27+
`;
2928
}
3029

3130
render() {
3231
return html`
33-
<div class=${this.classes.join(' ') || nothing}><slot></slot></div>
32+
<slot></slot>
3433
`;
3534
}
36-
37-
// eslint-disable-next-line class-methods-use-this
38-
get classes() {
39-
const classes = [];
40-
return classes;
41-
}
4235
}

Diff for: src/element/NavElement.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class NavElement extends LitElement {
2727
static get styles() {
2828
return css`
2929
:host {
30-
flex: 1 0;
30+
flex: 0;
3131
}
3232
ul {
3333
display: flex;

Diff for: src/mapbox/MapElement.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,14 @@ export class MapElement extends LitElement {
4949
static get styles() {
5050
return css`
5151
${unsafeCSS(styles)}
52-
#map {
52+
:host {
53+
display: flex;
5354
width: 100%;
5455
height: 100%;
5556
}
57+
#map {
58+
flex: 1;
59+
}
5660
.mapboxgl-ctrl-logo {
5761
display: none !important;
5862
}

Diff for: src/modal/ModalElement.js

+3-8
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,17 @@ export class ModalElement extends LitElement {
5050
margin: var(--modal-margin);
5151
border: var(--modal-border);
5252
border-radius: var(--modal-border-radius);
53-
}
54-
.wrapper {
5553
display: flex;
56-
position: relative;
57-
justify-content: center;
58-
align-items: center;
59-
flex-direction: row;
60-
}
54+
flex-direction: column;
55+
}
6156
`;
6257
}
6358

6459
render() {
6560
return html`
6661
<div class=${this.canvasClasses.join(' ') || nothing}></div>
6762
<div class=${this.contentClasses.join(' ') || nothing}">
68-
<div class="wrapper"><slot></slot></div>
63+
<slot></slot>
6964
</div>
7065
`;
7166
}

0 commit comments

Comments
 (0)