Skip to content

Commit

Permalink
feat: add help text
Browse files Browse the repository at this point in the history
  • Loading branch information
remvze committed Oct 11, 2023
1 parent 4266557 commit c3521a7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/components/categories/categories.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.help {
margin-top: 20px;
color: var(--color-foreground-subtle);
font-size: var(--font-sm);
text-align: center;
}
10 changes: 7 additions & 3 deletions src/components/categories/categories.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { useEffect, useMemo } from 'react';
import { useMemo } from 'react';
import { useShallow } from 'zustand/react/shallow';
import { BiSolidHeart } from 'react-icons/bi/index';

import { useFavoriteStore } from '@/store/favorite';
import { useSoundStore } from '@/store/sound';

import { Container } from '@/components/container';
import { StoreConsumer } from '../store-consumer';
Expand All @@ -12,10 +13,13 @@ import { PlayProvider } from '@/contexts/play';

import { sounds } from '@/data/sounds';

import styles from './categories.module.css';

export function Categories() {
const categories = useMemo(() => sounds.categories, []);

const favorites = useFavoriteStore(useShallow(state => state.favorites));
const noSelected = useSoundStore(state => state.noSelected());

const favoriteSounds = useMemo(() => {
const favoriteSounds = categories
Expand All @@ -31,14 +35,14 @@ export function Categories() {
);
}, [favorites, categories]);

useEffect(() => console.log({ favoriteSounds }), [favoriteSounds]);

return (
<StoreConsumer>
<PlayProvider>
<Container>
<Buttons />

{noSelected && <p className={styles.help}>Select a sound to play!</p>}

<div>
{!!favoriteSounds.length && (
<Category
Expand Down

0 comments on commit c3521a7

Please sign in to comment.