Skip to content

Commit

Permalink
fix: remove history on select
Browse files Browse the repository at this point in the history
  • Loading branch information
remvze committed Oct 11, 2023
1 parent 8966d59 commit 5bd1dd3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/components/buttons/buttons.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
line-height: 0;
outline: none;

&:disabled {
&:disabled,
&.disabled {
cursor: default;
opacity: 0.8;
}

& span {
Expand All @@ -53,8 +55,10 @@
outline: none;
transition: 0.2s;

&:disabled {
&:disabled,
&.disabled {
cursor: default;
opacity: 0.8;
}

&.restore {
Expand Down
3 changes: 2 additions & 1 deletion src/components/buttons/buttons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function Buttons() {
return (
<div className={styles.buttons}>
<button
className={styles.playButton}
className={cn(styles.playButton, noSelected && styles.disabled)}
disabled={noSelected}
onClick={handleClick}
>
Expand Down Expand Up @@ -56,6 +56,7 @@ export function Buttons() {
className={cn(
styles.smallButton,
hasHistory ? styles.restore : styles.delete,
noSelected && !hasHistory && styles.disabled,
)}
onClick={() => {
if (hasHistory) restoreHistory();
Expand Down
1 change: 1 addition & 0 deletions src/store/sound/sound.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const createActions: StateCreator<

select(id) {
set({
history: null,
sounds: {
...get().sounds,
[id]: { ...get().sounds[id], isSelected: true },
Expand Down

0 comments on commit 5bd1dd3

Please sign in to comment.