Use collapsibles for other downloads
Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>
This commit is contained in:
8 files changed
+150
-73
No files matched your search
@@ -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,6 +3,7 @@ import Heading from '@theme/Heading';
|
||||
import styles from './styles.module.css';
|
||||
import Crossplatform0Img from '@site/static/img/site/crossplatform_0.png';
|
||||
import Crossplatform1Img from '@site/static/img/site/crossplatform_1.png';
|
||||
import Crossplatform2Img from '@site/static/img/site/crossplatform_2.png';
|
||||
|
||||
type FeatureItem = {
|
||||
title: string;
|
||||
@@ -14,7 +15,7 @@ type FeatureItem = {
|
||||
const FeatureList: FeatureItem[] = [
|
||||
{
|
||||
title: 'What is Geyser?',
|
||||
image: Crossplatform0Img,
|
||||
image: Crossplatform2Img,
|
||||
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.
|
||||
@@ -32,6 +33,7 @@ const FeatureList: FeatureItem[] = [
|
||||
},
|
||||
{
|
||||
title: 'Join from anywhere',
|
||||
image: Crossplatform0Img,
|
||||
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!
|
||||
|
||||
@@ -74,7 +74,7 @@ export const ProjectDownload: React.FC<ProjectDownloadProps> = ({ projectId, des
|
||||
<p>{description}</p>
|
||||
<Columns>
|
||||
<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">
|
||||
{ setup &&
|
||||
<a href={setup} className='no-underline'>
|
||||
@@ -99,7 +99,7 @@ export const ProjectDownload: React.FC<ProjectDownloadProps> = ({ projectId, des
|
||||
</Grid>
|
||||
</Column>
|
||||
<Column>
|
||||
<h2>Recent Changes:</h2>
|
||||
<h3>Recent Changes:</h3>
|
||||
<ul>
|
||||
{
|
||||
changes.map((change, i) => {
|
||||
|
||||
@@ -22,16 +22,16 @@ export const Q = ({ children }) => {
|
||||
const questionText = children[0];
|
||||
const answerComponent = React.Children.toArray(children)[1];
|
||||
|
||||
const arrowClass = isAnswerVisible ? 'question-arrow expanded' : 'question-arrow';
|
||||
const arrowClass = isAnswerVisible ? 'collapsible-arrow expanded' : 'collapsible-arrow';
|
||||
|
||||
return (
|
||||
<div className="question" onClick={() => setIsAnswerVisible(!isAnswerVisible)}>
|
||||
<div className="question-header">
|
||||
<div className="collapsible" onClick={() => setIsAnswerVisible(!isAnswerVisible)}>
|
||||
<div className="collapsible-header">
|
||||
<span className="question-text">{questionText}</span>
|
||||
<span className={arrowClass}></span>
|
||||
</div>
|
||||
<div className="question-line"></div>
|
||||
<div className="answer" ref={answerRef} style={{ height: `${answerHeight}px` }}>
|
||||
<div className="collapsible-line"></div>
|
||||
<div className="inner" ref={answerRef} style={{ height: `${answerHeight}px` }}>
|
||||
{answerComponent}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user