mirror of
https://github.com/ClovertaTheTrilobita/SanYeCao-blog.git
synced 2026-09-04 20:55:41 +00:00
refactor divider into a singal component
This commit is contained in:
parent
2a4c090c5d
commit
2ac6091ab6
4 changed files with 41 additions and 54 deletions
29
src/components/Divider.astro
Normal file
29
src/components/Divider.astro
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
<div class="divider" aria-hidden="true"></div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.divider {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 12px;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
background: repeating-linear-gradient(
|
||||||
|
-45deg,
|
||||||
|
var(--deep-red) 0 14px,
|
||||||
|
transparent 14px 28px,
|
||||||
|
var(--deep-blue) 28px 42px,
|
||||||
|
transparent 42px 56px
|
||||||
|
);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(html.dark) .divider,
|
||||||
|
:global(.dark) .divider {
|
||||||
|
background: repeating-linear-gradient(
|
||||||
|
-45deg,
|
||||||
|
#ff8a8a 0 14px,
|
||||||
|
transparent 14px 28px,
|
||||||
|
#9ecbff 28px 42px,
|
||||||
|
transparent 42px 56px
|
||||||
|
);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
---
|
---
|
||||||
import { getLangFromUrl, getTranslations, type Lang } from "@/i18n";
|
import { getLangFromUrl, getTranslations, type Lang } from "@/i18n";
|
||||||
import BuildHashBlocks from "@/components/BuildHashBlocks.astro";
|
import BuildHashBlocks from "@/components/BuildHashBlocks.astro";
|
||||||
|
import Divider from "@/components/Divider.astro";
|
||||||
const commit = import.meta.env.PUBLIC_GIT_COMMIT || "unknown";
|
const commit = import.meta.env.PUBLIC_GIT_COMMIT || "unknown";
|
||||||
const lang = getLangFromUrl(Astro.url);
|
const lang = getLangFromUrl(Astro.url);
|
||||||
const t = getTranslations(lang);
|
const t = getTranslations(lang);
|
||||||
---
|
---
|
||||||
|
|
||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
|
<Divider />
|
||||||
<a
|
<a
|
||||||
href="https://github.com/ClovertaTheTrilobita/SanYeCao-blog"
|
href="https://github.com/ClovertaTheTrilobita/SanYeCao-blog"
|
||||||
class="github"
|
class="github"
|
||||||
|
|
@ -82,22 +84,6 @@ const t = getTranslations(lang);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.footer::before {
|
|
||||||
content: "";
|
|
||||||
display: block;
|
|
||||||
width: 100%;
|
|
||||||
height: 12px;
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
background: repeating-linear-gradient(
|
|
||||||
-45deg,
|
|
||||||
var(--deep-red) 0 14px,
|
|
||||||
transparent 14px 28px,
|
|
||||||
var(--deep-blue) 28px 42px,
|
|
||||||
transparent 42px 56px
|
|
||||||
);
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer-content-mobile {
|
.footer-content-mobile {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
@ -108,16 +94,6 @@ const t = getTranslations(lang);
|
||||||
/* display: inline-flex; */
|
/* display: inline-flex; */
|
||||||
}
|
}
|
||||||
|
|
||||||
:global(.dark) .footer::before {
|
|
||||||
background: repeating-linear-gradient(
|
|
||||||
-45deg,
|
|
||||||
#ff8a8a 0 14px,
|
|
||||||
transparent 14px 28px,
|
|
||||||
#9ecbff 28px 42px,
|
|
||||||
transparent 42px 56px
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 700px) {
|
@media (max-width: 700px) {
|
||||||
.footer-content-pc {
|
.footer-content-pc {
|
||||||
display: none;
|
display: none;
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
import Navigation from "./Navigation.astro";
|
import Navigation from "./Navigation.astro";
|
||||||
import ThemeIcon from "./ThemeIcon.astro";
|
import ThemeIcon from "./ThemeIcon.astro";
|
||||||
import { getLangFromUrl, getTranslations } from "@/i18n";
|
import { getLangFromUrl, getTranslations } from "@/i18n";
|
||||||
|
import Divider from "@/components/Divider.astro";
|
||||||
|
|
||||||
const lang = getLangFromUrl(Astro.url);
|
const lang = getLangFromUrl(Astro.url);
|
||||||
const t = getTranslations(lang);
|
const t = getTranslations(lang);
|
||||||
|
|
@ -25,6 +26,9 @@ const t = getTranslations(lang);
|
||||||
</div>
|
</div>
|
||||||
<Navigation />
|
<Navigation />
|
||||||
</nav>
|
</nav>
|
||||||
|
<div class="divider">
|
||||||
|
<Divider />
|
||||||
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
@ -81,6 +85,11 @@ const t = getTranslations(lang);
|
||||||
font-size: clamp(1.6rem, 6vw, 2.5rem);
|
font-size: clamp(1.6rem, 6vw, 2.5rem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.divider {
|
||||||
|
margin-top: 0.2rem;
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.site-header {
|
.site-header {
|
||||||
padding-top: 0.25rem;
|
padding-top: 0.25rem;
|
||||||
|
|
|
||||||
|
|
@ -43,37 +43,10 @@ const t = getTranslations(lang);
|
||||||
<style>
|
<style>
|
||||||
.site-nav {
|
.site-nav {
|
||||||
margin: 1rem 0;
|
margin: 1rem 0;
|
||||||
padding-bottom: 3rem;
|
padding-bottom: 1rem;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.site-nav::after {
|
|
||||||
content: "";
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
height: 12px;
|
|
||||||
background: repeating-linear-gradient(
|
|
||||||
-45deg,
|
|
||||||
var(--deep-red) 0 14px,
|
|
||||||
transparent 14px 28px,
|
|
||||||
var(--deep-blue) 28px 42px,
|
|
||||||
transparent 42px 56px
|
|
||||||
);
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
:global(.dark) .site-nav::after {
|
|
||||||
background: repeating-linear-gradient(
|
|
||||||
-45deg,
|
|
||||||
#ff8a8a 0 14px,
|
|
||||||
transparent 14px 28px,
|
|
||||||
#9ecbff 28px 42px,
|
|
||||||
transparent 42px 56px
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
.site-nav-desktop {
|
.site-nav-desktop {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 1.5rem;
|
gap: 1.5rem;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue