Skip to content

Commit

Permalink
feat: add website field with prefix/suffix support #164
Browse files Browse the repository at this point in the history
  • Loading branch information
wazolab committed Feb 14, 2024
1 parent 738eb32 commit eea8444
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions components/Fields/Field.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import OpeningHours, { isOpeningHoursSupportedOsmTags } from '~/components/Field
import Phone from '~/components/Fields/Phone.vue'
import RoutesField, { isRoutesFieldEmpty } from '~/components/Fields/RoutesField.vue'
import Stars from '~/components/Fields/Stars.vue'
import Website from '~/components/Fields/Website.vue'
import ExternalLink from '~/components/UI/ExternalLink.vue'
import FieldsHeader from '~/components/UI/FieldsHeader.vue'
import type { ApiPoiProperties, FieldsListItem } from '~/lib/apiPois'
Expand Down Expand Up @@ -49,6 +50,7 @@ export default defineNuxtComponent({
Instagram,
ExternalLink,
Stars,
Website,
},
emits: {
Expand Down Expand Up @@ -94,6 +96,9 @@ export default defineNuxtComponent({
shortDescription(): string | undefined {
return this.properties?.description?.replace(/(<([^>]+)>)/gi, '')
},
isWebsite(): boolean {
return /\w*:?website:?\w*/.test(this.field.field)
},
},
methods: {
Expand Down Expand Up @@ -222,15 +227,7 @@ export default defineNuxtComponent({
<Phone :number="phone" />
</div>

<div
v-for="item in properties[field.field]"
v-else-if="field.field === 'website'"
:key="`website_${item}`"
>
<ExternalLink :href="item" target="_blank">
{{ item }}
</ExternalLink>
</div>
<Website v-else-if="isWebsite" :urls="properties[field.field]" />

<div
v-for="item in properties[field.field]"
Expand Down

0 comments on commit eea8444

Please sign in to comment.