parent
90f7568a2a
commit
c90d4fc769
@ -1,38 +0,0 @@ |
|||||||
import styled from 'styled-components/macro' |
|
||||||
|
|
||||||
import { ButtonSolid, Input } from 'features/Common' |
|
||||||
|
|
||||||
const EmbedContainer = styled.div` |
|
||||||
display: flex; |
|
||||||
flex-direction: column; |
|
||||||
align-items: center; |
|
||||||
max-width: 100%; |
|
||||||
` |
|
||||||
|
|
||||||
const EmbedInput = styled(Input)` |
|
||||||
margin: 0; |
|
||||||
max-width: 400px; |
|
||||||
` |
|
||||||
|
|
||||||
type EmbedProps = { |
|
||||||
url: string, |
|
||||||
} |
|
||||||
|
|
||||||
export const EmbeddedComponent = ({ url }:EmbedProps) => { |
|
||||||
const iframeString = `<iframe src=${url}" width="300px" border="0" class="insports-embed" allowFullScreen srcdoc=${document.querySelector('#statsview')} />` |
|
||||||
|
|
||||||
const handleCopy = async (src: string) => { |
|
||||||
await navigator.clipboard.writeText(src) |
|
||||||
} |
|
||||||
|
|
||||||
return ( |
|
||||||
<EmbedContainer> |
|
||||||
<EmbedInput |
|
||||||
disabled={!!true} |
|
||||||
label='Embed Code' |
|
||||||
defaultValue={iframeString} |
|
||||||
/> |
|
||||||
<ButtonSolid onClick={() => handleCopy(iframeString)}>Copy code</ButtonSolid> |
|
||||||
</EmbedContainer> |
|
||||||
) |
|
||||||
} |
|
||||||
Loading…
Reference in new issue