Skip to content

Commit

Permalink
use Toggle from maya :)
Browse files Browse the repository at this point in the history
  • Loading branch information
martypdx committed Mar 30, 2024
1 parent dca580b commit 686e68d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions src/focus/FocusPath.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { branch } from 'azoth/chronos/channels';
import { Toggle } from 'azoth/maya';

function Toggle({ on: predicate }, slottable) {
return payload => predicate(payload) ? slottable : null;
}

export function FocusPath({ stack, add, remove }) {
const Add = <ChangeButton onclick={add} text="add" />;
Expand All @@ -11,8 +9,8 @@ export function FocusPath({ stack, add, remove }) {
<Toggle on={s => s.length}>
<ChangeButton onclick={remove} text="remove" />
</Toggle>,
s => s.map(focus => <Focus {...focus} />),
// [Focus, { map: true }],
[Focus, { map: true }],
// s => s.map(focus => <Focus {...focus} />),
);

return { Path, Add, Remove };
Expand Down
2 changes: 1 addition & 1 deletion src/focus/useFocus.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const newFocus = () => ({ priority: '', exit: '' });
export function useFocus() {
const [foci, setLocal] = useLocalStorageJSON('FOP.FOCI', [newFocus()]);
const save = () => setLocal(foci);
const [asyncFoci, changeFocus] = unicast(() => foci, null);

const [asyncFoci, changeFocus] = unicast(() => foci, null);
const [current, stack] = branch(asyncFoci,
foci => foci.at(-1),
foci => foci.slice(0, -1),
Expand Down

0 comments on commit 686e68d

Please sign in to comment.