Skip to content

Commit

Permalink
Allow self picking
Browse files Browse the repository at this point in the history
  • Loading branch information
benfoxall committed Dec 1, 2024
1 parent 1da9caa commit 93fc8e1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
8 changes: 1 addition & 7 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function App() {
key={i}
srcObject={blob}
picked={picked.includes(blob)}
onPick={() => setPicked((prev) => toggle(prev, blob))}
onPick={() => setPicked((prev) => [blob, ...prev])}
/>
))}
</>
Expand All @@ -39,10 +39,4 @@ function App() {
);
}

function toggle<T>(list: T[], item: T): T[] {
return list.includes(item)
? list.filter((each) => each !== item)
: [...list, item];
}

export default App;
7 changes: 6 additions & 1 deletion src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,19 @@ a:hover {
body {
margin: 0;
display: flex;
place-items: center;
min-width: 320px;
min-height: 100vh;
}

h1 {
font-size: 3.2em;
line-height: 1.1;
font-weight: 100;
}
h2,
h3,
h4 {
font-weight: 100;
}

button {
Expand Down

0 comments on commit 93fc8e1

Please sign in to comment.