-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sue Burt
committed
Jan 13, 2025
1 parent
66acb11
commit b0f8b2a
Showing
6 changed files
with
82 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
public/src/components/channelManagement/gutterTests/gutterVariantPreview.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React from 'react'; | ||
import { GutterVariant } from '../../../models/gutter'; | ||
import { buildStorybookUrl } from '../helpers/dcrStorybook'; | ||
import { Theme } from '@mui/material'; | ||
import { makeStyles } from '@mui/styles'; | ||
|
||
interface GutterProps { | ||
url: string; | ||
onCtaClick: () => void; // current props. | ||
// TODO: once DCR done, implement the rest | ||
} | ||
// TODO: remove this lint line when props passed in properly later | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const buildProps = (variant: GutterVariant): GutterProps => ({ | ||
url: ' ', | ||
onCtaClick: () => {}, | ||
// TODO: update with proper props later! | ||
}); | ||
|
||
const useStyles = makeStyles(({}: Theme) => ({ | ||
container: { | ||
width: '620px', | ||
}, | ||
iframe: { | ||
width: '620px', | ||
height: '800px', | ||
}, | ||
})); | ||
|
||
interface GutterVariantPreviewProps { | ||
variant: GutterVariant; | ||
} | ||
/** | ||
* Uses the DCR storybook to render the component, iframed. | ||
* Props are passed in the args parameter in the url. | ||
*/ | ||
const GutterVariantPreview: React.FC<GutterVariantPreviewProps> = ({ | ||
variant, | ||
}: GutterVariantPreviewProps) => { | ||
const classes = useStyles(); | ||
|
||
const props = buildProps(variant); | ||
|
||
const storyName = 'components-marketing-stickyliveblogask--default'; | ||
const storybookUrl = buildStorybookUrl(storyName, props); | ||
|
||
return ( | ||
<div> | ||
<iframe className={classes.iframe} src={storybookUrl}></iframe> | ||
</div> | ||
); | ||
}; | ||
|
||
export default GutterVariantPreview; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters