Skip to content

Commit

Permalink
chore(eslint): switch to eslint-config-typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
sfxcode committed Apr 11, 2023
1 parent b57ec6e commit 3fe2147
Show file tree
Hide file tree
Showing 19 changed files with 321 additions and 514 deletions.
9 changes: 8 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{
"extends": "@antfu"
"extends": [
"@nuxtjs/eslint-config-typescript"
],
"rules": {
"@typescript-eslint/no-unused-vars": [
"off"
]
}
}
2 changes: 1 addition & 1 deletion app.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup>
useHead({
title: 'Nuxt 3 PrimeVue Starter',
title: 'Nuxt 3 PrimeVue Starter'
})
</script>

Expand Down
9 changes: 5 additions & 4 deletions components/AdvertiseBox.vue
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
<script setup lang='ts'>
defineProps({
header: {
type: String,
default: null,
required: true,
required: true
},
icon: {
type: String,
default: null,
required: true,
required: true
},
color: {
type: String,
default: null,
},
default: null
}
})
</script>

Expand Down
56 changes: 28 additions & 28 deletions composables/navigation.ts
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
export function useNavigationMenu() {
export function useNavigationMenu () {
const navigationMenu = () => {
return [
{
label: 'Home',
items: [{
label: 'Dashboard', to: '/', icon: 'pi pi-fw pi-home',
}],
label: 'Dashboard', to: '/', icon: 'pi pi-fw pi-home'
}]
},
{
label: 'PrimeVue',
items: [
{ label: 'DataTable', icon: 'pi pi-fw pi-table', to: '/prime/datatable' },
{ label: 'Messages', icon: 'pi pi-fw pi-user-edit', to: '/prime/messages' },
{ label: 'Validation', icon: 'pi pi-fw pi-user-edit', to: '/prime/validation' },
],
{ label: 'Validation', icon: 'pi pi-fw pi-user-edit', to: '/prime/validation' }
]
},
{
label: 'UI',
items: [
{ label: 'UnoCSS', icon: 'pi pi-fw pi-user-edit', to: '/ui/uno' },
{ label: 'Icons', icon: 'pi pi-fw pi-user-edit', to: '/ui/icons' },
],
{ label: 'Icons', icon: 'pi pi-fw pi-user-edit', to: '/ui/icons' }
]
},
{
label: 'Content',
items: [
{ label: 'Markdown', icon: 'pi pi-fw pi-user-edit', to: '/cms/markdown' },
{ label: 'Component', icon: 'pi pi-fw pi-user-edit', to: '/cms/component' },
],
{ label: 'Component', icon: 'pi pi-fw pi-user-edit', to: '/cms/component' }
]
},
{
label: 'Pages',
items: [
{ label: 'Stores', icon: 'pi pi-fw pi-database', to: '/stores' },
{ label: 'Server', icon: 'pi pi-fw pi-database', to: '/server' },
],
{ label: 'Server', icon: 'pi pi-fw pi-database', to: '/server' }
]
},
{
label: 'Templates',
items: [
{ label: 'Blueprint', icon: 'pi pi-fw pi-user-edit', to: '/templates/blueprint' },
],
{ label: 'Blueprint', icon: 'pi pi-fw pi-user-edit', to: '/templates/blueprint' }
]
},
{
label: 'Menu Hierarchy',
Expand All @@ -56,18 +56,18 @@ export function useNavigationMenu() {
items: [
{ label: 'Submenu 1.1.1', icon: 'pi pi-fw pi-bookmark' },
{ label: 'Submenu 1.1.2', icon: 'pi pi-fw pi-bookmark' },
{ label: 'Submenu 1.1.3', icon: 'pi pi-fw pi-bookmark' },
],
{ label: 'Submenu 1.1.3', icon: 'pi pi-fw pi-bookmark' }
]
},
{
label: 'Submenu 1.2',
icon: 'pi pi-fw pi-bookmark',
items: [
{ label: 'Submenu 1.2.1', icon: 'pi pi-fw pi-bookmark' },
{ label: 'Submenu 1.2.2', icon: 'pi pi-fw pi-bookmark' },
],
},
],
{ label: 'Submenu 1.2.2', icon: 'pi pi-fw pi-bookmark' }
]
}
]
},
{
label: 'Submenu 2',
Expand All @@ -79,21 +79,21 @@ export function useNavigationMenu() {
items: [
{ label: 'Submenu 2.1.1', icon: 'pi pi-fw pi-bookmark' },
{ label: 'Submenu 2.1.2', icon: 'pi pi-fw pi-bookmark' },
{ label: 'Submenu 2.1.3', icon: 'pi pi-fw pi-bookmark' },
],
{ label: 'Submenu 2.1.3', icon: 'pi pi-fw pi-bookmark' }
]
},
{
label: 'Submenu 2.2',
icon: 'pi pi-fw pi-bookmark',
items: [
{ label: 'Submenu 2.2.1', icon: 'pi pi-fw pi-bookmark' },
{ label: 'Submenu 2.2.2', icon: 'pi pi-fw pi-bookmark' },
],
},
],
},
],
},
{ label: 'Submenu 2.2.2', icon: 'pi pi-fw pi-bookmark' }
]
}
]
}
]
}

]
}
Expand Down
2 changes: 1 addition & 1 deletion formkit.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { DefaultConfigOptions } from '@formkit/vue'
import { primeInputs } from '@sfxcode/formkit-primevue'

const config: DefaultConfigOptions = {
inputs: primeInputs,
inputs: primeInputs
}

export default config
4 changes: 2 additions & 2 deletions histoire.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { HstNuxt } from '@histoire/plugin-nuxt'
export default defineConfig({
plugins: [
HstVue(),
HstNuxt(),
HstNuxt()
],
// workaround - unocss integration from nuxt did not work ...
setupFile: 'histoire.setup.ts',
setupFile: 'histoire.setup.ts'
})
79 changes: 33 additions & 46 deletions layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,80 +26,68 @@ watch(() => route,
() => {
menuActive.value = false
toast.removeAllGroups()
},
}
)
function onWrapperClick() {
function onWrapperClick () {
if (!menuClick.value) {
overlayMenuActive.value = false
mobileMenuActive.value = false
}
menuClick.value = false
}
function onMenuToggle() {
function onMenuToggle () {
menuClick.value = true
if (isDesktop()) {
if (layoutMode.value === 'overlay') {
if (mobileMenuActive.value === true)
overlayMenuActive.value = true
if (mobileMenuActive.value === true) { overlayMenuActive.value = true }
overlayMenuActive.value = !overlayMenuActive.value
mobileMenuActive.value = false
}
else if (layoutMode.value === 'static') {
} else if (layoutMode.value === 'static') {
staticMenuInactive.value = !staticMenuInactive.value
}
}
else {
} else {
mobileMenuActive.value = !mobileMenuActive.value
}
}
function onSidebarClick() {
function onSidebarClick () {
menuClick.value = true
}
function onMenuItemClick(event: any) {
function onMenuItemClick (event: any) {
if (event.item && !event.item.items) {
overlayMenuActive.value = false
mobileMenuActive.value = false
}
}
function onLayoutChange(mode: string) {
function onLayoutChange (mode: string) {
layoutMode.value = mode
}
function onLayoutColorChange(mode: string) {
function onLayoutColorChange (mode: string) {
layoutColorMode.value = mode
}
function addClass(element: HTMLElement, className: string) {
if (element.classList)
element.classList.add(className)
else
element.className += ` ${className}`
function addClass (element: HTMLElement, className: string) {
if (element.classList) { element.classList.add(className) } else { element.className += ` ${className}` }
}
function removeClass(element: HTMLElement, className: string) {
if (element.classList)
element.classList.remove(className)
else
element.className = element.className.replace(new RegExp(`(^|\\b)${className.split(' ').join('|')}(\\b|$)`, 'gi'), ' ')
function removeClass (element: HTMLElement, className: string) {
if (element.classList) { element.classList.remove(className) } else { element.className = element.className.replace(new RegExp(`(^|\\b)${className.split(' ').join('|')}(\\b|$)`, 'gi'), ' ') }
}
function isDesktop() {
function isDesktop () {
return window.innerWidth >= 992
}
function isSidebarVisible() {
function isSidebarVisible () {
if (isDesktop()) {
if (layoutMode.value === 'static')
return !staticMenuInactive.value
else if (layoutMode.value === 'overlay')
return overlayMenuActive.value
if (layoutMode.value === 'static') { return !staticMenuInactive.value } else if (layoutMode.value === 'overlay') { return overlayMenuActive.value }
}
return true
Expand All @@ -113,35 +101,34 @@ const containerClass = computed(() => ['layout-wrapper', {
'layout-mobile-sidebar-active': mobileMenuActive.value,
'p-input-filled': primeVue.config.inputStyle === 'filled',
'p-ripple-disabled': primeVue.config.ripple === false,
'layout-theme-light': false,
'layout-theme-light': false
}])
function logo() {
function logo () {
return layoutColorMode.value === 'dark' ? 'images/logo-white.svg' : 'images/logo.svg'
}
onBeforeUpdate(() => {
if (mobileMenuActive.value)
addClass(document.body, 'body-overflow-hidden')
else
removeClass(document.body, 'body-overflow-hidden')
},
if (mobileMenuActive.value) { addClass(document.body, 'body-overflow-hidden') } else { removeClass(document.body, 'body-overflow-hidden') }
}
)
</script>

<template>
<Link rel="stylesheet" :href="themeStore.link || 'https://cdn.jsdelivr.net/npm/primevue@3.15.0/resources/themes/vela-blue/theme.css'" />
<div :class="containerClass" @click="onWrapperClick">
<AppTopBar @menu-toggle="onMenuToggle" />
<div class="layout-sidebar" @click="onSidebarClick">
<AppMenu :model="navigation.navigationMenu()" @menu-item-click="onMenuItemClick" />
</div>
<div>
<Link rel="stylesheet" :href="themeStore.link || 'https://cdn.jsdelivr.net/npm/primevue@3.15.0/resources/themes/vela-blue/theme.css'" />
<div :class="containerClass" @click="onWrapperClick">
<AppTopBar @menu-toggle="onMenuToggle" />
<div class="layout-sidebar" @click="onSidebarClick">
<AppMenu :model="navigation.navigationMenu()" @menu-item-click="onMenuItemClick" />
</div>

<div class="layout-main-container">
<div class="layout-main">
<slot />
<div class="layout-main-container">
<div class="layout-main">
<slot />
</div>
<AppFooter />
</div>
<AppFooter />
</div>
</div>
</template>
Loading

0 comments on commit 3fe2147

Please sign in to comment.