Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: animation & dark mode #273

Merged
merged 3 commits into from
Apr 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions layout/_partial/head.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -29,31 +29,30 @@ if (is_archive()){

<%- css_auto_version('lib/iconfont/iconfont.css') %>
<% if (theme.iconlib) { %>
<link rel="stylesheet" href="<%= theme.iconlib %>">
<link rel="stylesheet" href="<%= theme.iconlib %>">
<% } %>
<%- css_auto_version('css/style') %>

<% if (theme.preset) { %>
<%- css_auto_version('preset/'theme.preset) %>
<%- css_auto_version(`preset/${theme.preset}`) %>
<% } %>

<% if (theme.customStyles) { %>
<% theme.customStyles.forEach(function(custom){ %>
<%- css_auto_version('custom.css') %>
<% }) %>
<% theme.customStyles.forEach(function(custom){ %>
<%- css_auto_version('custom.css') %>
<% }) %>
<% } %>

<%- js([
{ src:'lib/mdui_043tiny/mdui.js' , async: true},
{ src:'lib/fancybox/fancybox.umd.js' , async: true}
{ src:'lib/fancybox/fancybox.umd.js' , async: true},
{ src:'lib/lax.min.js' , async: true}
]) %>

<%- js_auto_version('js/app') %>

<% if (theme.copyText) { %>
<script>
var copyTip = "<%- theme.copyText %>"
</script>
<% } %>
<script>var copyTip = "<%- theme.copyText %>"</script>
<% } %>

<%- theme.slotHead %>
<%- theme.slotHead %>
2 changes: 1 addition & 1 deletion layout/_partial/right.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
<%} %>

<a href="#nexmoe-content" class="toc-link" aria-label="Back To Top" title="top"><button class="mdui-fab mdui-ripple"><i class="nexmoefont icon-caret-top"></i></button></a>
<a href="#nexmoe-content" class="backtop toc-link" aria-label="Back To Top" title="top"><button class="mdui-fab mdui-ripple"><i class="nexmoefont icon-caret-top"></i></button></a>
</div>
</div>
2 changes: 1 addition & 1 deletion layout/layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = class extends Component {
></head>
<body class={layout + " " + bodyClass}>
<Background {...this.props} />
<Body {...this.props} />
<Body {...this.props} />

<div
dangerouslySetInnerHTML={{
Expand Down
2 changes: 1 addition & 1 deletion source/css/_layout/nexmoe/content.styl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

.nexmoe-primary {
box-shadow: 0 0 1rem var(--color-shadow);
background-color: #fff;
background-color: var(--color-card);
float: left;
width: 100%;
padding: $gutter;
Expand Down
2 changes: 1 addition & 1 deletion source/css/_layout/nexmoe/header.styl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
color: #a3a8ae;

span {
color: #363636;
color: var(--color-text-2);
display: block;
}
}
Expand Down
2 changes: 1 addition & 1 deletion source/css/_layout/xiaoshu/content.styl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
width: 100%;
padding: var(--gutter);
margin: 0;
background: #fff;
background: var(--color-card);
box-shadow: 0 0 1rem var(--color-shadow)
}
31 changes: 31 additions & 0 deletions source/css/_layout/xiaoshu/header.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#nexmoe-header {
height: 4em;
background-color: transparent;
line-height: 4em;
margin-bottom: 10rem;
}

#nexmoe-header .nexmoe-container {
display: flex;
flex-direction: row;
}

#nexmoe-header .logo {
font-weight: 700;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 10em;
}

#nexmoe-header .nav {
display: flex;
flex-direction: row;
list-style: none;
margin: 0;
margin-left: auto;
}

#nexmoe-header .nav .nav-item {
margin-left: 1.5em;
}
4 changes: 2 additions & 2 deletions source/css/_partial/article.styl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
article {
color: #444;
color: var(--color-text-2);
font-family: microsoft yahei;
}

Expand Down Expand Up @@ -183,7 +183,7 @@ article img {
}

article h1, article h2, article h3, article h4, article h5, article h6 {
color: #111;
color: var(--color-text-1);
margin: $gutter 0;
}

Expand Down
2 changes: 1 addition & 1 deletion source/css/_widget/index.styl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.nexmoe-widget-wrap {
box-shadow: 0 0 1rem var(--color-shadow);
background-color: #fff;
background-color: var(--color-card);
margin: 20px;
border-radius: var(--radius);
overflow: hidden;
Expand Down
26 changes: 24 additions & 2 deletions source/css/style.styl
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,35 @@ $gutter = 24px;
--color6-bg: rgba(26, 152, 255, 0.15);
--color7-bg: rgba(144, 144, 255, 0.15);
--color-shadow: rgba(161, 177, 204, 0.4);
--color-card: #fff;
--color-text-1: #111;
--color-text-2: #444;
--color-text-3: #363636;
}

@media (prefers-color-scheme: dark) {
:root {
--color-card: #2b2b2b;
--color-text-1: #fff;
--color-text-2: #ccc;
}
}

@import '_partial/*';
@import '_index/*';
@import '_widget/*';

body {
background: var(--color-card);
font-size: 17px;
}

.xiaoshu {
@import '_layout/xiaoshu/*';
@import '_layout/xiaoshu/*';
}

.nexmoe {
@import '_layout/nexmoe/*';
@import '_layout/nexmoe/*';
}

*, *:after, *::before {
Expand Down Expand Up @@ -115,6 +133,10 @@ body.mdui-drawer-body-left {
font-size: 20px;
}
}

.backtop {
opacity: 0;
}
}

.nexmoe-post-right .nexmoe-tool .mdui-fab {
Expand Down
28 changes: 28 additions & 0 deletions source/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,31 @@ document
.forEach(function (item) {
item.style.minHeight = item.childNodes[3].clientHeight + "px";
});

window.onload = function () {
lax.init();

// Add a driver that we use to control our animations
lax.addDriver("scrollY", function () {
return window.scrollY;
});

// Add animation bindings to elements
lax.addElements(".backtop", {
scrollY: {
opacity: [
["screenHeight", "screenHeight+300", "screenHeight+600"],
[0, 0, 1],
],
},
});

lax.addElements(".nexmoe-post-cover", {
scrollY: {
opacity: [
["elInY", "elInY+200"],
[0, 1],
],
},
});
};
1 change: 1 addition & 0 deletions source/lib/lax.min.js

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