Skip to content

Commit

Permalink
Introduce Sample Browser
Browse files Browse the repository at this point in the history
  • Loading branch information
lucemans committed Aug 22, 2024
1 parent 3a0e2b2 commit c9cc5ff
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 5 deletions.
1 change: 1 addition & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"postcss": "^8.4.38",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-icons": "^5.3.0",
"react-leaflet": "^4.2.1",
"swr": "^2.2.5",
"tailwindcss": "^3.4.3",
Expand Down
12 changes: 12 additions & 0 deletions web/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added web/public/pack_duitsland.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions web/src/components/PackSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ export const PackSidebar = () => {
{Object.entries(PACKS).map(([packId, pack]) => (
<li key={packId} className="">
<Link
href={'/pack/$packId'}
to={'/pack/$packId'}
params={{ packId }}
className="flex items-center gap-2 border-b border-neutral-200 px-4 py-2 hover:bg-neutral-100"
>
{pack.cover && (
<img
src={pack.cover}
className="w-10 h-10 rounded-sm"
className="w-10 h-10 rounded-sm "
alt={pack.name}
/>
)}
Expand Down
27 changes: 27 additions & 0 deletions web/src/components/SampleList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { FaPlay } from 'react-icons/fa';

export const SampleList = () => {
return (
<div className="w-full rounded-lg bg-neutral-100 p-4">
<ul>
{Array.from({ length: 10 })
.fill(0)
.map((_, index) => (
<li
key={index}
className="flex items-center gap-2 border-b border-neutral-200"
>
<div className="w-10 h-10 rounded-sm bg-neutral-200 flex items-center justify-center text-neutral-500">
<FaPlay />
</div>
<div>
<h3 className="text-lg font-bold">
Sample {index + 1}
</h3>
</div>
</li>
))}
</ul>
</div>
);
};
3 changes: 2 additions & 1 deletion web/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ export const PACKS: Record<string, Pack> = {
activate_windows: {
name: 'Activate Windows',
description: 'Your license has expired.',
cover: '/public/pack_activate_windows.png',
cover: '/pack_activate_windows.png',
},
duitsland: {
name: 'Duitsland',
description: 'Manderscheid 2024 Samples',
cover: '/pack_duitsland.png',
},
};
36 changes: 34 additions & 2 deletions web/src/routes/pack/$packId/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,45 @@
import { createFileRoute } from '@tanstack/react-router';

import { SampleList } from '../../../components/SampleList';
import { PACKS } from '../../../config';

export const Route = createFileRoute('/pack/$packId/')({
component: (parameters) => {
console.log(parameters);
const { packId } = Route.useParams();
const pack = PACKS[packId];

if (!pack) {
return <div className="p-4">Pack not found!</div>;
}

return (
<div>
<div>Hello /pack/$packId/! {packId}!</div>
<div className="p-4 space-y-4 w-full">
<div className="flex items-center gap-4">
{pack.cover && (
<div className="w-48 h-48 bg-neutral-100 rounded-md">
<img
src={pack.cover}
className="w-full h-full object-cover rounded-md"
alt={pack.name}
/>
</div>
)}
<div className="space-y-2">
<div>
<h1 className="text-2xl font-bold">{pack.name}</h1>
<p>{pack.description}</p>
<ul className="flex items-center gap-2 text-sm">
<li>22 Samples</li>
<li>2 Loops</li>
</ul>
</div>
<div>
<button className="btn">Download All</button>
</div>
</div>
</div>
<SampleList />
</div>
);
},
Expand Down

0 comments on commit c9cc5ff

Please sign in to comment.