Skip to content

Commit

Permalink
Merge pull request #1 from waeltken/tailwind
Browse files Browse the repository at this point in the history
Add Tailwind and DaisyUI
  • Loading branch information
waeltken authored Apr 11, 2022
2 parents b9c8062 + 9d90361 commit ef67c29
Show file tree
Hide file tree
Showing 10 changed files with 1,482 additions and 264 deletions.
490 changes: 427 additions & 63 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
},
"dependencies": {
"daisyui": "^2.13.6",
"pinia": "^2.0.13",
"vue": "^3.2.31",
"vue-router": "^4.0.14"
Expand All @@ -26,13 +27,16 @@
"@vue/eslint-config-typescript": "^10.0.0",
"@vue/test-utils": "^2.0.0-rc.18",
"@vue/tsconfig": "^0.1.3",
"autoprefixer": "^10.4.4",
"cypress": "^9.5.3",
"eslint": "^8.5.0",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-vue": "^8.2.0",
"jsdom": "^19.0.0",
"postcss": "^8.4.12",
"prettier": "^2.5.1",
"start-server-and-test": "^1.14.0",
"tailwindcss": "^3.0.23",
"typescript": "~4.6.3",
"vite": "^2.9.1",
"vitest": "^0.8.1",
Expand Down
6 changes: 6 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
114 changes: 7 additions & 107 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,119 +1,19 @@
<script setup lang="ts">
import { RouterLink, RouterView } from 'vue-router'
import { RouterView } from 'vue-router'
import WelcomeKitchenSink from '@/components/WelcomeKitchenSink.vue'
import Navbar from "@/components/Navbar.vue"
</script>

<template>
<header>
<img alt="Azure Cognitive Services Logo" class="logo" src="@/assets/logo.svg" width="125" height="125" />
<Navbar />

</header>
<main class="container auto-mx">
<div class="wrapper">
<WelcomeKitchenSink />

<nav>
<RouterLink to="/">Home</RouterLink>
<RouterLink to="/about">About</RouterLink>
</nav>
</div>
</header>
<RouterView />
</main>

<RouterView />
</template>

<style>
@import '@/assets/base.css';
#app {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
font-weight: normal;
}
header {
line-height: 1.5;
max-height: 100vh;
}
.logo {
display: block;
margin: 0 auto 2rem;
}
a,
.blue {
text-decoration: none;
color: rgb(0, 120, 215);
transition: 0.4s;
}
@media (hover: hover) {
a:hover {
background-color: hsla(160, 100%, 37%, 0.2);
}
}
nav {
width: 100%;
font-size: 12px;
text-align: center;
margin-top: 2rem;
}
nav a.router-link-exact-active {
color: var(--color-text);
}
nav a.router-link-exact-active:hover {
background-color: transparent;
}
nav a {
display: inline-block;
padding: 0 1rem;
border-left: 1px solid var(--color-border);
}
nav a:first-of-type {
border: 0;
}
@media (min-width: 1024px) {
body {
display: flex;
place-items: center;
}
#app {
display: grid;
grid-template-columns: 1fr 1fr;
padding: 0 2rem;
}
header {
display: flex;
place-items: center;
padding-right: calc(var(--section-gap) / 2);
}
header .wrapper {
display: flex;
place-items: flex-start;
flex-wrap: wrap;
}
.logo {
margin: 0 2rem 0 0;
}
nav {
text-align: left;
margin-left: -1rem;
font-size: 1rem;
padding: 1rem 0;
margin-top: 1rem;
}
}
</style>
74 changes: 0 additions & 74 deletions src/assets/base.css

This file was deleted.

3 changes: 3 additions & 0 deletions src/assets/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
49 changes: 49 additions & 0 deletions src/components/Navbar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<script setup lang="ts">
import { RouterLink } from 'vue-router'
</script>

<template>
<div class="navbar bg-base-100">
<div class="navbar-start">
<div class="dropdown">
<label tabindex="0" class="btn btn-ghost lg:hidden">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h8m-8 6h16" /></svg>
</label>
<ul tabindex="0" class="menu menu-compact dropdown-content mt-3 p-2 shadow bg-base-100 rounded-box w-52">
<li><a>Item 1</a></li>
<li tabindex="0">
<a class="justify-between">
Parent
<svg class="fill-current" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z"/></svg>
</a>
<ul class="p-2">
<li><a>Submenu 1</a></li>
<li><a>Submenu 2</a></li>
</ul>
</li>
<li><a>Item 3</a></li>
</ul>
</div>
<a class="btn btn-ghost normal-case text-xl">Cognitive Services Kitchen Sink</a>
</div>
<div class="navbar-center hidden lg:flex">
<ul class="menu menu-horizontal p-0">
<li><a>Item 1</a></li>
<li tabindex="0">
<a>
Parent
<svg class="fill-current" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24"><path d="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z"/></svg>
</a>
<ul class="p-2">
<li><a>Submenu 1</a></li>
<li><a>Submenu 2</a></li>
</ul>
</li>
<li><a>Item 3</a></li>
</ul>
</div>
<div class="navbar-end">
<a class="btn">Get started</a>
</div>
</div>
</template>
18 changes: 10 additions & 8 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import { createApp } from "vue";
import { createPinia } from "pinia";

import App from './App.vue'
import router from './router'
import App from "./App.vue";
import router from "./router";

const app = createApp(App)
import "./assets/index.css";

app.use(createPinia())
app.use(router)
const app = createApp(App);

app.mount('#app')
app.use(createPinia());
app.use(router);

app.mount("#app");
26 changes: 14 additions & 12 deletions src/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import { createRouter, createWebHistory } from "vue-router";
import HomeView from "../views/HomeView.vue";

const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/',
name: 'home',
component: HomeView
path: "/",
name: "home",
component: HomeView,
},
{
path: '/about',
name: 'about',
path: "/about",
name: "about",
// route level code-splitting
// this generates a separate chunk (About.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import('../views/AboutView.vue')
}
]
})
component: () => import("../views/AboutView.vue"),
},
],
linkActiveClass: "",
linkExactActiveClass: "",
});

export default router
export default router;
Loading

0 comments on commit ef67c29

Please sign in to comment.