Skip to content

Commit

Permalink
v1.4.3: Improved blog post creation
Browse files Browse the repository at this point in the history
  • Loading branch information
timyboy12345 committed Nov 26, 2023
1 parent 6cdfd2d commit b6abee6
Show file tree
Hide file tree
Showing 10 changed files with 331 additions and 62 deletions.
40 changes: 6 additions & 34 deletions components/form/CustomInput.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
<template>
<div class="flex flex-col">
<label class="text-gray-600 text-sm mb-1" :for="id">{{ label }}</label>
<input
:id="id"
v-model="internalValue"
:type="type"
class="border border-gray-300 rounded focus:outline-none focus:shadow-outline focus:border-indigo-300"
:name="id"
:placeholder="placeholder"
@keypress.enter="$emit('keypress', $event)"
/>

<slot name="input"></slot>

<div class="text-sm text-gray-400 flex flex-col py-2 -mt-2">
<slot name="bottom"></slot>
</div>

<div v-if="description" class="text-gray-600 text-sm">
{{ description }}
Expand All @@ -33,31 +30,6 @@ export default {
type: String,
default: null,
},
placeholder: {
required: false,
type: String,
default: null,
},
type: {
required: false,
type: String,
default: 'text',
},
value: {
required: false,
type: [String, Number],
default: null,
},
},
computed: {
internalValue: {
get() {
return this.value
},
set(value) {
this.$emit('input', value)
},
},
},
}
</script>
74 changes: 74 additions & 0 deletions components/form/CustomSelectInput.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<template>
<CustomInput :id="id" :label="label" :description="description" class="flex flex-col">
<template #input>
<select
:id="id"
v-model="internalValue"
class="border border-gray-300 rounded focus:outline-none focus:shadow-outline focus:border-indigo-300"
:name="id"
:placeholder="placeholder"
:disabled="typeof options === undefined"
>
<option value="" :disabled="required">Maak een keuze</option>
<option v-for="option of options" :key="option.value" :value="option.value">
{{ option.text }}
</option>
</select>
</template>
</CustomInput>
</template>

<script>
import CustomInput from '~/components/form/CustomInput.vue'
export default {
components: { CustomInput },
props: {
id: {
required: true,
type: String,
},
label: {
required: true,
type: String,
},
description: {
required: false,
type: String,
default: null,
},
placeholder: {
required: false,
type: String,
default: null,
},
options: {
required: false,
default() {
return []
},
type: Array,
},
value: {
required: false,
type: [String, Number],
default: null,
},
required: {
required: false,
type: Boolean,
default: false,
},
},
computed: {
internalValue: {
get() {
return this.value
},
set(value) {
this.$emit('input', value)
},
},
},
}
</script>
98 changes: 98 additions & 0 deletions components/form/CustomTextInput.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<template>
<CustomInput :id="id" :label="label" :description="description" class="flex flex-col">
<template #input>
<input
:id="id"
v-model="internalValue"
:type="type"
class="border border-gray-300 rounded focus:outline-none focus:shadow-outline focus:border-indigo-300"
:name="id"
:placeholder="placeholder"
@keypress.enter="$emit('keypress', $event)"
/>
</template>

<template v-if="minLength || maxLength" #bottom>
{{ charLengthMessage }}
</template>
</CustomInput>
</template>

<script>
import CustomInput from '~/components/form/CustomInput.vue'
export default {
components: { CustomInput },
props: {
id: {
required: true,
type: String,
},
label: {
required: true,
type: String,
},
description: {
required: false,
type: String,
default: null,
},
placeholder: {
required: false,
type: String,
default: null,
},
type: {
required: false,
type: String,
default: 'text',
validator(value) {
// The value must match one of these strings
return ['text', 'number', 'email', 'password'].includes(value)
},
},
value: {
required: false,
type: [String, Number],
default: null,
},
minLength: {
required: false,
type: Number,
default: null,
},
maxLength: {
required: false,
type: Number,
default: null,
},
},
computed: {
internalValue: {
get() {
return this.value
},
set(value) {
this.$emit('input', value)
},
},
charLengthMessage() {
let m = `Karakters: ${this.value.length}, `
if (this.minLength) {
m += `Min: ${this.minLength}`
}
if (this.minLength) {
m += ` / `
}
if (this.minLength) {
m += `Max: ${this.maxLength}`
}
return m
},
},
}
</script>
63 changes: 63 additions & 0 deletions components/form/CustomUrlInput.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<template>
<CustomInput :id="id" :label="label" :description="description" class="flex flex-col">
<template #input>
<input
:id="id"
v-model="internalValue"
type="text"
class="border border-gray-300 rounded focus:outline-none focus:shadow-outline focus:border-indigo-300"
:name="id"
:placeholder="placeholder"
/>
</template>
</CustomInput>
</template>

<script>
import CustomInput from '~/components/form/CustomInput.vue'
export default {
components: { CustomInput },
props: {
id: {
required: true,
type: String,
},
label: {
required: true,
type: String,
},
description: {
required: false,
type: String,
default: null,
},
placeholder: {
required: false,
type: String,
default: null,
},
value: {
required: false,
type: [String, Number],
default: null,
},
},
computed: {
internalValue: {
get() {
return this.value
},
set(value) {
const slug = value
.toLowerCase()
.replace(/[^\w\s-]/g, '')
.replace(/[\s_-]+/g, '-')
.replace(/^-+|-+$/g, '')
this.$emit('input', slug)
},
},
},
}
</script>
8 changes: 4 additions & 4 deletions components/popups/AddCheckinPopup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<div class="absolute shadow w-full bottom-0 left-0 z-10">
<div class="bg-white rounded shadow m-4 p-4 rounded gap-y-4 flex flex-col">
<div v-if="!saving" class="flex flex-col gap-y-4">
<CustomInput
<CustomTextInput
id="dateTime"
v-model="dateTime"
:description="$t('checkins.dateTimeDescription')"
type="datetime-local"
label="Datum en tijd"
placeholder="Wanneer ben je er in geweest?"
/>
<CustomInput
<CustomTextInput
id="wait"
v-model="waitTime"
:description="$t('checkins.waitTimeDescription')"
Expand All @@ -35,12 +35,12 @@
</template>

<script>
import CustomInput from '@/components/form/CustomInput'
import CustomTextInput from '@/components/form/CustomTextInput'
import LoadingSpinner from '@/components/LoadingSpinner'
export default {
name: 'AddCheckinPopup',
components: { LoadingSpinner, CustomInput },
components: { LoadingSpinner, CustomTextInput },
data() {
return {
saving: false,
Expand Down
8 changes: 4 additions & 4 deletions components/popups/EditCheckinPopup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<div class="absolute shadow w-full bottom-0 left-0 z-10">
<div class="bg-white rounded shadow m-4 p-4 rounded gap-y-4 flex flex-col">
<div v-if="!saving" class="flex flex-col gap-y-4">
<CustomInput
<CustomTextInput
id="dateTime"
v-model="dateTime"
:description="$t('checkins.dateTimeDescription')"
type="datetime-local"
label="Datum en tijd"
placeholder="Wanneer ben je er in geweest?"
/>
<CustomInput
<CustomTextInput
id="wait"
v-model="waitTime"
:description="$t('checkins.waitTimeDescription')"
Expand Down Expand Up @@ -39,12 +39,12 @@
</template>

<script>
import CustomInput from '@/components/form/CustomInput'
import LoadingSpinner from '@/components/LoadingSpinner'
import CustomTextInput from '@/components/form/CustomTextInput.vue'
export default {
name: 'EditCheckinPopup',
components: { LoadingSpinner, CustomInput },
components: { CustomTextInput, LoadingSpinner },
props: {
checkin: { type: Object, required: true },
},
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "themeparks-nuxtjs",
"version": "1.4.2",
"version": "1.4.3",
"private": false,
"repository": {
"url": "https://github.com/timyboy12345/Themeparks-NuxtJS"
Expand Down
Loading

1 comment on commit b6abee6

@hop-deploy
Copy link

@hop-deploy hop-deploy bot commented on b6abee6 Nov 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deployment Status Build Logs Updated At
themeparks-nuxtjs ✅ Deployed View Logs 2023-11-26T00:45:41.305Z

Please sign in to comment.