create-table-app 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-table-app",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "Create a new Table.js Smart TV app in one command",
5
5
  "bin": {
6
6
  "create-table-app": "./dist/index.mjs"
@@ -36,8 +36,8 @@
36
36
  "@types/prompts": "^2.4.9",
37
37
  "tsup": "^8.5.1",
38
38
  "typescript": "^6.0.2",
39
- "@table-js/platform": "0.0.3",
40
- "@table-js/tsconfig": "0.0.3"
39
+ "@table-js/platform": "0.0.4",
40
+ "@table-js/tsconfig": "0.0.4"
41
41
  },
42
42
  "scripts": {
43
43
  "build": "tsup",
@@ -1,4 +1,5 @@
1
- import { Focusable, useParams, useRouter } from '@table-js/core'
1
+ import { useParams, useRouter } from '@table-js/core'
2
+ import { Button } from '@table-js/ui'
2
3
 
3
4
  interface MovieParams {
4
5
  id: string
@@ -10,19 +11,9 @@ export default function MoviePage() {
10
11
 
11
12
  return (
12
13
  <div className="min-h-screen bg-(--color-background) text-(--color-text-primary) p-16">
13
- <Focusable onSelect={back} autoFocus>
14
- {(focused) => (
15
- <button
16
- className={`
17
- px-6 py-3 rounded-(--radius-button) bg-(--color-surface) mb-8
18
- transition-colors duration-150
19
- ${focused ? 'bg-(--color-surface-hover) outline-3 outline-(--color-accent)' : ''}
20
- `}
21
- >
22
- ← Back
23
- </button>
24
- )}
25
- </Focusable>
14
+ <Button className="mb-8" variant="secondary" onSelect={back} autoFocus>
15
+ Back
16
+ </Button>
26
17
  <h1 className="text-5xl font-bold">Movie #{id}</h1>
27
18
  </div>
28
19
  )
@@ -1,37 +1,70 @@
1
- import { Focusable, FocusGroup, useRouter } from '@table-js/core'
1
+ import { useRouter } from '@table-js/core'
2
+ import { Card, Shelf } from '@table-js/ui'
2
3
 
3
- const movies = [
4
- { id: '1', title: 'Inception' },
5
- { id: '2', title: 'Interstellar' },
6
- { id: '3', title: 'The Dark Knight' },
4
+ const rows = [
5
+ {
6
+ title: 'Trending',
7
+ items: [
8
+ { id: '1', title: 'Inception' },
9
+ { id: '2', title: 'Interstellar' },
10
+ { id: '3', title: 'The Dark Knight' },
11
+ { id: '4', title: 'Tenet' },
12
+ { id: '5', title: 'Dune' },
13
+ { id: '6', title: 'Arrival' },
14
+ ],
15
+ },
16
+ {
17
+ title: 'Continue Watching',
18
+ items: [
19
+ { id: '7', title: 'Severance' },
20
+ { id: '8', title: 'Silo' },
21
+ { id: '9', title: 'Foundation' },
22
+ { id: '10', title: 'Dark' },
23
+ { id: '11', title: 'Andor' },
24
+ { id: '12', title: 'Shogun' },
25
+ ],
26
+ },
27
+ {
28
+ title: 'Recommended',
29
+ items: [
30
+ { id: '13', title: 'The Matrix' },
31
+ { id: '14', title: 'Blade Runner 2049' },
32
+ { id: '15', title: 'The Creator' },
33
+ { id: '16', title: 'Mad Max: Fury Road' },
34
+ { id: '17', title: 'Edge of Tomorrow' },
35
+ { id: '18', title: 'Ex Machina' },
36
+ ],
37
+ },
7
38
  ]
8
39
 
9
40
  export default function HomePage() {
10
41
  const { navigate } = useRouter()
11
42
 
12
43
  return (
13
- <div className="min-h-screen bg-(--color-background) text-(--color-text-primary) p-16">
14
- <h1 className="text-4xl font-bold mb-12">My TV App</h1>
15
- <FocusGroup orientation="horizontal" loop>
16
- {movies.map((movie) => (
17
- <Focusable
18
- key={movie.id}
19
- onSelect={() => navigate(`/movie/${movie.id}`)}
20
- >
21
- {(focused) => (
22
- <div
23
- className={`
24
- w-48 h-72 rounded-(--radius-card) bg-(--color-surface)
25
- flex items-end p-4 mr-6 transition-transform duration-150
26
- ${focused ? 'scale-105 outline-3 outline-(--color-accent)' : ''}
27
- `}
28
- >
29
- <span className="font-semibold">{movie.title}</span>
30
- </div>
31
- )}
32
- </Focusable>
44
+ <div className="min-h-screen bg-(--color-background) py-16 text-(--color-text-primary)">
45
+ <header className="mb-12 px-16">
46
+ <h1 className="mb-3 text-4xl font-bold">My TV App</h1>
47
+ <p className="max-w-3xl text-lg text-(--color-text-secondary)">
48
+ Auto-routed pages, TV focus navigation, and shelves that follow the active item.
49
+ </p>
50
+ </header>
51
+
52
+ <div className="space-y-10 pb-16">
53
+ {rows.map((row, rowIndex) => (
54
+ <Shelf key={row.title} title={row.title}>
55
+ {row.items.map((item, itemIndex) => (
56
+ <Card
57
+ key={item.id}
58
+ title={item.title}
59
+ subtitle="Open details"
60
+ className="h-72 w-48 shrink-0"
61
+ autoFocus={rowIndex === 0 && itemIndex === 0}
62
+ onSelect={() => navigate(`/movie/${item.id}`)}
63
+ />
64
+ ))}
65
+ </Shelf>
33
66
  ))}
34
- </FocusGroup>
67
+ </div>
35
68
  </div>
36
69
  )
37
70
  }
@@ -26,10 +26,6 @@ body {
26
26
  background-color: var(--color-background);
27
27
  color: var(--color-text-primary);
28
28
  font-family: var(--font-sans);
29
- overflow: hidden;
29
+ overflow-x: hidden;
30
+ overflow-y: auto;
30
31
  }
31
-
32
- [data-focused="true"] {
33
- outline: 3px solid var(--color-accent);
34
- outline-offset: 3px;
35
- }