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