Skip to content
This repository has been archived by the owner on Apr 27, 2022. It is now read-only.

feat: short name for package component #94

Merged
merged 1 commit into from
Mar 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ pnpm add react-youtube-lite
## 📚 Usage

```tsx
import { ReactYouTubeLite } from 'react-youtube-lite';
import { YouTubeLite } from 'react-youtube-lite';

// Full URL
const App = () => {
return (
<ReactYouTubeLite
<YouTubeLite
url="https://www.youtube.com/watch?v=DVQTGidS1yk"
title='React and the Music Industry | Jameyel "J. Dash" Johnson'
/>
Expand All @@ -49,16 +49,13 @@ const App = () => {
// Short URL
const App = () => {
return (
<ReactYouTubeLite
url="https://youtu.be/DVQTGidS1yk"
title='React and the Music Industry | Jameyel "J. Dash" Johnson'
/>
<YouTubeLite url="https://youtu.be/DVQTGidS1yk" title='React and the Music Industry | Jameyel "J. Dash" Johnson' />
);
};

// ID
const App = () => {
return <ReactYouTubeLite url="DVQTGidS1yk" title='React and the Music Industry | Jameyel "J. Dash" Johnson' />;
return <YouTubeLite url="DVQTGidS1yk" title='React and the Music Industry | Jameyel "J. Dash" Johnson' />;
};
```

Expand Down
4 changes: 2 additions & 2 deletions example/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Dependencies
import { ReactYouTubeLite } from '../../src';
import { YouTubeLite } from '../../src';

export function App() {
return (
<div>
<ReactYouTubeLite
<YouTubeLite
url="https://www.youtube.com/watch?v=DVQTGidS1yk"
title='React and the Music Industry | Jameyel "J. Dash" Johnson"'
/>
Expand Down
10 changes: 5 additions & 5 deletions src/react-youtube-lite/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { StyledAspectRatio, StyledIframe, StyledYouTubeIcon } from './react-yout
import { addPrefetch } from '../utils/add-prefetch';
import { getSrcSearch } from '../utils/get-src-search';
import { getYouTubeId } from '../utils/get-youtube-id';
import type { ReactYouTubeLiteProps } from '../types';
import type { YouTubeLiteProps } from '../types';

function RenderReactYouTubeLite(
function RenderYouTubeLite(
{
url,
adNetwork,
Expand All @@ -22,7 +22,7 @@ function RenderReactYouTubeLite(
poster = 'hqdefault',
title,
...props
}: ReactYouTubeLiteProps,
}: YouTubeLiteProps,
ref: React.ForwardedRef<HTMLDivElement>
) {
let [preconnected, setPreconnected] = React.useState(false);
Expand Down Expand Up @@ -91,6 +91,6 @@ function RenderReactYouTubeLite(
);
}

const ReactYouTubeLite = React.forwardRef(RenderReactYouTubeLite);
const YouTubeLite = React.forwardRef(RenderYouTubeLite);

export { ReactYouTubeLite };
export { YouTubeLite };
4 changes: 2 additions & 2 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface IframeProps extends React.ComponentPropsWithoutRef<'iframe'> {
css?: Stitches.CSS;
}

interface ReactYouTubeLiteProps extends React.ComponentPropsWithoutRef<'div'> {
interface YouTubeLiteProps extends React.ComponentPropsWithoutRef<'div'> {
/**
* This can be either an url to a video or a video ID.
*/
Expand Down Expand Up @@ -82,4 +82,4 @@ interface ReactYouTubeLiteProps extends React.ComponentPropsWithoutRef<'div'> {
title?: string;
}

export { IframeProps, PosterQuality, ReactYouTubeLiteProps };
export { IframeProps, PosterQuality, YouTubeLiteProps };