fix(theme-press): post layout align & move examples

This commit is contained in:
YunYouJun 2022-10-04 00:07:52 +08:00
parent 7b3c504e61
commit f14ac3f722
18 changed files with 84 additions and 61 deletions

View File

@ -1,30 +0,0 @@
---
title: Valaxy Themes
title_zh: Valaxy 主题
layout: docs
categories:
- Docs
- Example
end: false
themes:
- name: valaxy-theme-yun
repo: YunYouJun/valaxy/tree/main/packages/valaxy-theme-yun
desc: Default Theme for Valaxy
# todo
# preview:
tags:
- yun
- light
---
::: zh-CN
欢迎提交主题。
:::
::: en
Feel free to submit your theme.
:::
<ThemeGallery :themes="frontmatter.themes" />
<br />

View File

@ -253,7 +253,7 @@ If you want to develop a theme and released, you can refer to [valaxy-theme-star
::: zh-CN
如果您希望自己开发一个主题并发布,您可以参考 [valaxy-theme-starter](https://github.com/YunYouJun/valaxy-theme-starter)。
更多内容请参见 [如何创建一个 Valaxy 主题](/themes).
更多内容请参见 [如何创建一个 Valaxy 主题](/themes/index.md).
:::
## Community {lang="en"}

View File

@ -16,7 +16,7 @@ You can click this button to toggle locales.
:::
<div class="text-center">
<PressToggleLocale class="shadow" />
<PressToggleLocale class="btn shadow" />
</div>
::: zh-CN

View File

@ -0,0 +1,37 @@
---
title: Valaxy Themes Gallery
title_zh: Valaxy 主题橱窗
categories:
- Theme
end: false
themes:
- name: valaxy-theme-yun
repo: YunYouJun/valaxy/tree/main/packages/valaxy-theme-yun
desc: Default Theme for Valaxy
# todo
# preview:
tags:
- yun
- light
- name: valaxy-theme-press
repo: YunYouJun/valaxy/tree/main/packages/valaxy-theme-press
desc: Docs Theme for Valaxy
# todo
# preview:
tags:
- docs
- press
---
::: zh-CN
欢迎 [提交主题](https://github.com/YunYouJun/valaxy/blob/main/docs/pages/themes/gallery.md)。
:::
::: en
Feel free to [submit your theme](https://github.com/YunYouJun/valaxy/blob/main/docs/pages/themes/gallery.md).
:::
<ThemeGallery :themes="frontmatter.themes" />
<br />

View File

@ -17,7 +17,7 @@ const prevPost = computed(() => posts.value[findCurrentIndex() + 1])
</script>
<template>
<article class="xl:divide-y xl:divide-gray-200 max-w-6xl m-auto">
<article class="xl:divide-y xl:divide-gray-200 max-w-7xl m-auto" p="x-6" w="full">
<header class="pt-20 xl:pb-10 space-y-1 text-center">
<PressDate :date="frontmatter.date" />
<h1
@ -39,14 +39,14 @@ const prevPost = computed(() => posts.value[findCurrentIndex() + 1])
divide-y
xl:divide-y-0
divide-gray-200
xl:grid xl:grid-cols-5 xl:gap-x-6
xl:grid xl:grid-cols-12 xl:gap-x-6
pb-16
xl:pb-20
"
style="grid-template-rows: auto 1fr"
>
<PressAuthor v-if="frontmatter.author" :frontmatter="frontmatter" />
<div class="divide-y divide-gray-200 xl:pb-0 xl:col-span-3 xl:row-span-2">
<div class="divide-y divide-gray-200 xl:pb-0 xl:col-span-8 xl:row-span-2">
<router-view />
</div>
@ -56,7 +56,7 @@ const prevPost = computed(() => posts.value[findCurrentIndex() + 1])
font-medium
leading-5
divide-y divide-gray-200
xl:col-start-1 xl:row-start-2
xl:col-start-1 xl:row-start-2 xl:col-span-2
"
>
<div v-if="nextPost" class="py-8">

View File

@ -9,7 +9,7 @@ const app = useAppStore()
<template>
<button
class="xl:hidden toc-btn shadow fixed press-icon-btn z-350"
class="toc-btn shadow fixed press-icon-btn z-350 xl:hidden!"
opacity="75" right="2" bottom="19"
@click="app.toggleRightSidebar()"
>

View File

@ -48,7 +48,7 @@ const { hasSidebar } = useSidebar()
bottom: 0;
left: 0;
padding: 1.5rem 1rem;
padding-top: var(--pr-nav-height);
top: var(--pr-nav-height);
z-index: var(--pr-z-index-sidebar);
width: calc(100vw - 64px);
max-width: 320px;
@ -71,7 +71,6 @@ const { hasSidebar } = useSidebar()
.press-sidebar {
z-index: 1;
padding: 1.5rem 1rem;
padding-top: var(--pr-nav-height);
width: var(--va-sidebar-width);
max-width: 100%;
background-color: var(--va-c-bg-alt);
@ -80,4 +79,10 @@ const { hasSidebar } = useSidebar()
transform: translateX(0);
}
}
@include mobile {
.press-sidebar {
top: 0;
}
}
</style>

View File

@ -26,21 +26,19 @@ const isHome = useLayout('home')
}" p="t-6"
>
<slot name="main">
<div class="content" :class="{ 'm-auto': !hasSidebar }" m="y-0" flex="~ col grow" w="full" p="x-12 lt-md:0">
<div class="content" :class="{ 'm-auto': !hasSidebar }" flex="~ col grow" w="full" p="lt-md:0">
<slot name="main-header" />
<slot name="main-header-after" />
<slot name="main-content">
<div class="markdown-body prose max-w-none pb-8">
<ValaxyMd :frontmatter="frontmatter">
<h1 v-if="hasSidebar && !isHome && frontmatter.title" :id="frontmatter.title" tabindex="-1">
{{ frontmatter.title }}
<a class="header-anchor" :href="`#${frontmatter.title}`" aria-hidden="true">#</a>
</h1>
<slot name="main-content-md" />
<slot />
</ValaxyMd>
</div>
<ValaxyMd class="prose pb-8 m-auto w-full max-w-4xl" :frontmatter="frontmatter">
<h1 v-if="hasSidebar && !isHome && frontmatter.title" :id="frontmatter.title" tabindex="-1">
{{ frontmatter.title }}
<a class="header-anchor" :href="`#${frontmatter.title}`" aria-hidden="true">#</a>
</h1>
<slot name="main-content-md" />
<slot />
</ValaxyMd>
<slot name="main-content-after" />
</slot>
</div>

View File

@ -83,13 +83,6 @@ const themeConfig = useThemeConfig()
max-width: calc(var(--pr-layout-max-width) - 64px);
}
.content {
display: flex;
justify-content: flex-end;
align-items: center;
flex-grow: 1;
}
.menu + .translations::before,
.menu + .appearance::before,
.menu + .social-links::before,

View File

@ -2,7 +2,6 @@
import { useI18n } from 'vue-i18n'
import { useFrontmatter } from 'valaxy'
import { useAppStore } from 'valaxy/client/stores/app'
import { provide, ref } from 'vue'
const frontmatter = useFrontmatter()
const { t } = useI18n()

View File

@ -4,11 +4,10 @@ import { setupLayouts } from 'virtual:generated-layouts'
import App from './App.vue'
import '@unocss/reset/tailwind.css'
import 'uno.css'
// generate user styles
import '/@valaxyjs/styles'
import 'uno.css'
import setupMain from './setup/main'
const routes = setupLayouts(__DEV__ ? generatedRoutes : generatedRoutes.filter(i => !i.meta?.frontmatter.draft))

View File

@ -30,6 +30,7 @@
div[class*="language-"] {
position: relative;
background-color: var(--va-code-block-bg);
overflow-x: auto;
code {
padding: 0 24px;
@ -38,6 +39,19 @@
color: var(--va-code-block-color);
transition: color 0.5s;
width: fit-content;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
pre {

View File

@ -71,6 +71,7 @@ export const defaultSiteConfig: SiteConfig = {
format: '',
},
lastUpdated: true,
ignoreDeadLinks: true,
license: {
enabled: true,

View File

@ -216,7 +216,7 @@ export function createValaxyPlugin(options: ResolvedValaxyOptions, serverOptions
},
renderStart() {
if (hasDeadLinks)
if (hasDeadLinks && !siteConfig.ignoreDeadLinks)
throw new Error('One or more pages contain dead links.')
},

View File

@ -103,6 +103,13 @@ export interface SiteConfig<T = DefaultThemeConfig> {
*/
lastUpdated: boolean
/**
* Don't fail builds due to dead links.
*
* @default true
*/
ignoreDeadLinks?: boolean
/**
* icon for your website
*/