Skip to content

Commit

Permalink
hosting, icons, signin with google
Browse files Browse the repository at this point in the history
  • Loading branch information
sushil-kamble committed Nov 20, 2021
1 parent 16e06be commit dc0878a
Show file tree
Hide file tree
Showing 25 changed files with 730 additions and 291 deletions.
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "vueauthfire"
}
}
6 changes: 6 additions & 0 deletions .idea/vcs.xml

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

16 changes: 16 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"hosting": {
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Goldman&family=Ubuntu:wght@400&display=swap" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
</head>
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
"serve": "vite preview"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.36",
"@fortawesome/free-brands-svg-icons": "^5.15.4",
"@fortawesome/free-solid-svg-icons": "^5.15.4",
"@fortawesome/vue-fontawesome": "^3.0.0-5",
"firebase": "^9.1.2",
"vue": "^3.2.16",
"vue-router": "4"
Expand Down
40 changes: 29 additions & 11 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,25 +1,43 @@
<template>
<div class="bg-gray-200">
<Navbar class="mb-4 py-4 px-2 md:px-0 w-full md:w-10/12 mx-auto" />
<div
v-if="isLoading"
class="flex items-center justify-center"
style="height: 80vh"
>
<Loading class="h-16 w-16" />
</div>

<div class="container mx-auto px-2 md:px-0">
<router-view v-slot="{ Component, route }">
<transition name="slide" mode="out-in">
<component :is="Component" :key="route.path" />
</transition>
</router-view>
<div v-else>
<Navbar />
<div class="main-set">
<router-view v-slot="{ Component, route }">
<transition name="slide" mode="out-in">
<component :is="Component" :key="route.path" />
</transition>
</router-view>
</div>
</div>
</template>

<script>
import { defineComponent, ref } from "@vue/runtime-core";
import Navbar from "./components/Navbar.vue";
export default {
import Loading from "./components/Loading.vue";
export default defineComponent({
name: "App",
components: {
Navbar,
Loading,
},
setup(props) {
const isLoading = ref(true);
setTimeout(() => {
isLoading.value = false;
}, 1000);
return {
isLoading,
};
},
};
});
</script>

<style scoped>
Expand Down
77 changes: 77 additions & 0 deletions src/assets/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/* ./src/index.css */
@tailwind base;
@tailwind components;
@tailwind utilities;

body {
background-color: #22272e;
color: white;
font-family: Ubuntu, sans-serif;
}

.main-set {
@apply lg:container lg:mx-auto md:px-20 2xl:px-40;
}

@layer base {
h1 {
@apply text-xl font-heading font-bold md:text-3xl;
}
h2 {
@apply font-heading text-xl md:text-2xl;
}
h3 {
@apply font-text text-base md:text-lg;
}
h4 {
@apply font-heading text-xs md:text-lg;
}
h5 {
@apply font-text text-xs md:text-base;
}
}

hr {
@apply border-primary mt-1 my-4;
}

/* AUTH */
.section {
@apply my-4 md:my-20 w-11/12 md:w-2/3 lg:w-3/5 mx-auto;
}
.auth-form {
@apply bg-secondary shadow-md rounded p-6;
}
/* AUTH */

/* Pages */
.page-pos {
@apply my-4 md:my-20;
}
/* Pages */

.router-link-active {
@apply bg-primary;
}

.t-input {
@apply shadow
appearance-none
border
rounded
w-full
p-3
text-black
leading-tight
focus:outline-none;
}

.t-btn {
@apply font-bold py-2 px-4 rounded focus:outline-none ease-linear
transition-all
duration-150;
}

.transition-effect {
@apply transition duration-500 ease-in-out;
}
7 changes: 4 additions & 3 deletions src/components/Dialog.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<template>
<div>
<button
class="t-btn bg-blue-500 hover:bg-blue-700 text-white"
class="t-btn bg-primary hover:bg-opacity-80"
type="button"
v-on:click="toggleModal()"
@focusout="showModal = false"
tabindex="0"
>
<font-awesome-icon :icon="['fas', 'info-circle']" class="mr-1" />
{{ buttonName }}
</button>
<transition name="bounce">
Expand Down Expand Up @@ -34,7 +35,7 @@
relative
flex flex-col
w-full
bg-white
bg-secondary
outline-none
focus:outline-none
"
Expand All @@ -50,7 +51,7 @@
rounded-t
"
>
<h3 class="text-3xl font-semibold">{{ title }}</h3>
<h1>{{ title }}</h1>
</div>
<!--body-->
<div class="relative p-6 flex-auto">
Expand Down
107 changes: 107 additions & 0 deletions src/components/Menu.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<template>
<!-- Profile dropdown -->
<div class="ml-3 relative">
<div>
<button
type="button"
class="text-lg h-8 w-8 rounded-full hover:bg-primary"
aria-expanded="false"
aria-haspopup="true"
@click="toggle"
>
<font-awesome-icon :icon="['fas', 'bars']" class="" />
</button>
</div>
<transition name="fade">
<div
v-if="show"
class="
origin-top-right
absolute
right-0
mt-2
w-32
rounded-md
shadow-lg
py-1
bg-gray-800
text-white
font-heading
"
role="menu"
aria-orientation="vertical"
aria-labelledby="user-menu-button"
tabindex="-1"
>
<router-link
v-for="(item, n) in user ? menuAuth : menuNoAuth"
:key="n"
:to="item.link"
class="block px-4 py-2 text-sm"
@click="toggle"
>
{{ item.name }}
</router-link>
<p
v-if="user"
class="px-4 py-2 text-sm cursor-pointer text-red-500"
@click="signOutUser"
>
Logout
</p>
</div>
</transition>
</div>
</template>

<script>
import { useAuthState, useSignOut } from "@/firebase";
import { defineComponent, ref } from "vue";
import { useRouter } from "vue-router";
export default defineComponent({
name: "Menu",
setup() {
const { user } = useAuthState();
const menuAuth = [
{ name: "Home", link: { name: "Home" } },
{ name: "Profile", link: { name: "Profile" } },
{ name: "Database", link: { name: "Database" } },
];
const menuNoAuth = [
{ name: "Home", link: { name: "Home" } },
{ name: "Login", link: { name: "Login" } },
{ name: "Signup", link: { name: "SignUp" } },
];
const show = ref(false);
const toggle = () => {
show.value = !show.value;
};
const router = useRouter();
const signOutUser = async () => {
toggle();
await useSignOut();
await router.replace({ name: "Login" });
};
return { show, toggle, user, signOutUser, menuAuth, menuNoAuth };
},
});
</script>

<style lang="postcss" scoped>
.menu-button {
@apply py-2 px-4 ml-2 font-heading rounded bg-primary
hover:bg-opacity-75;
}
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.5s;
}
.fade-enter,
.fade-leave-to {
opacity: 0;
}
</style>
Loading

0 comments on commit dc0878a

Please sign in to comment.