Skip to content

Commit

Permalink
feat(theme): add archive for theme
Browse files Browse the repository at this point in the history
  • Loading branch information
xcyeye committed Nov 19, 2021
1 parent 46f7097 commit 34c00e3
Show file tree
Hide file tree
Showing 20 changed files with 91 additions and 45 deletions.
@@ -0,0 +1,7 @@
import { defineClientAppEnhance } from '@vuepress/client';
import AuroraArchive from "./components/AuroraArchive";
import './style/aurora-archive.css'

export default defineClientAppEnhance(({ app, router }) => {
app.component("AuroraArchive",AuroraArchive)
});
Expand Up @@ -4,24 +4,24 @@
<div class="timeline-year">
<span class="timeline-year-title">{{item}}</span>
</div>
<timeline-item v-for="month in getAllMonthArr(item)" :month="month" :page-year="item" :all-page-data-arr="allPageDataArr"></timeline-item>
<archive-item v-for="month in getAllMonthArr(item)" :month="month" :page-year="item" :all-page-data-arr="allPageDataArr"></archive-item>
</div>
</div>
</template>

<script>
const pageData = require('@temp/page-data')
import TimelineItem from "./TimelineItem";
import ArchiveItem from "./ArchiveItem";
let excludes = []
try {
excludes = __EXCLUDES__;
}catch (e) {
console.warn(e)
}
export default {
name: "Timeline",
name: "AuroraArchive",
components: {
TimelineItem
ArchiveItem
},
data() {
return {
Expand Down
Expand Up @@ -3,11 +3,12 @@
/*--archive-timeline: rgba(144, 241, 239, 0.35);*/
/*--archive-timeline-active: pink;*/
/*--archive-timeline-active-title: pink;*/
/*--archive-box-width: 80%;*/
}
.timeline-box {
width: 80%;
height: max-content;
margin: 0 auto;
width: var(--archive-box-width,80%);
}

.timeline-single {
Expand Down Expand Up @@ -50,6 +51,10 @@
margin-top: 3px;
}

.timeline-create-link-single {
margin-left: 1.15rem;
}

.timeline-create-link-single li:hover .timeline-line-icon {
-webkit-animation: timeline-active 300ms;
animation: timeline-active 300ms;
Expand Down Expand Up @@ -94,12 +99,11 @@
.timeline-create-time {
height: 1.5rem;
width: 10rem;
display: flex;
}

.timeline-create-time span {
line-height: 1.5rem;
padding-left: 1rem;
/*padding-left: 1rem;*/
}

.timeline-create-link-single ul {
Expand All @@ -109,9 +113,6 @@
.timeline-create-link-single ul li {
list-style: none;
margin-bottom: 1.5rem;
/*padding-left: 10px;*/


display: flex;
}

Expand Down Expand Up @@ -158,12 +159,10 @@

@-webkit-keyframes archiveHover {
from {
/*color: whitesmoke;*/
padding-left: 0px;
}
to {
padding-left: 10px;
/*color: red;*/
}
}

Expand All @@ -180,15 +179,15 @@
height: 3rem;
position: relative;
width: 6rem;
text-align: center;
padding-left: 1.15rem;
}

.timeline-year-title:before {
display: inline-block;
height: 7px;
margin: 0 auto;
position: absolute;
bottom: 20%;
bottom: 10%;
content: "";
border-radius: 10px;
-webkit-animation: timelineYearLevel 900ms;
Expand All @@ -211,7 +210,7 @@
@keyframes timelineYearLevel {
from {
background: rgba(0,207,200,.9);
width: 40%;
width: 50%;
}
to {
background: rgba(0,207,200,.4);
Expand All @@ -225,15 +224,15 @@
width: 15%;
}
to {
width: 40%;
width: 50%;
background: rgba(0,207,200,.9);
}
}

.timeline-year span {
line-height: 2rem;
font-weight: bold;
font-size: 18px;
font-size: 32px;
}

.timeline-item {
Expand Down
3 changes: 3 additions & 0 deletions Aurora-plugin/vuepress-plugin-archive/lib/node/index.d.ts
@@ -0,0 +1,3 @@
import { ArchivePluginOptions } from './vuepress-plugin-archive';
export * from './vuepress-plugin-archive';
export default ArchivePluginOptions;
Expand Up @@ -10,6 +10,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
const timelinePlugin_1 = require("./vuepress-plugin-timeline");
__exportStar(require("./vuepress-plugin-timeline"), exports);
exports.default = timelinePlugin_1.timelinePlugin;
const archivePlugin_1 = require("./vuepress-plugin-archive");
__exportStar(require("./vuepress-plugin-archive"), exports);
exports.default = archivePlugin_1.archivePlugin;
@@ -0,0 +1,3 @@
import type { Plugin } from '@vuepress/core';
export declare type ArchivePluginOptions = Record<never, never>;
export declare const ArchivePluginOptions: Plugin<ArchivePluginOptions>;
Expand Up @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.cozePlugin = void 0;
const { createPage } = require('@vuepress/core');
const utils_1 = require("@vuepress/utils");
const vuepressPluginTimeline = ({ excludes,noTitle }) => {
const vuepressPluginArchive = ({ excludes,noTitle }) => {
return {
define: {
__EXCLUDES__: excludes,
Expand All @@ -12,13 +12,13 @@ const vuepressPluginTimeline = ({ excludes,noTitle }) => {
onInitialized: async (app) => {
// 如果主页不存在
const timeline = await createPage(app, {
path: '/aurora-timeline',
path: '/aurora-archive',
// 设置 frontmatter
frontmatter: {
layout: 'Timeline',
slug: 'aurora-timeline',
layout: 'AuroraArchive',
slug: 'aurora-plugin-archive',
},
permalink: '/aurora-timeline',
permalink: '/aurora-archive',
// 设置 markdown 内容
content: "",
})
Expand All @@ -35,9 +35,9 @@ const vuepressPluginTimeline = ({ excludes,noTitle }) => {
`export default ${JSON.stringify(pageData)}`
);
},
name: 'vuepress-plugin-timeline',
name: 'vuepress-plugin-archive',
multiple: false,
clientAppEnhanceFiles: utils_1.path.resolve(__dirname, '../client/clientAppEnhance.js')
};
};
exports.timelinePlugin = vuepressPluginTimeline;
exports.archivePlugin = vuepressPluginArchive;

This file was deleted.

3 changes: 0 additions & 3 deletions Aurora-plugin/vuepress-plugin-timeline/lib/node/index.d.ts

This file was deleted.

This file was deleted.

2 changes: 2 additions & 0 deletions Aurora-theme/lib/client/clientAppEnhance.js
Expand Up @@ -23,6 +23,7 @@ import Poster from "./components/global/Poster";
import HomeSidebar from "./components/child/side/HomeSidebar";
import HomeBottom from "./components/HomeBottom";
import AuroraGlobal from "./components/global/AuroraGlobal";
import Archive from './components/Archive'

import './styles/index.scss';
import './styles/photo.scss'
Expand All @@ -47,6 +48,7 @@ export default defineClientAppEnhance(({ app, router }) => {
app.component("Mood",Mood)
app.component("Tag",Tag)
app.component("AuroraGlobal",AuroraGlobal)
app.component("Archive",Archive)

//路由
// @ts-ignore
Expand Down
27 changes: 27 additions & 0 deletions Aurora-theme/lib/client/components/Archive.vue
@@ -0,0 +1,27 @@
<template>
<common :is-sticky-sidebar="true" :is-show-side-bar="false"
:show-sidebar-link="false"
:is-show-top-img="true" :is-show-head-line="false">
<template #center1>
<div class="link">
<div :style="$store.state.borderRadiusStyle + $store.state.opacityStyle"
class="box link-common" id="c-link">
<div class="aurora-theme-archive">
<AuroraArchive/>
</div>
</div>
</div>

</template>
</common>
</template>

<script>
export default {
name: "Archive"
}
</script>

<style scoped>
</style>
4 changes: 4 additions & 0 deletions Aurora-theme/lib/client/styles/theme.style.css

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

3 changes: 3 additions & 0 deletions Aurora-theme/lib/client/styles/vars.scss
Expand Up @@ -16,6 +16,9 @@
--hoverColor: #8186d5;
--auroraActiveColor: #8186d5;

//vuepress-theme-archive插件变量
--archive-box-width: 90%;


//iconfont变量

Expand Down
12 changes: 12 additions & 0 deletions Aurora-theme/lib/node/auroraTheme.js
Expand Up @@ -73,6 +73,17 @@ const auroraTheme = ({ themePlugins = {}, ...localeOptions }) => {
content: "",
})

const ArchivePage = await createPage(app, {
path: '/archive',
// 设置 frontmatter
frontmatter: {
layout: 'Archive',
slug: 'aurora-archive',
},
// 设置 markdown 内容
content: "",
})

if (app.pages.every((page) => page.path !== '/')) {
const homepage = await createPage(app, {
path: '/',
Expand All @@ -92,6 +103,7 @@ const auroraTheme = ({ themePlugins = {}, ...localeOptions }) => {
app.pages.push(moodPage)
app.pages.push(linkPage)
app.pages.push(tagPhoto)
app.pages.push(ArchivePage)
},
onGenerated: (app) => {
setTimeout(() => {
Expand Down
8 changes: 4 additions & 4 deletions docs/.vuepress/config.js
Expand Up @@ -27,7 +27,7 @@ module.exports = {
onlyAdministrator: false //是否运行其他注册的用户发布说说,true表示只有管理员可以发布
}
],*/
[
/*[
path.resolve(__dirname, "../../Aurora-plugin/vuepress-plugin-coze/lib/node/index.js"),
{
appId: '2A2Dyd2AffrnldhwftlEddVn-MdYXbMMI',
Expand All @@ -38,9 +38,9 @@ module.exports = {
registerPath: '/aurora-register', //自定义插件默认提供的注册页面路由,请在前面加上/
onlyAdministrator: false //是否运行其他注册的用户发布说说,true表示只有管理员可以发布
}
],
],*/
[
path.resolve(__dirname, "../../Aurora-plugin/vuepress-plugin-timeline/lib/node/index.js"),
path.resolve(__dirname, "../../Aurora-plugin/vuepress-plugin-archive/lib/node/index.js"),
{
excludes: ['/footer.html','/404.html','/about/','/mood/','/link/','/tag/','/photo/'],
noTitle: '暂时没有标题配置'
Expand Down Expand Up @@ -183,7 +183,7 @@ module.exports = {
},
{
text: "time",
link: '/aurora-timeline',
link: '/archive',
iconClass: 'aurora-icon-time'
}
],
Expand Down

0 comments on commit 34c00e3

Please sign in to comment.