Skip to content

Commit

Permalink
Merge pull request #4 from Iinpark/mobile-adapt
Browse files Browse the repository at this point in the history
fix: верстка в ютуб iframe
  • Loading branch information
Iinpark committed Jul 26, 2023
2 parents c127435 + 89d5486 commit ea6e1aa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 53 deletions.
6 changes: 6 additions & 0 deletions src/shared/ui/Media/YTIframe.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.yt-iframe {
height: auto;
width: 100%;
aspect-ratio: 16/9;
max-width: 600px;
}
8 changes: 6 additions & 2 deletions src/shared/ui/Media/YTIframe.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import React from 'react';
import './YTIframe.scss';

type YTIframeProps = {
src: string;
height?: number | string;
width?: number | string;
};
const YTIframe = (props: YTIframeProps) => {
const { src = '', height = 315, width = 560 } = props;
const { src = '', height = '', width = '' } = props;
const vidId = src.split('v=')[1];
if (!src) return <div></div>;

return (
<iframe
className='yt-iframe'
width={width}
height={height}
src={`https://www.youtube.com/embed/${vidId}`}
src={`https://www.youtube.com/embed/${vidId}?autoplay=1`}
title='YouTube video player'
frameborder='0'
allow='accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share'
Expand Down
51 changes: 0 additions & 51 deletions src/widgets/LaunchesList/Index.tsx

This file was deleted.

0 comments on commit ea6e1aa

Please sign in to comment.