From bf357e48dc261dab08598bd93071ca53ef386402 Mon Sep 17 00:00:00 2001 From: Terry Truong Date: Sat, 21 Jan 2023 13:47:28 +1100 Subject: Adjust frontend coding style --- src/components/InfoModal.vue | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src/components/InfoModal.vue') diff --git a/src/components/InfoModal.vue b/src/components/InfoModal.vue index b9aeb74..6b32ed0 100644 --- a/src/components/InfoModal.vue +++ b/src/components/InfoModal.vue @@ -7,6 +7,7 @@

{{event.title}}

+
Start: {{datesDisplayStrs[0]}} @@ -14,11 +15,13 @@
End: {{datesDisplayStrs[1]}}
+
+
+ +
{{eventInfo.desc}}
(No description found)
@@ -88,26 +93,27 @@ import ExternalLinkIcon from './icon/ExternalLinkIcon.vue'; import {EventInfo, boundedDateToStr, getImagePath} from '../lib'; import {useStore} from '../store'; -// Refs const rootRef = ref(null as HTMLDivElement | null); const closeRef = ref(null as typeof CloseIcon | null); -// Global store const store = useStore(); -// Props + events const props = defineProps({ eventInfo: {type: Object as PropType, required: true}, }); + const emit = defineEmits(['close']); -// For data display +// ========== For data display ========== + const event = computed(() => props.eventInfo.event) + const datesDisplayStrs = computed(() => { let startStr = boundedDateToStr(event.value.start, event.value.startUpper); let endStr = event.value.end == null ? null : boundedDateToStr(event.value.end, event.value.endUpper); return [startStr, endStr]; }); + function licenseToUrl(license: string){ license = license.toLowerCase().replaceAll('-', ' '); if (license == 'cc0'){ @@ -139,19 +145,22 @@ function licenseToUrl(license: string){ } } -// Close handling +// ========== Close handling ========== + function onClose(evt: Event){ if (evt.target == rootRef.value || closeRef.value!.$el.contains(evt.target)){ emit('close'); } } -// Styles +// ========== For styles ========== + const styles = computed(() => ({ backgroundColor: store.color.bgAlt, borderRadius: store.borderRadius + 'px', overflow: 'visible auto', })); + const imgStyles = computed(() => { return { width: '200px', -- cgit v1.2.3