Skip to content

Commit

Permalink
Docs update
Browse files Browse the repository at this point in the history
  • Loading branch information
cevatbarisyilmaz committed Nov 2, 2024
1 parent 168593a commit 46d4014
Show file tree
Hide file tree
Showing 58 changed files with 493 additions and 180 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ npm install react-streaming-availability
The `Row` component displays a row of movies or TV shows.

```tsx
import { Row } from 'react-streaming-availability';
import { Row, newTopShowsSource } from 'react-streaming-availability';

export default function MyComponent() {
return (
Expand All @@ -73,7 +73,7 @@ export default function MyComponent() {
The `Grid` component displays a grid of movies or TV shows.

```tsx
import { Grid } from 'react-streaming-availability';
import { Grid, newFilteredSearchSource } from 'react-streaming-availability';

export default function MyComponent() {
return (
Expand Down
3 changes: 3 additions & 0 deletions demo/nextjs/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["next/core-web-vitals", "next/typescript"]
}
40 changes: 40 additions & 0 deletions demo/nextjs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# env files (can opt-in for commiting if needed)
.env*

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
44 changes: 44 additions & 0 deletions demo/nextjs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
This is a [Next.js](https://nextjs.org) app
demonstrating how to use
Streaming Availability React Components.

## Getting Started

First, you need an API key to use the Streaming Availability React Components.
It's free to get it without any credit card information.
To get one, please follow the instructions in the
[Authorization Guide](https://docs.movieofthenight.com/guide/authorization).

Once you have an API key,
create a `.env` file in the root of the project
and add your API key as follows
(replace `<your-api-key>` with your actual API key):

```
STREAMING_AVAILABILITY_API_KEY=<your-api-key>
```

Install the dependencies:

```bash
npm install
```

Then, you can run the development server:

```bash
npm run dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

## Learn More

To learn more about Streaming Availability API, take a look at the following resources:

- [Streaming Availability API Documentation](https://docs.movieofthenight.com/) - learn about Streaming Availability API.
- [Streaming Availability API Landing Page](https://nextjs.org/learn) - discover the features supported.

You can check out [the Streaming Availability React Components repository](https://github.com/movieofthenight/react-streaming-availability) - your feedback and contributions are welcome!
Binary file added demo/nextjs/app/favicon.ico
Binary file not shown.
25 changes: 25 additions & 0 deletions demo/nextjs/app/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

body {
color: #ededed;
background: #0a0a0a;
padding-bottom: 4rem;
}

h1 {
font-size: 2rem;
font-weight: bold;
margin: 4rem;
}

h2 {
font-size: 1.5rem;
font-weight: bold;
margin: 1rem 4rem;
}

p {
margin: 1rem 4rem;
}
29 changes: 29 additions & 0 deletions demo/nextjs/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import type { Metadata } from "next";
import "./globals.css";
import { Open_Sans } from 'next/font/google'

export const metadata: Metadata = {
title: "Streaming Availability React Components Demo",
description: "Streaming Availability React Components Demo",
};

const openSans = Open_Sans({
subsets: ['latin'],
display: 'swap',
})

export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body
className={`${openSans.className} antialiased`}
>
{children}
</body>
</html>
);
}
42 changes: 42 additions & 0 deletions demo/nextjs/app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import {Grid, newChangesSource, newFilteredSearchSource, newTopShowsSource, Row} from "react-streaming-availability";

export default function Home() {
return (
<main>
<h1>Streaming Availability React Components Demo</h1>
<p>Click on the posters or logos to follow the deep links into streaming service apps.</p>
<Row
title="Apple TV+ Germany Top Shows Row with Vertical Posters"
posterType="horizontal"
source={newTopShowsSource({
country: "de",
service: "apple",
})} />
<Row
title="Netflix US Top 10 Series Row with Vertical Posters"
posterType="vertical"
source={newTopShowsSource({
country: "us",
showType: "series",
service: "netflix",
})} />
<Row
title="Expiring Movies & Series in US"
posterType="horizontal"
source={newChangesSource({
country: "us",
changeType: "expiring",
itemType: "show",
})} />
<h2>Popular Movies & Series in US</h2>
<Grid source={
newFilteredSearchSource({
country: "us",
orderBy: "popularity_1month",
orderDirection: "desc",
limit: 100,
})
} />
</main>
);
}
7 changes: 7 additions & 0 deletions demo/nextjs/next.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { NextConfig } from "next";

const nextConfig: NextConfig = {
/* config options here */
};

export default nextConfig;
27 changes: 27 additions & 0 deletions demo/nextjs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "react-streaming-availability-demo",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"react": "19.0.0-rc-02c0e824-20241028",
"react-dom": "19.0.0-rc-02c0e824-20241028",
"next": "15.0.2",
"react-streaming-availability": "^0.1.0"
},
"devDependencies": {
"typescript": "^5",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"postcss": "^8",
"tailwindcss": "^3.4.1",
"eslint": "^8",
"eslint-config-next": "15.0.2"
}
}
8 changes: 8 additions & 0 deletions demo/nextjs/postcss.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/** @type {import('postcss-load-config').Config} */
const config = {
plugins: {
tailwindcss: {},
},
};

export default config;
19 changes: 19 additions & 0 deletions demo/nextjs/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { Config } from "tailwindcss";

const config: Config = {
content: [
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
"./components/**/*.{js,ts,jsx,tsx,mdx}",
"./app/**/*.{js,ts,jsx,tsx,mdx}",
],
theme: {
extend: {
colors: {
background: "var(--background)",
foreground: "var(--foreground)",
},
},
},
plugins: [],
};
export default config;
27 changes: 27 additions & 0 deletions demo/nextjs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
Loading

0 comments on commit 46d4014

Please sign in to comment.