Refactor: Marquee

使用 CSS 还原 Marquee 效果
This commit is contained in:
奇趣保罗 2022-05-06 02:13:32 +08:00
parent 7823572503
commit 3bb999aed5
2 changed files with 28 additions and 7 deletions

View File

@ -31,13 +31,28 @@ button{
cursor: pointer; cursor: pointer;
} }
.radius-full{ border-radius: 100% } /* 仿 Marquee 效果 */
blockquote.notice{
.notice{ padding: 0;
color: #175782; overflow: hidden;
color: #227fb9;
font-style: normal; font-style: normal;
white-space: nowrap;
} }
blockquote.notice p{
padding-left: 100%;
display: inline-block;
border: 1em solid transparent;
animation: marquee 10s infinite linear;
}
@keyframes marquee{
0% { transform: translateX(0%) }
100% { transform: translateX(-100%) }
}
/* 按钮组 */
.btn-group{ .btn-group{
row-gap: .5em; row-gap: .5em;
display: flex; display: flex;
@ -48,6 +63,7 @@ button{
margin-right: .5em; margin-right: .5em;
} }
/* 问答 */
.ask, .answer{ .ask, .answer{
position: relative; position: relative;
padding-left: 1.75em; padding-left: 1.75em;
@ -98,6 +114,9 @@ button{
background-color: #e74c3c; background-color: #e74c3c;
} }
/* 辅助类 */
.radius-full{ border-radius: 100% }
/* 1 - 页眉 /* 1 - 页眉
-------------------------------- */ -------------------------------- */
.sidebar{ .sidebar{

View File

@ -24,7 +24,9 @@ function Index() {
<main> <main>
<ArticleHead title="保罗 API" desc="这里是保罗制作的简易 API 系列~" /> <ArticleHead title="保罗 API" desc="这里是保罗制作的简易 API 系列~" />
<article className="post"> <article className="post">
<blockquote className="notice"><i className="fa fa-bell"></i> API NodeJS MidwayJS </blockquote> <blockquote className="notice">
<p><i className="fa fa-bell"></i> API NodeJS MidwayJS </p>
</blockquote>
<h3></h3> <h3></h3>
<p> API/使 API <Link to="/notice"></Link> <Link to="/log"></Link></p> <p> API/使 API <Link to="/notice"></Link> <Link to="/log"></Link></p>
@ -34,9 +36,9 @@ function Index() {
<div className="row text-center" style={{ marginTop: "2em" }}> <div className="row text-center" style={{ marginTop: "2em" }}>
{ {
stat?.data && Object.keys(stat.data).map((item) => ( Object.keys(apiMap).map(item => (
<div className="col-4" key={item}> <div className="col-4" key={item}>
<h2>{stat.data[item]}</h2> <h2>{stat ?. data[item] || "?"}</h2>
<p>{apiMap[item]}</p> <p>{apiMap[item]}</p>
</div> </div>
)) ))