Skip to content

Commit

Permalink
Example/add switch short-term example (#111)
Browse files Browse the repository at this point in the history
* Example/add switch short-term example

* add tip
  • Loading branch information
ishiko732 committed Aug 5, 2024
1 parent 45fdde1 commit eee4f0c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
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>
);
};

0 comments on commit eee4f0c

Please sign in to comment.