From aad2f1102c69827d7abc8da2de849fdd62de88aa Mon Sep 17 00:00:00 2001 From: TZGyn Date: Tue, 20 Jun 2023 14:18:28 +0800 Subject: [PATCH] Added frontend CreatePost modal --- frontend/app.config.ts | 1 + frontend/assets/css/tailwind.css | 10 ++-- frontend/components/modal/CreatePost.vue | 58 ++++++++++++++++++++++++ frontend/pages/index.vue | 16 +++++++ 4 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 frontend/components/modal/CreatePost.vue diff --git a/frontend/app.config.ts b/frontend/app.config.ts index 620cd88..dbf0fbb 100644 --- a/frontend/app.config.ts +++ b/frontend/app.config.ts @@ -7,6 +7,7 @@ export default defineAppConfig({ loading: 'svg-spinners:90-ring-with-bg', twitter: 'logos:twitter', github: 'mdi:github', + plus: 'mdi:plus', }, }, }) diff --git a/frontend/assets/css/tailwind.css b/frontend/assets/css/tailwind.css index f639b5c..7531f33 100644 --- a/frontend/assets/css/tailwind.css +++ b/frontend/assets/css/tailwind.css @@ -5,13 +5,17 @@ html, body, #__nuxt { - @apply text-light h-full w-full bg-primary; + @apply h-full w-full bg-primary text-light; } input { - @apply bg-darkgray outline-none focus:outline-none; + @apply border border-lightgray bg-darkgray p-2 outline-none focus:outline-none; } textarea { - @apply bg-darkgray outline-none focus:outline-none; + @apply resize-none bg-transparent py-4 outline-none focus:outline-none; +} + +textarea::placeholder { + @apply text-[#71767b]; } diff --git a/frontend/components/modal/CreatePost.vue b/frontend/components/modal/CreatePost.vue new file mode 100644 index 0000000..d92f29c --- /dev/null +++ b/frontend/components/modal/CreatePost.vue @@ -0,0 +1,58 @@ + + + diff --git a/frontend/pages/index.vue b/frontend/pages/index.vue index 59f41fa..1a40290 100644 --- a/frontend/pages/index.vue +++ b/frontend/pages/index.vue @@ -7,6 +7,7 @@ import { z } from 'zod' const posts = usePosts() const lastPost = ref(0) +const openCreatePostModal = ref(false) const responseValidator = z.object({ status: z.number(), @@ -33,6 +34,14 @@ const logout = async () => { useRouter().push('/login') } +const toggleCreatePostModal = () => { + openCreatePostModal.value = !openCreatePostModal.value +} + +const createPost = () => { + toggleCreatePostModal() +} + onMounted(() => { getPosts() }) @@ -43,11 +52,18 @@ onMounted(() => {
+
+ +