mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-25 03:53:00 +08:00
Implement hiding widgets
This commit is contained in:
parent
be588de92f
commit
9f6f8bef79
@ -4,7 +4,12 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>GM Handbook</title>
|
<title>GM Handbook</title>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
window["hide"] = ["quests", "achievements"];
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
<script type="module" src="/src/main.tsx"></script>
|
<script type="module" src="/src/main.tsx"></script>
|
||||||
|
@ -24,14 +24,22 @@ class HomeButton extends React.PureComponent<IProps> {
|
|||||||
navigate(this.props.anchor);
|
navigate(this.props.anchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if this component should be showed.
|
||||||
|
*/
|
||||||
|
private shouldShow(): boolean {
|
||||||
|
return !(((window as any).hide) as string[])
|
||||||
|
.includes(this.props.anchor.toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return this.shouldShow() ? (
|
||||||
<div className={"HomeButton"} onClick={() => this.redirect()}>
|
<div className={"HomeButton"} onClick={() => this.redirect()}>
|
||||||
<img className={"HomeButton_Icon"} src={this.props.icon} alt={this.props.name} />
|
<img className={"HomeButton_Icon"} src={this.props.icon} alt={this.props.name} />
|
||||||
|
|
||||||
<p className={"HomeButton_Label"}>{this.props.name}</p>
|
<p className={"HomeButton_Label"}>{this.props.name}</p>
|
||||||
</div>
|
</div>
|
||||||
);
|
) : undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,14 +24,22 @@ class SideBarButton extends React.PureComponent<IProps> {
|
|||||||
navigate(this.props.anchor);
|
navigate(this.props.anchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if this component should be showed.
|
||||||
|
*/
|
||||||
|
private shouldShow(): boolean {
|
||||||
|
return !(((window as any).hide) as string[])
|
||||||
|
.includes(this.props.anchor.toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return this.shouldShow() ? (
|
||||||
<div className={"SideBarButton"} onClick={() => this.redirect()}>
|
<div className={"SideBarButton"} onClick={() => this.redirect()}>
|
||||||
<img className={"SideBarButton_Icon"} src={this.props.icon} alt={this.props.name} />
|
<img className={"SideBarButton_Icon"} src={this.props.icon} alt={this.props.name} />
|
||||||
|
|
||||||
<p className={"SideBarButton_Label"}>{this.props.name}</p>
|
<p className={"SideBarButton_Label"}>{this.props.name}</p>
|
||||||
</div>
|
</div>
|
||||||
);
|
) : undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user