Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example/add switch short-term example #111

Merged
merged 2 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions example/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
<script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio,line-clamp"></script>
<script type="module">
// production
import * as tsFsrs from 'https://cdn.jsdelivr.net/npm/ts-fsrs@latest/+esm';
// development
// Please start with this command: `pnpm run build`
// you need install `Live Server` in vscode:
// https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer
// import * as tsFsrs from '../dist/index.mjs';

window.tsfsrs = tsFsrs
</script>
<title>TS-FSRS example</title>
Expand Down
24 changes: 24 additions & 0 deletions example/exampleComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,30 @@ const ParamsComponent = ({ f, setF }) => {
prevent cards from sticking together and always being reviewed on the
same day.
</div>

<div className="flex py-4">
<label htmlFor="enable_short-term" className="pr-4">
enable_short-term:
</label>
<input
name="enable_short-term"
type="checkbox"
className="toggle toggle-info mt-1"
aria-label="enable short-term"
defaultChecked={f.parameters.enable_short_term}
onChange={(e) => handleChange("enable_short_term", e.target.checked)}
/>
</div>
<div className="label text-xs">
When disabled, this allow user to skip the short-term schedule.
</div>
<hr className="pt-4"/>
<div>
<div>current apply parameters:</div>
<div>{Object.keys(f.parameters).map(key=><p key={key}>
{`${key} : ${JSON.stringify(f.parameters[key])}`}
</p>)}</div>
</div>
</div>
);
};