CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/components/store/toggle-explanations.tsx
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2022 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { set_local_storage } from "@cocalc/frontend/misc/local-storage";
7
import { Form, Switch } from "antd";
8
9
export function ToggleExplanations({ showExplanations, setShowExplanations }) {
10
return (
11
<Form.Item wrapperCol={{ offset: 0, span: 24 }}>
12
<div
13
style={{ float: "right", cursor: "pointer" }}
14
onClick={() => setShowExplanations(!showExplanations)}
15
>
16
<Switch
17
checked={showExplanations}
18
onChange={(show) => {
19
setShowExplanations(show);
20
// ugly and ignores basePath -- change later:
21
set_local_storage(
22
"store_site_license_show_explanations",
23
show ? "t" : ""
24
);
25
}}
26
/>{" "}
27
Show explanations
28
</div>
29
</Form.Item>
30
);
31
}
32
33