diff --git a/src/components/categories/categories.tsx b/src/components/categories/categories.tsx index 903e78e..7b3a50d 100644 --- a/src/components/categories/categories.tsx +++ b/src/components/categories/categories.tsx @@ -1,27 +1,12 @@ -import { BiSolidTree } from 'react-icons/bi/index'; -import { FaCity } from 'react-icons/fa/index'; - import { Container } from '@/components/container'; import { Category } from '@/components/category'; import { PlayButton } from '@/components/play-button'; import { PlayProvider } from '@/contexts/play'; -interface CategoriesProps { - categories: Array<{ - id: string; - title: string; - sounds: Array<{ - label: string; - src: string; - }>; - }>; -} +import { sounds } from '@/data/sounds'; -export function Categories({ categories }: CategoriesProps) { - const idToIcon: { [id: string]: React.ReactNode } = { - nature: , - urban: , - }; +export function Categories() { + const { categories } = sounds; return ( @@ -30,11 +15,7 @@ export function Categories({ categories }: CategoriesProps) {
{categories.map(category => ( - + ))}
diff --git a/src/components/category/category.tsx b/src/components/category/category.tsx index c133267..1542e2e 100644 --- a/src/components/category/category.tsx +++ b/src/components/category/category.tsx @@ -6,7 +6,7 @@ interface CategoryProps { icon: React.ReactNode; title: string; id: string; - sounds: Array<{ label: string; src: string }>; + sounds: Array<{ label: string; src: string; icon: React.ReactNode }>; } export function Category({ icon, sounds, title }: CategoryProps) { diff --git a/src/components/sound/sound.module.css b/src/components/sound/sound.module.css index 6a3dff4..84c7dc7 100644 --- a/src/components/sound/sound.module.css +++ b/src/components/sound/sound.module.css @@ -4,7 +4,7 @@ flex-direction: column; align-items: center; justify-content: center; - padding: 30px 20px; + padding: 20px; border: 1px solid var(--color-neutral-200); border-radius: 8px; background: linear-gradient(var(--color-neutral-100), transparent); @@ -30,7 +30,46 @@ box-shadow: 0 10px 20px #818cf833; } + & .icon { + position: relative; + z-index: 2; + display: flex; + width: 40px; + height: 40px; + align-items: center; + justify-content: center; + font-size: var(--font-base); + + &::after { + position: absolute; + z-index: -1; + top: 0; + left: 0; + width: 100%; + height: 100%; + border-radius: 50%; + background-color: var(--color-neutral-50); + content: ''; + } + + &::before { + position: absolute; + z-index: -2; + top: -1px; + left: -1px; + width: calc(100% + 2px); + height: calc(100% + 2px); + border-radius: 50%; + background: linear-gradient( + var(--color-neutral-300), + var(--color-neutral-100) + ); + content: ''; + } + } + & h3 { + margin-top: 12px; cursor: default; font-family: var(--font-heading); font-size: var(--font-sm); @@ -41,7 +80,7 @@ & input { width: 100%; max-width: 120px; - margin-top: 12px; + margin-top: 6px; /********** Range Input Styles **********/ diff --git a/src/components/sound/sound.tsx b/src/components/sound/sound.tsx index cd8b769..f751832 100644 --- a/src/components/sound/sound.tsx +++ b/src/components/sound/sound.tsx @@ -10,9 +10,10 @@ import styles from './sound.module.css'; interface SoundProps { label: string; src: string; + icon: React.ReactNode; } -export function Sound({ label, src }: SoundProps) { +export function Sound({ icon, label, src }: SoundProps) { const { isPlaying, play } = usePlay(); const [isSelected, setIsSelected] = useLocalStorage( `${label}-is-selected`, @@ -52,6 +53,8 @@ export function Sound({ label, src }: SoundProps) { onClick={toggle} onKeyDown={toggle} > +
{icon}
+

{label}

; + sounds: Array<{ label: string; src: string; icon: React.ReactNode }>; } export function Sounds({ sounds }: SoundsProps) { diff --git a/src/data/sounds.ts b/src/data/sounds.tsx similarity index 57% rename from src/data/sounds.ts rename to src/data/sounds.tsx index ffd8e72..69828c2 100644 --- a/src/data/sounds.ts +++ b/src/data/sounds.tsx @@ -1,43 +1,62 @@ +import { BiSolidTree, BiWater } from 'react-icons/bi/index'; +import { FaCity, FaCloudShowersHeavy, FaWater } from 'react-icons/fa/index'; +import { PiBirdFill } from 'react-icons/pi/index'; +import { MdOutlineThunderstorm } from 'react-icons/md/index'; +import { GiCricket } from 'react-icons/gi/index'; +import { BsSoundwave } from 'react-icons/bs/index'; + +const defaultIcon = ; + export const sounds: { categories: Array<{ id: string; title: string; - sounds: Array<{ label: string; src: string }>; + icon: React.ReactNode; + sounds: Array<{ label: string; src: string; icon: React.ReactNode }>; }>; } = { categories: [ { + icon: , id: 'nature', sounds: [ { + icon: , label: 'Rain', src: '/sounds/rain.mp3', }, { + icon: , label: 'Birds', src: '/sounds/birds.mp3', }, { + icon: , label: 'River', src: '/sounds/river.mp3', }, { + icon: , label: 'Thunder', src: '/sounds/thunder.mp3', }, { + icon: , label: 'Crickets', src: '/sounds/crickets.mp3', }, { + icon: , label: 'Waves', src: '/sounds/waves.mp3', }, { + icon: defaultIcon, label: 'Seagulls', src: '/sounds/seagulls.mp3', }, { + icon: defaultIcon, label: 'Campfire', src: '/sounds/campfire.mp3', }, @@ -45,17 +64,21 @@ export const sounds: { title: 'Nature', }, { + icon: , id: 'urban', sounds: [ { + icon: defaultIcon, label: 'Airport', src: '/sounds/airport.mp3', }, { + icon: defaultIcon, label: 'Cafe', src: '/sounds/cafe.mp3', }, { + icon: defaultIcon, label: 'Rain on Window', src: '/sounds/rain-on-window.mp3', },