@usssa/component-library 1.0.0-alpha.240 → 1.0.0-alpha.241

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usssa/component-library",
3
- "version": "1.0.0-alpha.240",
3
+ "version": "1.0.0-alpha.241",
4
4
  "description": "A Quasar component library project",
5
5
  "productName": "Quasar component library App",
6
6
  "author": "Engineering Team <engineering@usssa.com>",
@@ -38,12 +38,13 @@
38
38
  "@quasar/extras": "^1.16.4",
39
39
  "@usssa/core-client": "^0.0.19",
40
40
  "algoliasearch": "4",
41
+ "d3": "^7.9.0",
41
42
  "flag-icons": "^7.2.3",
42
43
  "heic2any": "^0.0.4",
43
44
  "quasar": "^2.16.0",
44
45
  "vue": "^3.4.18",
45
46
  "vue-router": "^4.0.12",
46
- "d3": "^7.9.0"
47
+ "vue3-google-map": "^0.25.0"
47
48
  },
48
49
  "devDependencies": {
49
50
  "@quasar/app-vite": "^1.9.0",
@@ -0,0 +1,167 @@
1
+ <script setup>
2
+ import { AdvancedMarker, GoogleMap } from 'vue3-google-map'
3
+ import { computed, onMounted, ref } from 'vue'
4
+ import UBtnStd from './UBtnStd.vue'
5
+ import UChip from './UChip.vue'
6
+ import { useScreenType } from '../../composables/useScreenType'
7
+
8
+ const props = defineProps({
9
+ address: {
10
+ default: '',
11
+ type: String,
12
+ },
13
+ dataTestId: {
14
+ type: String,
15
+ default: 'u-venue-card',
16
+ },
17
+ divisionLabel: {
18
+ default: '',
19
+ type: String,
20
+ },
21
+ divisions: {
22
+ default: () => [],
23
+ type: Array,
24
+ },
25
+ lat: {
26
+ default: 0,
27
+ type: Number,
28
+ },
29
+ lng: {
30
+ default: 0,
31
+ type: Number,
32
+ },
33
+ venueMapBtnLabel: {
34
+ default: 'Open in Map',
35
+ type: String,
36
+ },
37
+ venueName: {
38
+ default: '',
39
+ type: String,
40
+ },
41
+ zoom: {
42
+ default: 14,
43
+ type: Number,
44
+ },
45
+ })
46
+
47
+ const googleApiKey = process.env.GOOGLE_MAP_API_KEY
48
+
49
+ const $screen = useScreenType()
50
+
51
+ const chip = ref(true)
52
+
53
+ const mapUrl = computed(() => {
54
+ const encodedName = encodeURIComponent(props.venueName)
55
+ const latLng = `${props.lat},${props.lng}`
56
+
57
+ if ($screen.value.isMobile) {
58
+ return `https://www.google.com/maps/dir/?api=1&destination=${latLng}`
59
+ } else {
60
+ return `https://www.google.com/maps/search/?api=1&query=${encodedName}%20(${latLng})`
61
+ }
62
+ })
63
+
64
+ const handleMapBtn = () => {
65
+ const isMobile = $screen.value.isMobile
66
+
67
+ if (isMobile) {
68
+ window.location.href = mapUrl.value
69
+ } else {
70
+ window.open(mapUrl.value, '_blank', 'noopener,noreferrer')
71
+ }
72
+ }
73
+ </script>
74
+
75
+ <template>
76
+ <q-card v-bind="$attrs" class="u-venue-card full-width">
77
+ <q-card-section class="u-venue-card-header col">
78
+ <span class="text-heading-xxs q-mb-0">{{ venueName }}</span>
79
+ <span class="text-body-xs text-description">{{ address }}</span>
80
+ </q-card-section>
81
+
82
+ <q-card-section class="u-venue-card-body">
83
+ <GoogleMap
84
+ :api-key="googleApiKey"
85
+ :center="{ lat, lng }"
86
+ :clickable-icons="false"
87
+ :disable-default-u-i="true"
88
+ :fullscreen-control="false"
89
+ :gesture-handling="'none'"
90
+ :keyboard-shortcuts="false"
91
+ mapId="roadmap"
92
+ :map-type-control="false"
93
+ :street-view-control="false"
94
+ style="width: 100%; height: 7.25rem"
95
+ :zoom="zoom"
96
+ :zoom-control="false"
97
+ >
98
+ <AdvancedMarker :options="{ position: { lat, lng } }" />
99
+ </GoogleMap>
100
+
101
+ <UBtnStd
102
+ class="u-venue-card-map-btn"
103
+ :aria-label="venueMapBtnLabel"
104
+ color="primary"
105
+ :label="venueMapBtnLabel"
106
+ size="sm"
107
+ @click="handleMapBtn"
108
+ />
109
+ </q-card-section>
110
+
111
+ <q-card-section class="u-venue-card-footer">
112
+ <span class="text-body-sm">{{ divisionLabel }}</span>
113
+ <div class="width-full chip-container">
114
+ <UChip
115
+ v-for="(item, index) in divisions"
116
+ v-model="chip"
117
+ :chip-label="item.label"
118
+ dense
119
+ :key="index"
120
+ :removable="false"
121
+ />
122
+ </div>
123
+ </q-card-section>
124
+ </q-card>
125
+ </template>
126
+
127
+ <style lang="sass">
128
+ .u-venue-card
129
+ display: flex
130
+ flex-direction: column
131
+ border-radius: $xs
132
+ box-shadow: none
133
+ padding: $ba
134
+ border: 1px solid $neutral-4
135
+ gap: $ba
136
+
137
+ .u-venue-card-header
138
+ display: flex
139
+ flex-direction: column
140
+ padding: 0
141
+
142
+ .u-venue-card-body
143
+ padding: 0
144
+ height: 7.25rem
145
+ background: $neutral-4
146
+ border-radius: $xs !important
147
+ position: relative
148
+ overflow: hidden
149
+
150
+ .u-venue-card-map-btn
151
+ position: absolute
152
+ bottom: $ba
153
+ right: $ba
154
+
155
+ .u-venue-card-footer
156
+ gap: $xs
157
+ padding: 0
158
+
159
+ .chip-container
160
+ display: flex
161
+ gap: $xs
162
+ margin-top: $xs
163
+ flex-wrap: wrap
164
+
165
+ .q-chip
166
+ margin: 0 !important
167
+ </style>
@@ -44,6 +44,7 @@ import UToolbar from './core/UToolbar/UToolbar.vue'
44
44
  import UTooltip from './core/UTooltip.vue'
45
45
  import UTypeahead from './core/UTypeahead.vue'
46
46
  import UUploader from './core/UUploader.vue'
47
+ import UVenueCard from './core/UVenueCard.vue'
47
48
 
48
49
  import { useNotify } from '../composables/useNotify.js'
49
50
  import { useOverlayLoader } from '../composables/useOverlayLoader.js'
@@ -99,4 +100,5 @@ export {
99
100
  UTooltip,
100
101
  UTypeahead,
101
102
  UUploader,
103
+ UVenueCard
102
104
  }