mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-16 01:29:11 +08:00
34 lines
631 B
TypeScript
34 lines
631 B
TypeScript
|
import React, { FC } from 'react';
|
||
|
|
||
|
type DiffProps = {
|
||
|
show: boolean;
|
||
|
};
|
||
|
|
||
|
const Diff: FC<DiffProps> = ({ show }) => {
|
||
|
if (typeof window === 'undefined') {
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
const src = window.location.href.replace(/(https?:\/\/)[^/]+/, '$1ant.design');
|
||
|
|
||
|
return (
|
||
|
<iframe
|
||
|
title="master-diff"
|
||
|
style={{
|
||
|
position: 'absolute',
|
||
|
width: '100vw',
|
||
|
height: document.body.scrollHeight,
|
||
|
top: 0,
|
||
|
left: 0,
|
||
|
pointerEvents: 'none',
|
||
|
opacity: show ? '30%' : '0',
|
||
|
zIndex: 10,
|
||
|
}}
|
||
|
src={src}
|
||
|
frameBorder={0}
|
||
|
/>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export default Diff;
|