refactor: flatten components

This commit is contained in:
mutoe 2020-10-06 21:51:27 +08:00
parent 5813c29448
commit 76d2752479
5 changed files with 6 additions and 6 deletions

View File

@ -5,7 +5,7 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"lint": "eslint --ext .ts,.vue \"{src,cypress/integration}/**\"",
"lint": "eslint --ext .ts,.vue,.js \"{src,cypress/integration}/**\"",
"test:unit": "jest",
"test:e2e": "cypress run",
"test": "yarn tsc && yarn lint && yarn test:unit && yarn test:e2e"

View File

@ -6,8 +6,8 @@
<script lang="ts">
import { defineComponent } from 'vue'
import AppFooter from './components/layout/Footer/index.vue'
import AppNavigation from './components/layout/Navigation/index.vue'
import AppFooter from './components/Footer.vue'
import AppNavigation from './components/Navigation.vue'
export default defineComponent({
name: 'App',

View File

@ -38,14 +38,14 @@
<script lang="ts">
import { defineComponent, ref } from 'vue'
import useLinks from './links'
import { useNavigationLinks } from './NavigationHooks'
export default defineComponent({
name: 'AppNavigation',
setup () {
const isUserAuthorized = ref(false)
const { navLinks } = useLinks({ isUserAuthorized })
const { navLinks } = useNavigationLinks({ isUserAuthorized })
return {
isUserAuthorized,

View File

@ -11,7 +11,7 @@ interface NavLink {
display: 'all' | 'anonym' | 'authorized'
}
export default function useLinks ({ isUserAuthorized }: UseLinksProps) {
export function useNavigationLinks ({ isUserAuthorized }: UseLinksProps) {
const displayStatus = computed(() => isUserAuthorized.value ? 'anonym' : 'authorized')
const allNavLinks: NavLink[] = [