Skip to content

Commit

Permalink
design for focus feature
Browse files Browse the repository at this point in the history
  • Loading branch information
martypdx committed Apr 5, 2024
1 parent 092a3ab commit de167b5
Show file tree
Hide file tree
Showing 9 changed files with 129 additions and 61 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions src/focus/EditableFocus.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.current-focus {
display: grid;

h2:before {
content: '⌾';
position: relative;
top: .08em;
margin-right: .25em;
}

[contenteditable] {
font-size: 1.5em;
padding: .25em 0em;
margin: 0 1em 0 0;
transition: padding .3s ease-in-out;
}

[contenteditable]:hover,
[contenteditable]:focus {
padding: .25em;
}

[contenteditable]:hover {
background: #fafafa;
outline: 2px solid #eee;
}

[contenteditable]:focus {
background: #efefef;
outline: 2px solid blue;
}

[contenteditable]:empty:not(:focus):before {
content: attr(aria-placeholder);
opacity: .8
}

[contenteditable]:empty:focus:before {
content: ' ';
opacity: .8
}
}
3 changes: 2 additions & 1 deletion src/focus/CurrentFocus.jsx → src/focus/EditableFocus.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { consume } from 'azoth/chronos/channels';
import { Updater } from 'azoth/maya';
import './EditableFocus.css';

export function CurrentFocus({ current, update }) {
export function EditableFocus({ current, update }) {
const Focus = updatableFocus(update);
consume(current, current => Focus.update(current));
return Focus;
Expand Down
46 changes: 12 additions & 34 deletions src/focus/FocusFeature.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,43 +38,21 @@

}

.focus-section {}

.current-focus {
.focus-section {
display: grid;
grid-template-areas:
'current remove'
'add add';
row-gap: 1em;

p {
font-size: 1.2em;
.remove-button {
grid-area: remove;
place-self: start end;
}

[contenteditable] {
font-size: 26px;
padding: .25em 0em;
margin: 1em 0;
transition: padding .3s ease-in-out;
}

[contenteditable]:hover,
[contenteditable]:focus {
padding: .25em;
}

[contenteditable]:hover {
background: #fafafa;
outline: 2px solid #eee;
}

[contenteditable]:focus {
background: #efefef;
outline: 2px solid blue;
}

[contenteditable]:empty:not(:focus):before {
content: attr(aria-placeholder);
opacity: .8
}

[contenteditable]:empty:focus:before {
content: ' ';
opacity: .8
.add-button {
grid-area: add;
place-self: end start;
}
}
14 changes: 7 additions & 7 deletions src/focus/FocusFeature.jsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { FocusPath } from './FocusPath.jsx';
import { CurrentFocus } from './CurrentFocus.jsx';
import { EditableFocus } from './EditableFocus.jsx';
import { useFocus } from './useFocus.jsx';
import './FocusFeature.css';

export default function FocusFeature() {
const [current, stack, { update, ...changeFocus }] = useFocus();
const { Add, Remove, List } = <FocusPath stack={stack} {...changeFocus} />;

const { FocusStack, AddButton, RemoveButton } = <FocusPath stack={stack} {...changeFocus} />;
return <section class="focus-play">
<FocusPlayButton />
<List />
<FocusStack />
<div class="focus-section">
<Remove className="remove-button" />
<CurrentFocus current={current} update={update} />
<Add className="add-button" />
<RemoveButton className="change-focus remove-button" />
<EditableFocus className="current-focus"
current={current} update={update} />
<AddButton className="change-focus add-button" />
</div>
</section>;
}
Expand Down
53 changes: 53 additions & 0 deletions src/focus/FocusPath.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
button.change-focus {
margin: 0;
padding: .5em 1em;
font-size: .9em;
color: var(--color);
outline: 0;
border: 1px solid transparent;
cursor: pointer;
opacity: .6;
transition: all 300ms ease-in-out;

&:hover {
opacity: 1;
border: 1px solid var(--color);
}
}

.focus-path {
padding: 0;
margin: 0;
list-style: none;
font-size: .7em;
width: 100%;
max-width: 900px;

>li {
margin: .75em 0;
display: flex;
align-items: center;

>* {
display: inline-block;
margin: 0;
}

h2:before {
content: '⌾';
position: relative;
top: .08em;
margin-right: .25em;
}

p {
margin-left: .8em;
text-align: center;
font-size: 1.2em;
font-style: italic;
}
}



}
20 changes: 12 additions & 8 deletions src/focus/FocusPath.jsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
import { branch } from 'azoth/chronos/channels';
import { Toggle } from 'azoth/maya';
import './FocusPath.css';

export function FocusPath({ stack, add, remove }) {
const Add = <ChangeButton onclick={add} text="add" />;
const AddButton = <ChangeButton onclick={add} text="" />;

const [Remove, Path] = branch(stack,
const [RemoveButton, Path] = branch(stack,
<Toggle on={s => s.length}>
<ChangeButton onclick={remove} text="remove" />
<ChangeButton onclick={remove} text="" />
</Toggle>,
[Focus, { map: true }],
// s => s.map(focus => <Focus {...focus} />),
s => s.map(Focus),
);

return { List: <ul><Path /></ul>, Add, Remove };
return {
FocusStack: <ul class="focus-path"><Path /></ul>,
AddButton,
RemoveButton
};
}

function Focus({ priority, exit }) {
return <li>
<span class="priority">{priority}</span>
{exit}
<h2>{priority}</h2>
<p>{exit}</p>
</li>;
}

Expand Down
3 changes: 0 additions & 3 deletions src/focus/stack.css

This file was deleted.

7 changes: 0 additions & 7 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ body {
background: var(--background);
}

button {
margin: 0;
padding: 2vw 4vw;
background: var(--color);
color: var(--background);
}

header {
display: flex;
justify-content: space-between;
Expand Down

0 comments on commit de167b5

Please sign in to comment.