Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created Iframe component #1066

Merged
merged 3 commits into from
Jan 18, 2024
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
5 changes: 5 additions & 0 deletions .changeset/nervous-pens-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@portaljs/components': patch
---

Created Iframe component
14 changes: 14 additions & 0 deletions packages/components/src/components/Iframe.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { CSSProperties } from "react";

export interface IframeProps {
url: string;
style?: CSSProperties;
}

export function Iframe({
url, style
}: IframeProps) {
return (
<iframe src={url} style={style ?? { width: `100%`, height: `100%` }}></iframe>
);
}
1 change: 1 addition & 0 deletions packages/components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ export * from './components/Map';
export * from './components/PdfViewer';
export * from "./components/Excel";
export * from "./components/BucketViewer";
export * from "./components/Iframe";
4 changes: 2 additions & 2 deletions packages/components/stories/BucketViewer.stories.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { raw, type Meta, type StoryObj } from '@storybook/react';
import { type Meta, type StoryObj } from '@storybook/react';

import { BucketViewer, BucketViewerData, BucketViewerProps } from '../src/components/BucketViewer';
import { BucketViewer, BucketViewerProps } from '../src/components/BucketViewer';

// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction
const meta: Meta = {
Expand Down
31 changes: 31 additions & 0 deletions packages/components/stories/Iframe.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { type Meta, type StoryObj } from '@storybook/react';

import { Iframe, IframeProps } from '../src/components/Iframe';

const meta: Meta = {
title: 'Components/Iframe',
component: Iframe,
tags: ['autodocs'],
argTypes: {
url: {
description:
'Page to display inside of the component',
},
style: {
description:
'Style of the component',
},
},
};

export default meta;

type Story = StoryObj<IframeProps>;

export const Normal: Story = {
name: 'Iframe',
args: {
url: 'https://app.powerbi.com/view?r=eyJrIjoiYzBmN2Q2MzYtYzE3MS00ODkxLWE5OWMtZTQ2MjBlMDljMDk4IiwidCI6Ijk1M2IwZjgzLTFjZTYtNDVjMy04MmM5LTFkODQ3ZTM3MjMzOSIsImMiOjh9',
style: {width: `100%`, height: `100%`}
},
};