feat(directory): added an arrow to indicate a link

This commit is contained in:
Haoyu Xu
2023-10-14 00:20:59 -04:00
parent f53805744e
commit a35c1abfe4
4 changed files with 150 additions and 91 deletions

View File

@@ -24,8 +24,8 @@ export default function ToTopButton(props) {
const smoothScroll = useCallback( const smoothScroll = useCallback(
(target) => { (target) => {
const targetElement = document.querySelector(target); const targetElement = document.querySelector(target);
const targetPosition = targetElement.getBoundingClientRect().top + window.pageYOffset; const targetPosition = targetElement.getBoundingClientRect().top + window.scrollY;
const startPosition = window.pageYOffset; const startPosition = window.scrollY;
const distance = targetPosition - startPosition; const distance = targetPosition - startPosition;
const duration = 1000; const duration = 1000;
let start = null; let start = null;

View File

@@ -167,7 +167,7 @@ export default function Home() {
return ( return (
<section> <section>
{ {
officalUpdate.length > operators.length && ( officalUpdate.length === operators.length && (
<section> <section>
<section className={classes['offical-update']}> <section className={classes['offical-update']}>
<section className={classes.info}> <section className={classes.info}>
@@ -199,6 +199,12 @@ export default function Home() {
<section className={classes.title}> <section className={classes.title}>
{entry.codename[language]} {entry.codename[language]}
</section> </section>
<seection className={classes['arrow-icon']}>
<section className={classes.bar}></section>
<section className={classes.bar}></section>
<section className={classes.bar}></section>
<section className={classes.bar}></section>
</seection>
</section> </section>
</section> </section>
</section> </section>

View File

@@ -444,6 +444,12 @@ export default function Operator() {
<section className={classes.text}> <section className={classes.text}>
{i18n('web_version')} {i18n('web_version')}
</section> </section>
<seection className={classes['arrow-icon']}>
<section className={classes.bar}></section>
<section className={classes.bar}></section>
<section className={classes.bar}></section>
<section className={classes.bar}></section>
</seection>
</section> </section>
</section> </section>
</Link> </Link>
@@ -462,6 +468,12 @@ export default function Operator() {
<section className={classes.text}> <section className={classes.text}>
{i18n('steam_workshop')} {i18n('steam_workshop')}
</section> </section>
<seection className={classes['arrow-icon']}>
<section className={classes.bar}></section>
<section className={classes.bar}></section>
<section className={classes.bar}></section>
<section className={classes.bar}></section>
</seection>
</section> </section>
</section> </section>
</Link> </Link>

View File

@@ -153,112 +153,153 @@
} }
.styled-selection { .styled-selection {
margin-bottom: 0.8rem; margin-bottom: 0.8rem;
.content { .content {
padding: 0.8rem 0; padding: 0.8rem 0;
cursor: pointer; cursor: pointer;
transition: transform cubic-bezier(0.65, 0.05, 0.36, 1) 0.3s;
.option {
pointer-events: none;
position: relative;
transform: translate3d(0, 0, 1px);
font-size: 1rem;
padding: 0.44rem 2.25rem 0.44rem 0.63rem;
background-color: var(--home-item-hover-background-color);
background-image: repeating-linear-gradient(
90deg,
var(--home-item-background-linear-gradient-color) 0,
var(--home-item-background-linear-gradient-color) 1px,
transparent 1px,
transparent 4px
);
transition: transform cubic-bezier(0.65, 0.05, 0.36, 1) 0.3s; transition: transform cubic-bezier(0.65, 0.05, 0.36, 1) 0.3s;
.option { .outline {
pointer-events: none; width: 100%;
position: relative; height: 100%;
transform: translate3d(0, 0, 1px); left: -6px;
font-size: 1rem; top: -6px;
padding: 0.44rem 2.25rem 0.44rem 0.63rem; border: var(--home-item-outline-color) 1px dashed;
background-color: var(--home-item-hover-background-color); padding: 6px;
background-image: repeating-linear-gradient(
90deg,
var(--home-item-background-linear-gradient-color) 0,
var(--home-item-background-linear-gradient-color) 1px,
transparent 1px,
transparent 4px
);
transition: transform cubic-bezier(0.65, 0.05, 0.36, 1) 0.3s;
.outline {
width: 100%;
height: 100%;
left: -6px;
top: -6px;
border: var(--home-item-outline-color) 1px dashed;
padding: 6px;
&:before,
&:after {
content: "";
display: block;
position: absolute;
left: -2px;
height: 2px;
width: 100%;
border-left: var(--text-color) solid 2px;
border-right: var(--text-color) solid 2px;
}
&:before {
top: -2px;
}
&:after {
bottom: -2px;
}
}
&:before, &:before,
.outline { &:after {
content: ""; content: "";
display: block; display: block;
position: absolute; position: absolute;
z-index: -1; left: -2px;
opacity: 0; height: 2px;
visibility: hidden; width: 100%;
transition: opacity cubic-bezier(0.65, 0.05, 0.36, 1) 0.3s, border-left: var(--text-color) solid 2px;
visibility cubic-bezier(0.65, 0.05, 0.36, 1) 0.3s; border-right: var(--text-color) solid 2px;
} }
&:before { &:before {
right: 0; top: -2px;
top: 0;
width: 60%;
height: 100%;
background-image: linear-gradient(90deg, transparent, currentColor);
} }
.tick-icon { &:after {
display: inline-block; bottom: -2px;
}
}
&:before,
.outline {
content: "";
display: block;
position: absolute;
z-index: -1;
opacity: 0;
visibility: hidden;
transition: opacity cubic-bezier(0.65, 0.05, 0.36, 1) 0.3s,
visibility cubic-bezier(0.65, 0.05, 0.36, 1) 0.3s;
}
&:before {
right: 0;
top: 0;
width: 60%;
height: 100%;
background-image: linear-gradient(90deg, transparent, currentColor);
}
.tick-icon {
display: inline-block;
position: absolute;
z-index: 0;
right: 0.31rem;
top: 50%;
width: 0.5rem;
height: 1rem;
opacity: 0;
visibility: hidden;
transition: opacity cubic-bezier(0.65, 0.05, 0.36, 1) 0.3s,
visibility cubic-bezier(0.65, 0.05, 0.36, 1) 0.3s;
border-right: var(--text-color) solid 0.25rem;
border-bottom: var(--text-color) solid 0.25rem;
transform: translate(-50%, -70%) rotate(45deg);
}
.arrow-icon {
display: inline-block;
position: absolute;
z-index: 0;
right: -0.1em;
top: 0.45em;
width: 2em;
height: 1em;
transform: rotate(90deg);
transition: opacity cubic-bezier(0.65, 0.05, 0.36, 1) 0.3s,
visibility cubic-bezier(0.65, 0.05, 0.36, 1) 0.3s;
opacity: 0;
visibility: hidden;
.bar {
position: absolute; position: absolute;
z-index: 0; width: 100%;
right: 0.31rem; height: 0.25em;
top: 50%; background-color: var(--text-color-full);
width: 0.5rem; will-change: auto;
height: 1rem;
opacity: 0;
visibility: hidden;
transition: opacity cubic-bezier(0.65, 0.05, 0.36, 1) 0.3s,
visibility cubic-bezier(0.65, 0.05, 0.36, 1) 0.3s;
border-right: var(--text-color) solid 0.25rem;
border-bottom: var(--text-color) solid 0.25rem;
transform: translate(-50%, -70%) rotate(45deg);
} }
}
&:hover, .bar:nth-child(1) {
&.active { transform: rotateZ(45deg) scaleX(0.5) translateX(0.8em);
transform: translate3d(6px, 0, 1px);
.option:before,
.option .outline {
opacity: 1;
visibility: visible;
} }
}
&.active { .bar:nth-child(2) {
.option .tick-icon { transform: rotateZ(-45deg) scaleX(0.5) translateX(-0.8em);
opacity: 1; }
visibility: visible;
.bar:nth-child(3),
.bar:nth-child(4) {
transform: translateY(1em) rotateZ(90deg) scaleX(0.5);
} }
} }
} }
&:hover,
&.active {
transform: translate3d(6px, 0, 1px);
.option:before,
.option .outline {
opacity: 1;
visibility: visible;
}
.arrow-icon {
opacity: 1;
visibility: visible;
}
}
&.active {
.option .tick-icon {
opacity: 1;
visibility: visible;
}
}
} }
}