Skip to content

Commit 06d83a2

Browse files
authored
Merge pull request #3285 from Annoraaq/v3-introduce-canvas
V3 introduce canvas
2 parents bf30b20 + 0d2cd90 commit 06d83a2

File tree

9 files changed

+529
-2
lines changed

9 files changed

+529
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<!--
2+
Copyright 2025 Google Inc. All rights reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
17+
<!--
18+
Canvas is a routing component to keep views alive and to support communication between
19+
them via Eventbus.
20+
-->
21+
<template>
22+
<div>
23+
<div v-show="currentRouteName === 'Explore'">
24+
Placeholder for Explore View
25+
</div>
26+
<div v-show="currentRouteName === 'Example'">
27+
Example view
28+
</div>
29+
</div>
30+
</template>
31+
32+
<script>
33+
import { useRoute } from 'vue-router';
34+
export default {
35+
data() {
36+
return {
37+
route: useRoute(),
38+
}
39+
},
40+
props: [
41+
'sketchId',
42+
],
43+
computed: {
44+
currentRouteName() {
45+
return this.route.name
46+
},
47+
},
48+
}
49+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<!--
2+
Copyright 2025 Google Inc. All rights reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
17+
<!--
18+
Example component to demonstrate use of left bar in combination with Canvas.
19+
-->
20+
<template>
21+
<div v-if="iconOnly" class="pa-4" style="cursor: pointer" @click="$emit('toggleDrawer')">
22+
<router-link :to="{ name: 'Example', params: { sketchId: sketch.id } }">
23+
<v-icon left>mdi-magnify</v-icon>
24+
<div style="height: 1px"></div>
25+
</router-link>
26+
</div>
27+
28+
<div v-else>
29+
<router-link
30+
:to="{ name: 'Example', params: { sketchId: sketch.id } }"
31+
custom
32+
v-slot="{ navigate }"
33+
class="pa-4"
34+
:class="
35+
theme.global.current.value.dark
36+
? isExampleRoute
37+
? 'dark-highlight'
38+
: 'dark-hover'
39+
: isExampleRoute
40+
? 'light-highlight'
41+
: 'light-hover'
42+
"
43+
style="cursor: pointer"
44+
>
45+
<div @click="navigate" @keypress.enter="navigate" role="link"><v-icon left>mdi-magnify</v-icon>Example</div>
46+
</router-link>
47+
<v-divider></v-divider>
48+
</div>
49+
</template>
50+
51+
<script>
52+
import { useAppStore } from "@/stores/app";
53+
import { useTheme } from 'vuetify'
54+
import {useRoute} from 'vue-router'
55+
export default {
56+
data() {
57+
return {
58+
appStore: useAppStore(),
59+
route: useRoute(),
60+
}
61+
},
62+
props: {
63+
iconOnly: Boolean,
64+
},
65+
computed: {
66+
sketch() {
67+
return this.appStore.sketch
68+
},
69+
isExampleRoute() {
70+
return this.route.name === 'Example'
71+
},
72+
sketchId() {
73+
return this.appStore.sketch.id
74+
},
75+
},
76+
setup() {
77+
return {
78+
theme: useTheme(),
79+
}
80+
}
81+
}
82+
</script>
83+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<!--
2+
Copyright 2025 Google Inc. All rights reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
<template>
17+
<div v-if="iconOnly" class="pa-4" style="cursor: pointer" @click="$emit('toggleDrawer')">
18+
<router-link :to="{ name: 'Explore', params: { sketchId: sketch.id } }">
19+
<v-icon left>mdi-magnify</v-icon>
20+
<div style="height: 1px"></div>
21+
</router-link>
22+
</div>
23+
24+
<div v-else>
25+
<router-link
26+
:to="{ name: 'Explore', params: { sketchId: sketch.id } }"
27+
custom
28+
v-slot="{ navigate }"
29+
class="pa-4"
30+
:class="
31+
theme.global.current.value.dark
32+
? isExploreRoute
33+
? 'dark-highlight'
34+
: 'dark-hover'
35+
: isExploreRoute
36+
? 'light-highlight'
37+
: 'light-hover'
38+
"
39+
style="cursor: pointer"
40+
>
41+
<div @click="navigate" @keypress.enter="navigate" role="link"><v-icon left>mdi-magnify</v-icon>Search</div>
42+
</router-link>
43+
<v-divider></v-divider>
44+
</div>
45+
</template>
46+
47+
<script>
48+
import { useAppStore } from "@/stores/app";
49+
import { useTheme } from 'vuetify';
50+
import { useRoute } from 'vue-router';
51+
export default {
52+
data() {
53+
return {
54+
appStore: useAppStore(),
55+
route: useRoute(),
56+
}
57+
},
58+
props: {
59+
iconOnly: Boolean,
60+
},
61+
computed: {
62+
sketch() {
63+
return this.appStore.sketch
64+
},
65+
isExploreRoute() {
66+
return this.route.name === 'Explore'
67+
},
68+
sketchId() {
69+
return this.appStore.sketch.id
70+
},
71+
},
72+
setup() {
73+
return {
74+
theme: useTheme(),
75+
}
76+
}
77+
}
78+
</script>
79+

0 commit comments

Comments
 (0)