feat: Iframe component API and docs improvements
This commit is contained in:
parent
4b5d549190
commit
b7ee5a1869
@ -7,7 +7,7 @@ import 'ag-grid-community/styles/ag-theme-alpine.css';
|
|||||||
import { Data } from '../types/properties';
|
import { Data } from '../types/properties';
|
||||||
|
|
||||||
export type ExcelProps = {
|
export type ExcelProps = {
|
||||||
data: Pick<Data, 'url'>;
|
data: Required<Pick<Data, 'url'>>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function Excel({ data }: ExcelProps) {
|
export function Excel({ data }: ExcelProps) {
|
||||||
|
|||||||
@ -1,14 +1,17 @@
|
|||||||
import { CSSProperties } from "react";
|
import { CSSProperties } from 'react';
|
||||||
|
import { Data } from '../types/properties';
|
||||||
|
|
||||||
export interface IframeProps {
|
export interface IframeProps {
|
||||||
url: string;
|
data: Required<Pick<Data, 'url'>>;
|
||||||
style?: CSSProperties;
|
style?: CSSProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Iframe({
|
export function Iframe({ data, style }: IframeProps) {
|
||||||
url, style
|
const url = data.url;
|
||||||
}: IframeProps) {
|
|
||||||
return (
|
return (
|
||||||
<iframe src={url} style={style ?? { width: `100%`, height: `100%` }}></iframe>
|
<iframe
|
||||||
|
src={url}
|
||||||
|
style={style ?? { width: `100%`, height: `100%` }}
|
||||||
|
></iframe>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,13 +7,13 @@ const meta: Meta = {
|
|||||||
component: Iframe,
|
component: Iframe,
|
||||||
tags: ['autodocs'],
|
tags: ['autodocs'],
|
||||||
argTypes: {
|
argTypes: {
|
||||||
url: {
|
data: {
|
||||||
description:
|
description:
|
||||||
'Page to display inside of the component',
|
'Object with a `url` property pointing to the page to be embeded.',
|
||||||
},
|
},
|
||||||
style: {
|
style: {
|
||||||
description:
|
description:
|
||||||
'Style of the component',
|
'Style object of the component. See example at https://react.dev/learn#displaying-data. Defaults to `{ width: "100%", height: "100%" }`',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -25,7 +25,9 @@ type Story = StoryObj<IframeProps>;
|
|||||||
export const Normal: Story = {
|
export const Normal: Story = {
|
||||||
name: 'Iframe',
|
name: 'Iframe',
|
||||||
args: {
|
args: {
|
||||||
|
data: {
|
||||||
url: 'https://app.powerbi.com/view?r=eyJrIjoiYzBmN2Q2MzYtYzE3MS00ODkxLWE5OWMtZTQ2MjBlMDljMDk4IiwidCI6Ijk1M2IwZjgzLTFjZTYtNDVjMy04MmM5LTFkODQ3ZTM3MjMzOSIsImMiOjh9',
|
url: 'https://app.powerbi.com/view?r=eyJrIjoiYzBmN2Q2MzYtYzE3MS00ODkxLWE5OWMtZTQ2MjBlMDljMDk4IiwidCI6Ijk1M2IwZjgzLTFjZTYtNDVjMy04MmM5LTFkODQ3ZTM3MjMzOSIsImMiOjh9',
|
||||||
style: {width: `100%`, height: `100%`}
|
},
|
||||||
|
style: { width: `100%`, height: `100%` },
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user