Update UI for mobile view

main
TZGyn 2 years ago
parent e95b31bdcd
commit d90a835a27
Signed by: TZGyn
GPG Key ID: 122EAF77AE81FD4A

@ -1,7 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
type Post = { type Post = {
title: String title: String
description: String | null | undefined description: String
} }
const props = defineProps<Post>() const props = defineProps<Post>()

@ -26,7 +26,7 @@ const submitPost = async () => {
closeModal() closeModal()
} }
onClickOutside(modal, (event) => { onClickOutside(modal, () => {
closeModal() closeModal()
}) })
@ -41,7 +41,7 @@ watch(
<template> <template>
<div class="fixed top-0 flex h-screen w-screen justify-center"> <div class="fixed top-0 flex h-screen w-screen justify-center">
<div ref="modal" <div ref="modal"
class="relative mt-20 flex h-fit max-h-[1000px] min-h-[500px] w-2/3 flex-col items-center border border-lightgray bg-secondary p-4"> class="relative mx-4 mt-20 flex h-96 w-full max-w-3xl flex-col items-center border border-lightgray bg-secondary p-4">
<label class="mt-2 w-full"> Title </label> <label class="mt-2 w-full"> Title </label>
<input type="text" v-model="newPost.title" class="mt-2 w-full rounded-md" /> <input type="text" v-model="newPost.title" class="mt-2 w-full rounded-md" />

@ -3,8 +3,6 @@ definePageMeta({
middleware: ['auth'], middleware: ['auth'],
}) })
import { z } from 'zod'
const posts = usePosts() const posts = usePosts()
const openCreatePostModal = ref<Boolean>(false) const openCreatePostModal = ref<Boolean>(false)
@ -12,11 +10,6 @@ const getPosts = async () => {
await fetchPosts() await fetchPosts()
} }
const logout = async () => {
await userLogout()
useRouter().push('/login')
}
const toggleCreatePostModal = () => { const toggleCreatePostModal = () => {
openCreatePostModal.value = !openCreatePostModal.value openCreatePostModal.value = !openCreatePostModal.value
} }
@ -34,8 +27,7 @@ onMounted(() => {
<div> <div>
<Header /> <Header />
<div class="mt-16 flex w-full items-center justify-center"> <div class="mt-16 flex w-full items-center justify-center">
<div class="flex w-1/2 flex-col gap-4 px-4 pb-10 pt-4 2xl:w-1/3"> <div class="flex w-full max-w-2xl flex-col gap-4 px-4 pb-10 pt-4">
<button @click="getUserPosts()"> User Posts </button>
<div v-if="posts" v-for="post in posts"> <div v-if="posts" v-for="post in posts">
<PostCard :title="post.title" :description="post.description" /> <PostCard :title="post.title" :description="post.description" />
</div> </div>
@ -43,7 +35,7 @@ onMounted(() => {
</div> </div>
</div> </div>
<button @click="createPost()" <button @click="createPost()"
class="fixed bottom-12 right-12 flex items-center justify-center gap-2 rounded-full bg-blue-500 p-4"> class="fixed bottom-6 right-6 flex items-center justify-center gap-2 rounded-full bg-blue-500 p-4">
<Icon name="plus" /> <Icon name="plus" />
Create Post Create Post
</button> </button>

@ -53,7 +53,7 @@ watch(
</script> </script>
<template> <template>
<div class="absolute flex h-screen w-screen items-center justify-center"> <div class="absolute flex h-screen w-screen items-center justify-center p-4">
<div <div
class="flex w-96 flex-col items-center justify-center gap-2 rounded-xl border border-lightgray bg-secondary p-6"> class="flex w-96 flex-col items-center justify-center gap-2 rounded-xl border border-lightgray bg-secondary p-6">
<label v-if="isSignUp" class="mt-2 w-full"> <label v-if="isSignUp" class="mt-2 w-full">

Loading…
Cancel
Save