Use collapsibles for other downloads

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>
This commit is contained in:
Joshua Castle committed 2024-03-02 18:25:01 -08:00
1 parent 20e7bb721e
commit 8eee82779a
7 files changed
+148 -71

No files matched your search

+49
View File
@@ -0,0 +1,49 @@
import React, { useEffect, useRef, useState } from 'react';
export const Collapsibles = ({ children }) => {
return (
<div className="collapsible">
{children}
</div>
);
};
interface CollapsibleProps {
title: string;
subtitle?: string;
inner: React.ReactNode;
}
export const Collapsible: React.FC<CollapsibleProps> = ({ title, subtitle, inner }) => {
const [isInnerVisible, setIsInnerVisible] = useState(false);
const innerRef = useRef(null);
const [innerHeight, setInnerHeight] = useState(0);
useEffect(() => {
if (innerRef.current) {
setInnerHeight(isInnerVisible ? innerRef.current.scrollHeight : 0);
}
}, [isInnerVisible]);
const toggleVisibility = () => {
setIsInnerVisible(!isInnerVisible);
};
return (
<div className="collapsible">
<div className="collapsible-header" onClick={toggleVisibility}>
<p>
<span className="collapsible-title">{title}</span>
{subtitle && <span className="collapsible-subtitle"><br/>{subtitle}</span>}
</p>
<span className={isInnerVisible ? 'collapsible-arrow expanded' : 'collapsible-arrow'}></span>
</div>
<div className="collapsible-line"></div>
<div className="inner" ref={innerRef} style={{ height: `${innerHeight}px` }}>
<div className="inner-content">
{inner}
</div>
</div>
</div>
);
};
+3 -1
View File
@@ -3,6 +3,7 @@ import Heading from '@theme/Heading';
import styles from './styles.module.css'; import styles from './styles.module.css';
import Crossplatform0Img from '@site/static/img/site/crossplatform_0.png'; import Crossplatform0Img from '@site/static/img/site/crossplatform_0.png';
import Crossplatform1Img from '@site/static/img/site/crossplatform_1.png'; import Crossplatform1Img from '@site/static/img/site/crossplatform_1.png';
import Crossplatform2Img from '@site/static/img/site/crossplatform_2.png';
type FeatureItem = { type FeatureItem = {
title: string; title: string;
@@ -14,7 +15,7 @@ type FeatureItem = {
const FeatureList: FeatureItem[] = [ const FeatureList: FeatureItem[] = [
{ {
title: 'What is Geyser?', title: 'What is Geyser?',
image: Crossplatform0Img, image: Crossplatform2Img,
description: ( description: (
<> <>
Geyser is a program that allows Minecraft: Bedrock Edition clients to join Minecraft: Java Edition servers, allowing for true crossplay between both editions of the game. The ultimate goal of this project is to allow Minecraft: Bedrock Edition users to join Minecraft: Java Edition servers as seamlessly as possible. Geyser is a program that allows Minecraft: Bedrock Edition clients to join Minecraft: Java Edition servers, allowing for true crossplay between both editions of the game. The ultimate goal of this project is to allow Minecraft: Bedrock Edition users to join Minecraft: Java Edition servers as seamlessly as possible.
@@ -32,6 +33,7 @@ const FeatureList: FeatureItem[] = [
}, },
{ {
title: 'Join from anywhere', title: 'Join from anywhere',
image: Crossplatform0Img,
description: ( description: (
<> <>
Geyser can be joined from Bedrock clients on Windows 10/11, iOS, Android, and even consoles (more info here). Geyser works with a wide array of hosting providers, but can also be used as its own standalone proxy to join any Minecraft server! Geyser can be joined from Bedrock clients on Windows 10/11, iOS, Android, and even consoles (more info here). Geyser works with a wide array of hosting providers, but can also be used as its own standalone proxy to join any Minecraft server!
+2 -2
View File
@@ -74,7 +74,7 @@ export const ProjectDownload: React.FC<ProjectDownloadProps> = ({ projectId, des
<p>{description}</p> <p>{description}</p>
<Columns> <Columns>
<Column> <Column>
<h2>Build #{latestBuild.build} · {new Date(latestBuild.time).toLocaleDateString()}:</h2> <h3>Build #{latestBuild.build} · {new Date(latestBuild.time).toLocaleDateString()}:</h3>
<Grid elementsPerRow={gridColumns || 2} gap="8px"> <Grid elementsPerRow={gridColumns || 2} gap="8px">
{ setup && { setup &&
<a href={setup} className='no-underline'> <a href={setup} className='no-underline'>
@@ -99,7 +99,7 @@ export const ProjectDownload: React.FC<ProjectDownloadProps> = ({ projectId, des
</Grid> </Grid>
</Column> </Column>
<Column> <Column>
<h2>Recent Changes:</h2> <h3>Recent Changes:</h3>
<ul> <ul>
{ {
changes.map((change, i) => { changes.map((change, i) => {
+5 -5
View File
@@ -22,16 +22,16 @@ export const Q = ({ children }) => {
const questionText = children[0]; const questionText = children[0];
const answerComponent = React.Children.toArray(children)[1]; const answerComponent = React.Children.toArray(children)[1];
const arrowClass = isAnswerVisible ? 'question-arrow expanded' : 'question-arrow'; const arrowClass = isAnswerVisible ? 'collapsible-arrow expanded' : 'collapsible-arrow';
return ( return (
<div className="question" onClick={() => setIsAnswerVisible(!isAnswerVisible)}> <div className="collapsible" onClick={() => setIsAnswerVisible(!isAnswerVisible)}>
<div className="question-header"> <div className="collapsible-header">
<span className="question-text">{questionText}</span> <span className="question-text">{questionText}</span>
<span className={arrowClass}></span> <span className={arrowClass}></span>
</div> </div>
<div className="question-line"></div> <div className="collapsible-line"></div>
<div className="answer" ref={answerRef} style={{ height: `${answerHeight}px` }}> <div className="inner" ref={answerRef} style={{ height: `${answerHeight}px` }}>
{answerComponent} {answerComponent}
</div> </div>
</div> </div>
+58 -39
View File
@@ -78,9 +78,54 @@
background-color: var(--ifm-navbar-link-hover-color); background-color: var(--ifm-navbar-link-hover-color);
} }
.answer { .collapsible-header {
overflow: hidden; display: flex;
transition: height 0.3s ease-out; justify-content: space-between;
align-items: center;
width: 100%;
position: relative;
}
.collapsible-header h3 {
margin: 0;
}
.collapsible-header p {
margin-right: 18px;
}
.collapsible-arrow {
display: inline-block;
width: 10px;
height: 10px;
border-right: 2px solid var(--ifm-color-primary);
border-bottom: 2px solid var(--ifm-color-primary);
transform: rotate(45deg);
transition: transform 0.3s ease;
position: absolute;
right: 0;
top: 50%;
margin-top: -20px;
}
.collapsible-arrow.expanded {
transform: rotate(225deg);
}
.collapsible-line {
border-bottom: 1px solid var(--ifm-horizontal-line-color);
margin-top: -15px;
margin-bottom: 10px;
}
.collapsible-subtitle {
font-size: 14px;
}
.collapsible-title {
font-size: 20px;
margin-right: 20px;
} }
.columns { .columns {
@@ -142,51 +187,25 @@
} }
} }
.question-header { .inner {
display: flex; overflow: hidden;
justify-content: space-between; transition: height 0.3s ease-out;
align-items: center;
width: 100%;
position: relative; /* Needed for absolute positioning of the arrow */
} }
.question-header h3 { .inner-content {
margin: 0; margin-bottom: 20px;
}
.question-arrow {
display: inline-block;
width: 10px;
height: 10px;
border-right: 2px solid var(--ifm-color-primary);
border-bottom: 2px solid var(--ifm-color-primary);
transform: rotate(45deg);
transition: transform 0.3s ease;
position: absolute;
right: 0;
top: 50%;
margin-top: -20px; margin-top: -20px;
} }
.question-arrow.expanded {
transform: rotate(225deg);
}
.question-line {
border-bottom: 1px solid var(--ifm-horizontal-line-color);
margin-top: -15px;
margin-bottom: 10px;
}
.question-text {
font-size: 18px;
}
.no-underline { .no-underline {
text-decoration: transparent !important; text-decoration: transparent !important;
} }
.question-text p {
font-size: 18px;
margin-right: 18px;
}
.setup-button { .setup-button {
width: 100%; width: 100%;
outline: 3px solid var(--ifm-color-secondary); outline: 3px solid var(--ifm-color-secondary);
+31 -24
View File
@@ -32,6 +32,7 @@ import StandaloneIcon from '@site/static/img/icons/geyser.png';
import { Columns, Column } from '@site/src/components/Columns'; import { Columns, Column } from '@site/src/components/Columns';
import { ProviderSelector } from '@site/src/components/Provider'; import { ProviderSelector } from '@site/src/components/Provider';
import { ProjectDownload } from '@site/src/components/ProjectDownload'; import { ProjectDownload } from '@site/src/components/ProjectDownload';
import { Collapsibles, Collapsible } from '@site/src/components/Collapsibles';
<HeroBanner <HeroBanner
title="Download" title="Download"
@@ -69,29 +70,35 @@ import { ProjectDownload } from '@site/src/components/ProjectDownload';
/> />
</TabItem> </TabItem>
<TabItem value="other-projects" label="Other Projects"> <TabItem value="other-projects" label="Other Projects">
<Tabs> <Collapsibles>
<TabItem value='geyserconnect' label='GeyserConnect'> <Collapsible
<ProjectDownload title='GeyserConnect'
projectId="geyserconnect" subtitle='A plugin to allow for Geyser players to connect to your server without needing to use a proxy.'
description="An easy way for Bedrock Edition clients to connect to any Java Edition servers without having to run anything." inner={
setup='/other/geyserconnect' <ProjectDownload
downloadsInfo={{ projectId="geyserconnect"
geyserconnect: <><FontAwesomeIcon icon={faTowerCell}/> GeyserConnect</>, setup='/other/geyserconnect'
}} downloadsInfo={{
gridColumns={1} geyserconnect: <><FontAwesomeIcon icon={faTowerCell}/> GeyserConnect</>,
/> }}
</TabItem> gridColumns={1}
<TabItem value='geyseroptionalpack' label='GeyserOptionalPack'> />
<ProjectDownload }
projectId="geyseroptionalpack" />
description="Optional Bedrock resource pack to extend Geyser functionality." <Collapsible
setup='/other/geyseroptionalpack' title='GeyserOptionalPack'
downloadsInfo={{ subtitle='An optional Bedrock resource pack to extend Geyser functionality.'
geyseroptionalpack: <><FontAwesomeIcon icon={faFileZipper}/> GeyserOptionalPack</>, inner={
}} <ProjectDownload
gridColumns={1} projectId="geyseroptionalpack"
/> setup='/other/geyseroptionalpack'
</TabItem> downloadsInfo={{
</Tabs> geyseroptionalpack: <><FontAwesomeIcon icon={faFileZipper}/> GeyserOptionalPack</>,
}}
gridColumns={1}
/>
}
/>
</Collapsibles>
</TabItem> </TabItem>
</Tabs> </Tabs>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB