-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add IFrameBlock * Fix styles * Fix * fix: change link to prod translation --------- Co-authored-by: timofeyevvv <[email protected]>
- Loading branch information
1 parent
0f75e04
commit a576b05
Showing
6 changed files
with
84 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
@use '~@gravity-ui/page-constructor/styles/styles.scss' as pcStyles; | ||
@use '~@gravity-ui/page-constructor/styles/variables.scss' as pcVariables; | ||
@use '../../variables.scss'; | ||
|
||
$block: '.#{variables.$ns}iframe-block'; | ||
|
||
#{$block} { | ||
@include pcStyles.animate(); | ||
|
||
&__wrapper { | ||
position: relative; | ||
width: 100%; | ||
height: 0; | ||
} | ||
|
||
&__iframe { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import {Animatable, AnimateBlock} from '@gravity-ui/page-constructor'; | ||
import React from 'react'; | ||
|
||
import {block} from '../../utils'; | ||
import {CustomBlock} from '../constants'; | ||
|
||
import './IFrameBlock.scss'; | ||
|
||
const b = block('iframe-block'); | ||
|
||
export type IframeProps = Animatable & { | ||
src: string; | ||
width: number; | ||
height: number; | ||
allow?: string; | ||
frameBorder?: number; | ||
scrolling?: string; | ||
}; | ||
|
||
export type IframeModel = IframeProps & { | ||
type: CustomBlock.Iframe; | ||
}; | ||
|
||
export const IFrameBlock: React.FC<IframeProps> = ({ | ||
animated, | ||
src, | ||
width, | ||
height, | ||
allow, | ||
frameBorder = 0, | ||
scrolling = 'no', | ||
}) => { | ||
return ( | ||
<AnimateBlock className={b()} animate={animated}> | ||
<div className={b('wrapper')} style={{paddingBottom: `${(height * 100) / width}%`}}> | ||
<iframe | ||
className={b('iframe')} | ||
src={src} | ||
allow={allow} | ||
frameBorder={frameBorder} | ||
scrolling={scrolling} | ||
></iframe> | ||
</div> | ||
</AnimateBlock> | ||
); | ||
}; | ||
|
||
export default IFrameBlock; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters