Skip to content

Commit 724416c

Browse files
committed
add panel buttons for mobile, some ui adjustments
1 parent 4f41596 commit 724416c

File tree

14 files changed

+67
-42
lines changed

14 files changed

+67
-42
lines changed

packages/ramp-core/src/api/instance.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ export class InstanceAPI {
6969
}
7070

7171
// default missing options
72-
if (!options) { options = {}; }
72+
if (!options) {
73+
options = {};
74+
}
7375

7476
// use strict check against false, as missing properties have default value of true.
7577
// run the default setup functions unless flags have been set to false.
@@ -79,7 +81,6 @@ export class InstanceAPI {
7981
if (!(options.loadDefaultEvents === false)) {
8082
this.event.addDefaultEvents();
8183
}
82-
8384
}
8485

8586
// TODO: we probably need to expose other Vue global functions here like `set`, `use`, etc.

packages/ramp-core/src/components/map/map-caption.vue

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<template>
2-
<div class="absolute bottom-0 flex justify-center pointer-events-none text-white bg-black-75 left-64 right-0 py-2">
2+
<div
3+
class="map-caption absolute bottom-0 flex justify-center pointer-events-none text-gray-400 bg-black-75 left-32 sm:left-64 right-0 py-2"
4+
>
35
<span class="relative ml-10 truncate top-1">Attribution goes here</span>
46

57
<span class="flex-grow w-15"></span>
@@ -12,7 +14,7 @@
1214
</span>
1315

1416
<button
15-
class="flex-shrink-0 mx-10 pointer-events-auto h-20 cursor-pointer border-none"
17+
class="flex-shrink-0 mx-10 px-4 pointer-events-auto h-20 cursor-pointer border-none"
1618
@click="onScaleClick"
1719
:aria-pressed="isImperialScale"
1820
:aria-label="$t('map.toggleScaleUnits')"
@@ -176,4 +178,8 @@ export default class MapCaptionV extends Vue {
176178
}
177179
</script>
178180

179-
<style lang="scss" scoped></style>
181+
<style lang="scss" scoped>
182+
.map-caption {
183+
backdrop-filter: blur(5px);
184+
}
185+
</style>

packages/ramp-core/src/components/panel-stack/panel-screen.vue

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
class="flex flex-shrink-0 items-center border-b border-solid border-gray-600 px-8 h-48 default-focus-style"
66
v-focus-item
77
>
8+
<back v-if="$iApi.screenSize === 'xs'" @click="panel.close()"></back>
89
<h2 class="flex-grow text-lg py-16 pl-8"><slot name="header"></slot></h2>
910

1011
<slot name="controls"></slot>
@@ -19,6 +20,7 @@
1920
<script lang="ts">
2021
import { Vue, Component, Prop } from 'vue-property-decorator';
2122
import { Get, Sync, Call } from 'vuex-pathify';
23+
import { PanelInstance } from '@/api';
2224
2325
@Component
2426
export default class PanelScreenV extends Vue {
@@ -31,6 +33,8 @@ export default class PanelScreenV extends Vue {
3133
* A prop indicating if the `content` slot should be rendered.
3234
*/
3335
@Prop({ default: true }) content!: boolean;
36+
37+
@Prop() panel!: PanelInstance;
3438
}
3539
</script>
3640

packages/ramp-core/src/fixtures/appbar/appbar.vue

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<template>
2-
<div class="absolute top-0 left-0 flex flex-col items-stretch bg-black-75 h-full w-40 sm:w-64 pointer-events-auto" v-focus-list>
2+
<div class="appbar absolute top-0 left-0 flex flex-col items-stretch bg-black-75 h-full w-40 sm:w-64 pointer-events-auto" v-focus-list>
33
<component
44
v-for="(item, index) in items"
55
:is="item.componentId"
66
:key="`${item}-${index}`"
7-
class="h-24 my-4 first:mt-8 text-gray-400 hover:text-white"
7+
class="h-24 my-4 first:mt-8 text-gray-400 hover:text-white focus:outline-none"
88
:class="{ 'py-12': item.id !== 'divider' }"
99
:focus-item="item.id !== 'divider'"
1010
:options="item.options"
@@ -30,4 +30,12 @@ export default class AppbarV extends Vue {
3030
.focused {
3131
@apply bg-blue-900 text-white;
3232
}
33+
34+
.appbar {
35+
backdrop-filter: blur(5px);
36+
37+
> button {
38+
outline: none;
39+
}
40+
}
3341
</style>

packages/ramp-core/src/fixtures/basemap/basemap.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<template>
2-
<panel-screen>
2+
<panel-screen :panel="panel">
33
<template #header>
44
{{ $t('basemap.title') }}
55
</template>
66

77
<template #controls>
8-
<pin @click="panel.pin()" :active="isPinned"></pin>
9-
<close @click="panel.close()"></close>
8+
<pin @click="panel.pin()" :active="isPinned" v-if="!$iApi.screenSize !== 'xs'"></pin>
9+
<close @click="panel.close()" v-if="$iApi.screenSize !== 'xs'"></close>
1010
</template>
1111

1212
<template #content>
@@ -39,7 +39,7 @@
3939
</template>
4040

4141
<script lang="ts">
42-
import { Vue, Component, Prop } from 'vue-property-decorator';
42+
import { Vue, Component, Prop, Watch } from 'vue-property-decorator';
4343
import { Get, Sync, Call } from 'vuex-pathify';
4444
import { PanelInstance } from '@/api';
4545

packages/ramp-core/src/fixtures/details/details-result.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<panel-screen>
2+
<panel-screen :panel="panel">
33
<template #header>
44
Details
55
</template>

packages/ramp-core/src/fixtures/gazebo/p1-screen-1.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<panel-screen>
2+
<panel-screen :panel="panel">
33
<template #header>
44
Gazebo/Panel 1/Screen A
55
</template>
@@ -12,7 +12,7 @@
1212
<a href="#">Option 2</a>
1313
<a href="#">Option 3</a>
1414
</panel-options-menu>
15-
<pin :active="pinned && pinned.id === 'p1'" @click="pinPanel"></pin>
15+
<pin :active="pinned && pinned.id === 'p1'" @click="pinPanel" v-if="$iApi.screenSize !== 'xs'"></pin>
1616
</div>
1717
</template>
1818

packages/ramp-core/src/fixtures/gazebo/p1-screen-2.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<template>
2-
<panel-screen>
2+
<panel-screen :panel="panel">
33
<template #header>
44
Gazebo/Panel 1/Screen B
55
</template>
66

77
<template #controls>
88
<!-- this is fine, but the name of the panel is hardcoded there, so you wouldn't need to update it if it ever changes -->
9-
<pin :active="pinned === 'p1'" @click="pinPanel"></pin>
9+
<pin :active="pinned === 'p1'" @click="pinPanel" v-if="$iApi.screenSize !== 'xs'"></pin>
1010
</template>
1111

1212
<template #content>

packages/ramp-core/src/fixtures/gazebo/p2-screen-1.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<panel-screen>
2+
<panel-screen :panel="panel">
33
<template #header>
44
Gazebo/Panel 2/Screen A
55
</template>
@@ -8,7 +8,7 @@
88
<!-- <pin> is a global button component that any fixture/panel/screen can reuse -->
99

1010
<!-- ✔ this is the correct way to pin a panel and bind the button active state whether this panel is pinned or not 👇 -->
11-
<pin @click="panel.pin(!isPinned)" :active="isPinned"></pin>
11+
<pin @click="panel.pin(!isPinned)" :active="isPinned" v-if="$iApi.screenSize !== 'xs'"></pin>
1212

1313
<!-- ✔ this will also work 👇 -->
1414
<!-- <pin @click="panel.pin(!panel.isPinned)" :active="panel.isPinned"></pin> -->

packages/ramp-core/src/fixtures/gazebo/p2-screen-2.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<panel-screen>
2+
<panel-screen :panel="panel">
33
<template #header>
44
Gazebo/Panel 2/Screen B
55
</template>
@@ -8,7 +8,7 @@
88
<!-- <pin> is a global button component that any fixture/panel/screen can reuse -->
99

1010
<!-- ✔ this is the correct way to pin a panel and bind the button active state whether this panel is pinned or not 👇 -->
11-
<pin @click="panel.pin()" :active="isPinned"></pin>
11+
<pin @click="panel.pin()" :active="isPinned" v-if="$iApi.screenSize !== 'xs'"></pin>
1212

1313
<!-- ✔ this will also work 👇 -->
1414
<!-- <pin @click="panel.pin()" :active="panel.isPinned"></pin> -->
@@ -62,7 +62,7 @@ export default class P2Screen2V extends Vue {
6262
6363
enhancedCatActivities() {
6464
// shows a cat, also does an event API flex
65-
this.panel.show('p-2-screen-3')
65+
this.panel.show('p-2-screen-3');
6666
this.$iApi.event.emit('gazebo/beholdMyText', 'I am a cat');
6767
}
6868
}

packages/ramp-core/src/fixtures/gazebo/p2-screen-3.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<template>
2-
<panel-screen>
2+
<panel-screen :panel="panel">
33
<template #header> Gazebo/Panel 2/Screen C </template>
44

55
<template #controls>
66
<!-- <pin> is a global button component that any fixture/panel/screen can reuse -->
77

88
<!-- ✔ this is the correct way to pin a panel and bind the button active state whether this panel is pinned or not 👇 -->
9-
<pin @click="panel.pin()" :active="panel.isPinned"></pin>
9+
<pin @click="panel.pin()" :active="panel.isPinned" v-if="$iApi.screenSize !== 'xs'"></pin>
1010

1111
<!-- ✔ this will also work 👇 -->
1212
<!-- <pin @click="panel.pin()" :active="panel.isPinned"></pin> -->
13-
<close @click="panel.close()"></close>
13+
<close @click="panel.close()" v-if="$iApi.screenSize !== 'xs'"></close>
1414
</template>
1515

1616
<template #content>

packages/ramp-core/tailwind.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ module.exports = {
1818
extend: {
1919
colors: {
2020
'black-75': 'rgba(0, 0, 0, 0.75)',
21-
'white-75': 'rgba(255, 255, 255, 0.75)'
21+
'white-75': 'rgba(255, 255, 255, 0.75)',
22+
'grey-test': 'rgba(150,150,150,0.7);'
2223
},
2324
boxShadow: {
2425
tm: '0 0 0 1px rgba(0, 0, 0, 0.05), 0 2px 3px 0 rgba(0, 0, 0, 0.1)'

packages/ramp-sample-fixtures/src/diligord/diligord-fixture.js

+20-15
Original file line numberDiff line numberDiff line change
@@ -55,24 +55,29 @@
5555
};
5656
},
5757
render: function(h) {
58-
return h('panel-screen', [
58+
// using built-in `pin` panel header control; can use either `this.isPinned` getter method or the `this.panel.isPinned` panel getter
59+
const pin =
60+
this.$iApi.screenSize === 'xs'
61+
? undefined
62+
: h('pin', { props: { active: this.isPinned }, on: { click: () => this.panel.pin(!this.panel.isPinned) } });
63+
64+
const close =
65+
this.$iApi.screenSize === 'xs'
66+
? undefined
67+
: h('close', {
68+
on: {
69+
click: () => this.panel.close() // this works ✔
70+
// click: this.closeMethod, // this also works ✔
71+
// click: this.panel.close // this doesn't work ❌
72+
}
73+
});
74+
75+
return h('panel-screen', { props: { panel: this.panel } }, [
5976
// pass a `span` to the `header` slot of the panel-screen
6077
h('template', { slot: 'header' }, [h('span', this.title)]),
6178

6279
// pass `pin` and `close` controls `controls` slot of the panel-screen
63-
h('template', { slot: 'controls' }, [
64-
// using built-in `pin` panel header control; can use either `this.isPinned` getter method or the `this.panel.isPinned` panel getter
65-
h('pin', { props: { active: this.isPinned }, on: { click: () => this.panel.pin(!this.panel.isPinned) } }),
66-
67-
// using built-in `close` panel header control
68-
h('close', {
69-
on: {
70-
click: () => this.panel.close() // this works ✔
71-
// click: this.closeMethod, // this also works ✔
72-
// click: this.panel.close // this doesn't work ❌
73-
}
74-
})
75-
]),
80+
h('template', { slot: 'controls' }, [pin, close]),
7681

7782
// pass screen content to the `header` slot of the panel-screen
7883
h('template', { slot: 'content' }, [
@@ -168,7 +173,7 @@
168173

169174
// TEMP CODE FOR SAMPLE
170175
// will allow an outside caller to update the fixture
171-
doAThing (text) {
176+
doAThing(text) {
172177
// too dumb do figure out how to get text on the fixture panels. vue hates me.
173178
console.log('EVENTS API SAMPLE: dillygord got this data from gazebo', text);
174179
}

packages/ramp-sample-fixtures/src/mouruge/screen.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<template>
2-
<panel-screen>
2+
<panel-screen :panel="panel">
33
<template #header>
44
Mouruge Fixture
55
</template>
66

77
<template #controls>
8-
<close @click="panel.close()"></close>
8+
<close @click="panel.close()" v-if="$iApi.screenSize !== 'xs'"></close>
99
</template>
1010

1111
<template #content>

0 commit comments

Comments
 (0)