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

Commit

Permalink
feat: short name for package component
Browse files Browse the repository at this point in the history
  • Loading branch information
danestves committed Mar 1, 2022
1 parent d29d798 commit ecdffd8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
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 };

0 comments on commit ecdffd8

Please sign in to comment.