This commit is contained in:
2023-03-01 19:32:25 +10:00
parent bc79951700
commit 07aa82e7d9
2 changed files with 30 additions and 3 deletions

View File

@@ -28,6 +28,10 @@
<ion-icon class="icon" name="location-outline" /> <ion-icon class="icon" name="location-outline" />
<p>{{ location }}</p> <p>{{ location }}</p>
</div> </div>
<div v-if="ages" class="sm-panel-ages">
<ion-icon class="icon" name="body-outline" />
<p>{{ ages }}</p>
</div>
<div v-if="price" class="sm-panel-price"> <div v-if="price" class="sm-panel-price">
<span class="icon">$</span> <span class="icon">$</span>
<p>{{ computedPrice }}</p> <p>{{ computedPrice }}</p>
@@ -149,6 +153,11 @@ const props = defineProps({
default: "", default: "",
required: false, required: false,
}, },
ages: {
type: String,
default: "",
required: false,
},
}); });
let styleObject = reactive({}); let styleObject = reactive({});
@@ -324,12 +333,13 @@ watch(
.sm-panel-date, .sm-panel-date,
.sm-panel-location, .sm-panel-location,
.sm-panel-price { .sm-panel-price,
.sm-panel-ages {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: top; align-items: top;
font-size: 80%; font-size: 80%;
margin-bottom: 0.4rem; margin-bottom: 0rem;
.icon { .icon {
flex: 0 1 1rem; flex: 0 1 1rem;

View File

@@ -45,7 +45,8 @@
: item.event.address : item.event.address
" "
:banner="item.banner" :banner="item.banner"
:banner-type="item.bannerType"></SMPanel> :banner-type="item.bannerType"
:ages="computedAges(item.event)"></SMPanel>
</SMPanelList> </SMPanelList>
<SMPagination <SMPagination
v-model="postsPage" v-model="postsPage"
@@ -217,6 +218,22 @@ const handleFilter = async () => {
handleLoad(); handleLoad();
}; };
/**
* Return a human readable Ages string.
*
* @param item
*/
const computedAges = (item: Event): string => {
const trimmed = item.ages.trim();
const regex = /^(\d+)(\s*\+?\s*|\s*-\s*\d+\s*)?$/;
if (regex.test(trimmed)) {
return `Ages ${trimmed}`;
}
return item.ages;
};
watch( watch(
() => postsPage.value, () => postsPage.value,
() => { () => {