Skip to content

Commit

Permalink
added: scene setting onclick on card
Browse files Browse the repository at this point in the history
  • Loading branch information
slowlydev committed Apr 25, 2022
1 parent ed97994 commit ace3ec3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion renderer/components/SceneCard/SceneCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import styles from "./SceneCard.module.scss";
import convertToRGB from "../../lib/convertToRGB";

import SceneInterface from "../../interfaces/SceneInterface";
import scenesService from "../../services/scenes.service";

const store = new Store();

Expand Down Expand Up @@ -52,8 +53,12 @@ export default function SceneCard({ scene, edit }: Props) {
store.set("hiddenScenes", hiddenScenes);
}

function setScene() {
scenesService.setScene(scene.group, scene.id);
}

return (
<div className={styles.card} style={{ cursor: edit ? 'default' : 'pointer' }}>
<div className={styles.card} style={{ cursor: edit ? 'default' : 'pointer' }} onClick={() => !edit ? setScene() : void 0}>
{hasColors && (<div className={styles.light} style={{ backgroundImage: gradient }} />)}
<p>{scene.name}</p>
{edit && (<input type="checkbox" checked={isCurrentlyHidden} onChange={(event) => event.target.checked ? addToList() : removeFromList()} />)}
Expand Down

0 comments on commit ace3ec3

Please sign in to comment.