Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

Added new default component - beagle:webview #87

Merged
merged 3 commits into from
Jul 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/components/BeagleWebView/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2020 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import React, { FC } from 'react'
import { BeagleDefaultComponent } from '../types'
import withTheme from '../utils/withTheme'
import { StyledWebView } from './styled'

export interface BeagleWebViewInterface extends BeagleDefaultComponent {
url: string,
}

const BeagleWebView: FC<BeagleWebViewInterface> = props => {
const { url, className, style } = props

return (
<StyledWebView className={className} style={style} src={url}>
</StyledWebView>
)
}

export default withTheme(BeagleWebView)
24 changes: 24 additions & 0 deletions src/components/BeagleWebView/styled.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright 2020 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import styled from 'styled-components'


export const StyledWebView = styled.iframe`
width: inherit;
border: none;
align-self:normal;
`
pedronaveszup marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 2 additions & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import Markdown from './Markdown'
import Modal from './Modal'
import TextArea from './TextArea'
import BeagleInput from './BeagleInput'
import BeagleWebView from './BeagleWebView'

const libRequiredComponents = {
'custom:error': BeagleError,
Expand All @@ -53,6 +54,7 @@ const beagleDefaultComponents = {
'beagle:simpleform': BeagleSimpleForm,
'beagle:lazycomponent': BeagleLazy,
'beagle:input': BeagleInput,
'beagle:webview': BeagleWebView,
}

const webSpecificComponents = {
Expand Down