mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2026-02-06 02:06:29 +01:00
port help element
This commit is contained in:
@@ -6,6 +6,7 @@ import './MiniDialog.css'
|
|||||||
interface IProps {
|
interface IProps {
|
||||||
children: React.ReactNode[] | React.ReactNode;
|
children: React.ReactNode[] | React.ReactNode;
|
||||||
title?: string;
|
title?: string;
|
||||||
|
closeable?: boolean;
|
||||||
closeFn: () => void;
|
closeFn: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17,10 +18,14 @@ export default class MiniDialog extends React.Component<IProps, never> {
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className="MiniDialog">
|
<div className="MiniDialog">
|
||||||
|
{
|
||||||
|
this.props.closeable !== undefined && this.props.closeable ?
|
||||||
<div className="MiniDialogTop" onClick={this.props.closeFn}>
|
<div className="MiniDialogTop" onClick={this.props.closeFn}>
|
||||||
<span>{this.props?.title}</span>
|
<span>{this.props?.title}</span>
|
||||||
<img src={Close} className="MiniDialogClose" />
|
<img src={Close} className="MiniDialogClose" />
|
||||||
</div>
|
</div> : null
|
||||||
|
}
|
||||||
|
|
||||||
<div className="MiniDialogInner">
|
<div className="MiniDialogInner">
|
||||||
{this.props.children}
|
{this.props.children}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ export default class ServerLaunchSection extends React.Component<IProps, IState>
|
|||||||
<TextInput style={{
|
<TextInput style={{
|
||||||
width: '10%',
|
width: '10%',
|
||||||
}} id="port" key="port" placeholder={this.state.portPlaceholder} onChange={this.setPort}/>
|
}} id="port" key="port" placeholder={this.state.portPlaceholder} onChange={this.setPort}/>
|
||||||
<HelpButton />
|
<HelpButton contents="Ensure this is the Dispatch server port, not the Game server port. This is almost always '443'." />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="ServerLaunchButtons">
|
<div className="ServerLaunchButtons">
|
||||||
|
|||||||
@@ -9,7 +9,22 @@
|
|||||||
filter: drop-shadow(0px 0px 5px rgb(0 0 0 / 20%));
|
filter: drop-shadow(0px 0px 5px rgb(0 0 0 / 20%));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.HelpButton:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
.HelpButton img {
|
.HelpButton img {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
filter: invert(100%) sepia(2%) saturate(201%) hue-rotate(47deg) brightness(117%) contrast(100%);
|
filter: invert(100%) sepia(2%) saturate(201%) hue-rotate(47deg) brightness(117%) contrast(100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.HelpContents {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.HelpContents .MiniDialog {
|
||||||
|
bottom: 80%;
|
||||||
|
left: 35%;
|
||||||
|
width: 60%;
|
||||||
|
height: 60%;
|
||||||
|
}
|
||||||
@@ -2,8 +2,10 @@ import React from 'react'
|
|||||||
|
|
||||||
import './HelpButton.css'
|
import './HelpButton.css'
|
||||||
import Help from '../../../resources/icons/help.svg'
|
import Help from '../../../resources/icons/help.svg'
|
||||||
|
import MiniDialog from '../MiniDialog'
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
|
contents: string
|
||||||
id?: string
|
id?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -14,14 +16,37 @@ interface IState {
|
|||||||
export default class HelpButton extends React.Component<IProps, IState> {
|
export default class HelpButton extends React.Component<IProps, IState> {
|
||||||
constructor(props: IProps) {
|
constructor(props: IProps) {
|
||||||
super(props)
|
super(props)
|
||||||
|
|
||||||
|
this.state = {
|
||||||
|
opened: false
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setOpen = this.setOpen.bind(this)
|
||||||
|
this.setClosed = this.setClosed.bind(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
setOpen() {
|
||||||
|
this.setState({ opened: true })
|
||||||
|
}
|
||||||
|
|
||||||
|
setClosed() {
|
||||||
|
this.setState({ opened: false })
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className="HelpSection">
|
<div className="HelpSection">
|
||||||
<div className="HelpButton">
|
<div className="HelpButton" onMouseEnter={this.setOpen} onMouseLeave={this.setClosed}>
|
||||||
<img src={Help} />
|
<img src={Help} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="HelpContents" style={{
|
||||||
|
display: this.state.opened ? 'block' : 'none'
|
||||||
|
}}>
|
||||||
|
<MiniDialog closeFn={this.setClosed}>
|
||||||
|
{this.props.contents}
|
||||||
|
</MiniDialog>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user